1<?php
2/*
3 * This file is part of PHPUnit.
4 *
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11class Util_GetoptTest extends PHPUnit_Framework_TestCase
12{
13    public function testItIncludeTheLongOptionsAfterTheArgument()
14    {
15        $args = [
16            'command',
17            'myArgument',
18            '--colors',
19        ];
20        $actual = PHPUnit_Util_Getopt::getopt($args, '', ['colors==']);
21
22        $expected = [
23            [
24                [
25                    '--colors',
26                    null,
27                ],
28            ],
29            [
30                'myArgument',
31            ],
32        ];
33
34        $this->assertEquals($expected, $actual);
35    }
36
37    public function testItIncludeTheShortOptionsAfterTheArgument()
38    {
39        $args = [
40            'command',
41            'myArgument',
42            '-v',
43        ];
44        $actual = PHPUnit_Util_Getopt::getopt($args, 'v');
45
46        $expected = [
47            [
48                [
49                    'v',
50                    null,
51                ],
52            ],
53            [
54                'myArgument',
55            ],
56        ];
57
58        $this->assertEquals($expected, $actual);
59    }
60}
61