PurgeCommandTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 14 1
A testInputsDefinitionCommand() 0 10 1
1
<?php
2
3
namespace OldSound\RabbitMqBundle\Tests\Command;
4
5
use OldSound\RabbitMqBundle\Command\PurgeConsumerCommand;
6
use Symfony\Component\Console\Input\InputOption;
7
8
class PurgeCommandTest extends BaseCommandTest
9
{
10
    protected function setUp(): void
11
    {
12
        parent::setUp();
13
        $this->definition->expects($this->any())
14
            ->method('getOptions')
15
            ->will($this->returnValue([
16
                new InputOption('--no-confirmation', null, InputOption::VALUE_NONE, 'Switches off confirmation mode.'),
17
            ]));
18
        $this->application->expects($this->once())
19
            ->method('getHelperSet')
20
            ->will($this->returnValue($this->helperSet));
21
22
        $this->command = new PurgeConsumerCommand();
23
        $this->command->setApplication($this->application);
24
    }
25
26
    /**
27
     * testInputsDefinitionCommand
28
     */
29
    public function testInputsDefinitionCommand()
30
    {
31
        // check argument
32
        $definition = $this->command->getDefinition();
33
        $this->assertTrue($definition->hasArgument('name'));
34
        $this->assertTrue($definition->getArgument('name')->isRequired()); // Name is required to find the service
35
36
        //check options
37
        $this->assertTrue($definition->hasOption('no-confirmation'));
38
        $this->assertFalse($definition->getOption('no-confirmation')->acceptValue()); // It shouldn't accept value because it is a true/false input
39
    }
40
}
41