RequestInputTest::testParamsCorrectlySetted()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModuleTest\Component\Console\Input;
6
7
use DoctrineModule\Component\Console\Input\RequestInput;
8
use Laminas\Console\Request;
9
use PHPUnit\Framework\TestCase;
10
use function array_shift;
11
12
/**
13
 * Tests for {@see \DoctrineModule\Component\Console\Input\RequestInput}
14
 */
15
class RequestInputTest extends TestCase
16
{
17
    /**
18
     * @covers \DoctrineModule\Component\Console\Input\RequestInput
19
     */
20
    public function testParamsCorrectlySetted() : void
21
    {
22
        $params = [
23
            'scriptname.php',
24
            'list',
25
            '--help',
26
            '--foo=bar',
27
        ];
28
29
        $request = new Request($params);
30
31
        $input = new RequestInput($request);
32
33
        array_shift($params);
34
35
        $this->assertTrue($input->hasParameterOption('list'));
36
        $this->assertTrue($input->hasParameterOption('--help'));
37
        $this->assertSame('bar', $input->getParameterOption('--foo'));
38
    }
39
}
40