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

QueueDeleteCommandTest::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\QueueDeleteCommand;
8
9
class QueueDeleteCommandTest 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
        $application->add(new QueueDeleteCommand());
25
26
        $command = $application->find('jobqueue:delete');
27
        $commandTester = new CommandTester($command);
28
        $commandTester->execute(array(
29
            'command' => $command->getName(),
30
            'queue-name' => 'my:queue1',
31
        ), array('interactive' => false));
32
33
        $this->assertRegExp('/Queue "my:queue1" deleted/', $commandTester->getDisplay(), 'Deleted queue');
34
    }
35
}
36