1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OldSound\RabbitMqBundle\Tests\Command; |
4
|
|
|
|
5
|
|
|
use OldSound\RabbitMqBundle\Command\MultipleConsumerCommand; |
6
|
|
|
use Symfony\Component\Console\Input\InputOption; |
7
|
|
|
|
8
|
|
|
class MultipleConsumerCommandTest 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('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'), |
17
|
|
|
new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'), |
18
|
|
|
new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'), |
19
|
|
|
])); |
20
|
|
|
$this->application->expects($this->once()) |
21
|
|
|
->method('getHelperSet') |
22
|
|
|
->will($this->returnValue($this->helperSet)); |
23
|
|
|
|
24
|
|
|
$this->command = new MultipleConsumerCommand(); |
25
|
|
|
$this->command->setApplication($this->application); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* testInputsDefinitionCommand |
30
|
|
|
*/ |
31
|
|
|
public function testInputsDefinitionCommand() |
32
|
|
|
{ |
33
|
|
|
// check argument |
34
|
|
|
$definition = $this->command->getDefinition(); |
35
|
|
|
$this->assertTrue($definition->hasArgument('name')); |
36
|
|
|
$this->assertTrue($definition->getArgument('name')->isRequired()); // Name is required to find the service |
37
|
|
|
|
38
|
|
|
$this->assertTrue($definition->hasArgument('context')); |
39
|
|
|
$this->assertFalse($definition->getArgument('context')->isRequired()); // Context is required for the queue options provider |
40
|
|
|
|
41
|
|
|
//check options |
42
|
|
|
$this->assertTrue($definition->hasOption('messages')); |
43
|
|
|
$this->assertTrue($definition->getOption('messages')->isValueOptional()); // It should accept value |
44
|
|
|
|
45
|
|
|
$this->assertTrue($definition->hasOption('route')); |
46
|
|
|
$this->assertTrue($definition->getOption('route')->isValueOptional()); // It should accept value |
47
|
|
|
|
48
|
|
|
$this->assertTrue($definition->hasOption('without-signals')); |
49
|
|
|
$this->assertFalse($definition->getOption('without-signals')->acceptValue()); // It shouldn't accept value because it is a true/false input |
50
|
|
|
|
51
|
|
|
$this->assertTrue($definition->hasOption('debug')); |
52
|
|
|
$this->assertFalse($definition->getOption('debug')->acceptValue()); // It shouldn't accept value because it is a true/false input |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|