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

QueueDeleteCommandTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6
Metric Value
wmc 1
lcom 1
cbo 6
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testExecute() 0 24 1
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