Completed
Branch master (c3d959)
by Alexandre
09:54
created

QueueCreateCommandTest::testExecute()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 24
rs 8.9713
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
3
use Symfony\Component\Console\Tester\CommandTester;
4
use Symfony\Bundle\FrameworkBundle\Console\Application;
5
use Heri\Bundle\JobQueueBundle\Tests\TestCase;
6
use Heri\Bundle\JobQueueBundle\Command\QueueCreateCommand;
7
use Heri\Bundle\JobQueueBundle\Command\Queue;
8
9
class QueueCreateCommandTest extends TestCase
10
{
11
    public function testExecute()
12
    {
13
        $application = new Application($this->kernel);
14
        $application->add(new QueueCreateCommand());
15
16
        $command = $application->find('jobqueue:create');
17
        $commandTester = new CommandTester($command);
18
        $commandTester->execute(array(
19
            'command' => $command->getName(),
20
            'queue-name' => 'my:queue1',
21
            '--timeout' => 10,
22
        ), array('interactive' => false));
23
24
        $this->assertRegExp('/Queue "my:queue1" created/', $commandTester->getDisplay(), 'Created queue');
25
26
        $commandTester = new CommandTester($command);
27
        $commandTester->execute(array(
28
            'command' => $command->getName(),
29
            'queue-name' => 'my:queue1',
30
            '--timeout' => 10,
31
        ), array('interactive' => false));
32
33
        $this->assertRegExp('/Queue "my:queue1" updated/', $commandTester->getDisplay(), 'Updated queue');
34
    }
35
}
36