GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ImportCommandTest::testImportSucceed()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 40
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 40
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 30
nc 1
nop 0
1
<?php
2
3
namespace EllipseSynergie\LocaleToYaml\Tests\Commands;
4
5
use EllipseSynergie\LocaleToYaml\Commands\ImportCommand;
6
use Symfony\Component\Console\Tester\CommandTester;
7
use Symfony\Component\Console\Application;
8
9
/**
10
 * Class ImportCommandTest
11
 *
12
 * @package EllipseSynergie\ApiResponse\Tests
13
 * @author Dominic Martineau <[email protected]>
14
 */
15
class ImportCommandTest extends \PHPUnit_Framework_TestCase
16
{
17
    public function testImportSucceed()
18
    {
19
        $application = new Application();
20
        $application->add(new ImportCommand());
21
22
        $command = $application->find('lang:import-from-yaml');
23
        $commandTester = new CommandTester($command);
24
        $commandTester->execute(array(
25
            'command'  => $command->getName(),
26
            'in' => 'tests/import.yml',
27
            'out' => 'tests/import.php',
28
        ));
29
30
        // the output of the command in the console
31
        $output = $commandTester->getDisplay();
32
        $this->assertContains('Importing tests/import.yml to tests/import.php', $output);
33
34
        // validate content
35
        $content = "<?php\n\n" .
36
            "return array (\n" .
37
            "  'foo' => 'bar',\n" .
38
            "  'hello' => \n" .
39
            "  array (\n" .
40
            "    'world' => 'Hello world!',\n" .
41
            "    'number' => 666,\n" .
42
            "    'three' => \n" .
43
            "    array (\n" .
44
            "      'four' => 'five',\n" .
45
            "    ),\n" .
46
            "    'multi' => 'This is a\n" .
47
            "multi line\n" .
48
            "sentence.\n" .
49
            "',\n" .
50
            "  ),\n" .
51
            ");";
52
        $this->assertSame($content, file_get_contents('tests/import.php'));
53
54
        // remove outputed file
55
        unlink('tests/import.php');
56
    }
57
58
    /**
59
     * @expectedException \Symfony\Component\Console\Exception\RuntimeException
60
     */
61 View Code Duplication
    public function testImportWithWrongArguments()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
62
    {
63
        $application = new Application();
64
        $application->add(new ImportCommand());
65
66
        $command = $application->find('lang:import-from-yaml');
67
        $commandTester = new CommandTester($command);
68
        $commandTester->execute(array(
69
            'command'  => $command->getName(),
70
        ));
71
    }
72
73
    /**
74
     * @expectedException \EllipseSynergie\LocaleToYaml\Exceptions\FileNotFoundException
75
     */
76 View Code Duplication
    public function testImportWithInvalidFilename()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
77
    {
78
        $application = new Application();
79
        $application->add(new ImportCommand());
80
81
        $command = $application->find('lang:import-from-yaml');
82
        $commandTester = new CommandTester($command);
83
        $commandTester->execute(array(
84
            'command'  => $command->getName(),
85
            'in' => 'tests/foo.yml',
86
            'out' => 'tests/foo.php'
87
        ));
88
    }
89
}
90