ImportCommandTest::testSuccessExecute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 1 Features 2
Metric Value
c 5
b 1
f 2
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Sleepness\UberTranslationBundle\Tests\Command;
4
5
use Sleepness\UberTranslationBundle\Command\ImportCommand;
6
7
/**
8
 * Test ImportCommand executing cases
9
 *
10
 * @author Viktor Novikov <[email protected]>
11
 * @author Alexandr Zhulev <[email protected]>
12
 */
13
class ImportCommandTest extends CommandTestCase
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    protected function getCommandInstance()
19
    {
20
        return new ImportCommand();
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function getCommand()
27
    {
28
        return 'uber:translations:import';
29
    }
30
31
    /**
32
     * Test command success execution
33
     */
34
    public function testSuccessExecute()
35
    {
36
        $this->execution(
37
            array(
38
                'bundle' => 'TestBundle',
39
            ),
40
            "\033[37;42m Translations from TestBundle imported successfully! \033[0m"
41
        );
42
    }
43
44
    /**
45
     * Common operations for import command tests
46
     *
47
     * @param $arguments - array of arguments for command
48
     * @param $output - expected output
49
     */
50
    private function execution($arguments, $output)
51
    {
52
        $this->commandTester->execute($arguments);
53
        $this->assertTrue(is_string($this->commandTester->getDisplay()));
54
        $this->assertEquals($output, trim($this->commandTester->getDisplay()));
55
    }
56
}
57