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.

ParameterHelperTest::testExecute()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 46
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 8.9411
c 0
b 0
f 0
cc 1
eloc 28
nc 1
nop 0
1
<?php
2
namespace Naneau\FileGen\Test\Console;
3
4
use Naneau\FileGen\Console\Helper\ParameterHelper;
5
6
use Naneau\FileGen\Structure;
7
8
use Naneau\FileGen\Test\Console\ParameterCommand;
9
10
use Symfony\Component\Console\Application;
11
12
use Symfony\Component\Console\Helper\QuestionHelper;
13
use Symfony\Component\Console\Helper\HelperSet;
14
use Symfony\Component\Console\Tester\CommandTester;
15
16
/**
17
 * Testing the parameter helper
18
 */
19
class ParameterHelperTest extends \PHPUnit\Framework\TestCase
20
{
21
    public function testExecute()
22
    {
23
        $application = new Application();
24
        $application->getHelperSet()->set(new ParameterHelper, 'filegenParameters');
25
26
        $command = new ParameterCommand;
27
        $application->add($command);
28
29
        $structure = new Structure;
30
        $structure
31
            ->parameter('foo', 'foo description')
32
            ->parameter('bar', 'bar description')
33
            ->parameter('baz', 'baz description');
34
35
        $structure->getParameterDefinition()->get('baz')->setDefaultValue('BazValue');
36
37
        $command->setStructure($structure);
38
39
        $commandTester = new CommandTester($command);
40
41
        // Set the input stream
42
        $helper = $command->getHelper('question');
43
        $helper->setInputStream(
44
            $this->getInputStream("FooValue\nBarValue\n\n")
45
        );
46
47
        $commandTester->execute(array(
48
            'command' => $command->getName())
49
        );
50
51
        $this->assertEquals(
52
            'foo descriptionbar descriptionbaz description',
53
            $commandTester->getDisplay()
54
        );
55
56
        $received = $command->getReceived();
57
58
        $this->assertArrayHasKey('foo', $received);
59
        $this->assertEquals('FooValue', $received['foo']);
60
61
        $this->assertArrayHasKey('bar', $received);
62
        $this->assertEquals('BarValue', $received['bar']);
63
64
        $this->assertArrayHasKey('baz', $received);
65
        $this->assertEquals('BazValue', $received['baz']);
66
    }
67
68
    /**
69
     * Get input stream
70
     *
71
     * @param string $input
72
     * @return resource
73
     **/
74
    protected function getInputStream($input)
75
    {
76
        $stream = fopen('php://memory', 'r+', false);
77
        fputs($stream, $input);
78
        rewind($stream);
79
80
        return $stream;
81
    }
82
}
83