Completed
Pull Request — master (#11)
by Christophe
04:10
created

FunctionalTest::getKernelClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Incenteev\TranslationCheckerBundle\Tests;
4
5
use Symfony\Bundle\FrameworkBundle\Console\Application;
6
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
7
use Symfony\Component\Console\Input\ArrayInput;
8
use Symfony\Component\Console\Output\NullOutput;
9
10
class FunctionalTest extends KernelTestCase
11
{
12
    /**
13
     * @dataProvider provideComparisonCases
14
     */
15
    public function testCompareCommand($locale, $valid)
16
    {
17
        self::bootKernel();
18
19
        $application = new Application(self::$kernel);
20
        $application->setAutoExit(false);
21
        $application->setCatchExceptions(false);
22
23
        $input = new ArrayInput(array('command' => 'incenteev:translation:compare', 'locale' => $locale, '-d' => array('test')));
24
        $output = new NullOutput();
25
26
        $expectedExitCode = $valid ? 0 : 1;
27
28
        $this->assertSame($expectedExitCode, $application->run($input, $output));
29
    }
30
31
    public static function provideComparisonCases()
32
    {
33
        return array(
34
            array('fr', true),
35
            array('de', false),
36
        );
37
    }
38
39
    protected static function getKernelClass()
40
    {
41
        return 'Incenteev\TranslationCheckerBundle\Tests\FixtureApp\TestKernel';
42
    }
43
}
44