Back to index

php5  5.3.10
gtCommandLineOptionsTest.php
Go to the documentation of this file.
00001 <?php
00002 require_once 'PHPUnit/Framework.php';
00003   require_once dirname(__FILE__) . '/../src/gtAutoload.php';
00004 
00005 
00006   class gtCommandLineOptionsTest extends PHPUnit_Framework_TestCase
00007   {
00008     
00012     public function testNoOption() {
00013       $clo = new gtCommandLineOptions();
00014       $clo->parse(array('generate-phpt.php'));
00015     }
00016 
00017     public function testShortOption() {
00018       $clo = new gtCommandLineOptions();
00019       $clo->parse(array('generate-phpt.php', '-h'));
00020       $this->assertTrue($clo->hasOption('h'));
00021     }
00022 
00023     public function testShortOptionArgument() {
00024       $clo = new gtCommandLineOptions();
00025       $clo->parse(array('generate-phpt.php', '-f', 'some-function'));
00026       $this->assertTrue($clo->hasOption('f'));
00027       $this->assertEquals('some-function', $clo->getOption('f'));
00028     }
00029     
00033       public function testInvalidOption() {
00034       $clo = new gtCommandLineOptions();
00035       $clo->parse(array('generate-phpt.php', '-z'));
00036     }
00037     
00041    public function testMissingArgument() {
00042       $clo = new gtCommandLineOptions();
00043       $clo->parse(array('generate-phpt.php', '-f'));
00044     }
00045   }
00046 ?>