ImportCommandTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 7
Bugs 2 Features 3
Metric Value
c 7
b 2
f 3
dl 0
loc 44
wmc 4
lcom 1
cbo 3
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommandInstance() 0 4 1
A getCommand() 0 4 1
A testSuccessExecute() 0 9 1
A execution() 0 6 1
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