| Total Complexity | 6 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class ArgParserTest extends TestCase |
||
| 9 | { |
||
| 10 | protected $parser; |
||
| 11 | |||
| 12 | public function setUp() |
||
| 13 | { |
||
| 14 | $args = [ |
||
| 15 | 'file.php', |
||
| 16 | '--some-opt=some-val', |
||
| 17 | 'file', |
||
| 18 | '-a', |
||
| 19 | 'file2', |
||
| 20 | ]; |
||
| 21 | $this->parser = new ArgParser($args); |
||
| 22 | } |
||
| 23 | public function testNumericArgs() |
||
| 24 | { |
||
| 25 | $this->assertSame("file", $this->parser->getArg(1)); |
||
| 26 | $this->assertSame("file2", $this->parser->getArg(2)); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testInvalidNumericalArg() |
||
| 30 | { |
||
| 31 | $this->expectException(ArgumentNotFound::class); |
||
| 32 | |||
| 33 | $this->parser->getArg(3); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function testAlphaArgs() |
||
| 37 | { |
||
| 38 | $this->assertSame("1", $this->parser->getArg('a')); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function testInvalidAlphaArgs() |
||
| 46 | } |
||
| 47 | |||
| 48 | public function testArgumentsWithValues() |
||
| 49 | { |
||
| 50 | $this->assertEquals('some-val', $this->parser->getArg('some-opt')); |
||
| 53 |