Passed
Push — master ( c950cb...85bd60 )
by Malte
03:07
created

CommandTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace AppBundle\ShowUnusedMySQLTables;
4
5
use Symfony\Bundle\FrameworkBundle\Console\Application;
6
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
7
use Symfony\Component\Console\Tester\CommandTester;
8
9
/**
10
 * Tests for the ShowUnusedMySQLTables console command.
11
 */
12
final class CommandTest extends KernelTestCase
13
{
14
    /** @var Command */
15
    private $command;
16
17
    /** @var CommandTester */
18
    private $commandTester;
19
20
    /**
21
     * @see \PHPUnit_Framework_TestCase::setUp()
22
     */
23
    protected function setUp()
24
    {
25
        // set up command tester
26
        self::bootKernel();
27
        $application = new Application(self::$kernel);
28
        $application->add(new Command());
29
        $this->command = $application->find('show-unused-mysql-tables');
30
        $this->commandTester = new CommandTester($this->command);
31
    }
32
33
    /**
34
     * @test
35
     */
36
    public function successOutput()
37
    {
38
        $this->commandTester->execute([
39
            'command'  => $this->command->getName(),
40
        ]);
41
42
        $output = $this->commandTester->getDisplay();
43
        $this->assertContains('[OK]', $output);
44
    }
45
}
46