Completed
Push — master ( f4b85b...244823 )
by Alexandre
02:30
created

QueueShowCommandTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 5
Metric Value
wmc 1
lcom 1
cbo 5
dl 17
loc 17
rs 10

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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\QueueShowCommand;
7
8
class QueueShowCommandTest extends TestCase
9
{
10
    public function testExecute()
11
    {
12
        $application = new Application($this->kernel);
13
        $application->add(new QueueShowCommand());
14
15
        $command = $application->find('jobqueue:show');
16
        $commandTester = new CommandTester($command);
17
        $commandTester->execute(array(
18
            'command' => $command->getName(),
19
            'queue-name' => 'toto',
20
        ));
21
22
        $this->assertRegExp('/| id | body | created | ended | failed |/', $commandTester->getDisplay());
23
    }
24
}
25