Yaffs site version 1.1
[yaffs-website] / vendor / phpunit / phpunit / tests / Util / GetoptTest.php
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
11 /**
12  */
13 class Util_GetoptTest extends PHPUnit_Framework_TestCase
14 {
15     public function testItIncludeTheLongOptionsAfterTheArgument()
16     {
17         $args = array(
18             'command',
19             'myArgument',
20             '--colors',
21         );
22         $actual = PHPUnit_Util_Getopt::getopt($args, '', array('colors=='));
23
24         $expected = array(
25             array(
26                 array(
27                     '--colors',
28                     null,
29                 ),
30             ),
31             array(
32                 'myArgument',
33             ),
34         );
35
36         $this->assertEquals($expected, $actual);
37     }
38
39     public function testItIncludeTheShortOptionsAfterTheArgument()
40     {
41         $args = array(
42             'command',
43             'myArgument',
44             '-v',
45         );
46         $actual = PHPUnit_Util_Getopt::getopt($args, 'v');
47
48         $expected = array(
49             array(
50                 array(
51                     'v',
52                     null,
53                 ),
54             ),
55             array(
56                 'myArgument',
57             ),
58         );
59
60         $this->assertEquals($expected, $actual);
61     }
62 }