Back to index

php5  5.3.10
gtOptionalSectionsTest.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 gtOptionalSectionsTest extends PHPUnit_Framework_TestCase
00007 {
00008   public function testBasic() {
00009 
00010     $clo = new gtCommandLineOptions();
00011     $clo->parse(array('generate-phpt.php', '-s', 'skipif:ini'));
00012 
00013     $opt = new gtOptionalSections();
00014     $opt->setOptions($clo);
00015     $a = $opt->getOptions();
00016     $this->assertEquals(true, $a['skipif']);
00017     $this->assertEquals(true, $a['ini']);
00018     $this->assertEquals(false, $a['clean']);
00019   }
00020 
00024   public function testException() {
00025     $clo = new gtCommandLineOptions();
00026     $clo->parse(array('generate-phpt.php', '-s', 'blah'));
00027     $opt = new gtOptionalSections();
00028     $opt->setOptions($clo);
00029   }
00030   
00031   public function testSkip() {
00032     $clo = new gtCommandLineOptions();
00033     $clo->parse(array('generate-phpt.php', '-s', 'skipif', '-x', 'standard'));
00034     $opt = new gtOptionalSections();
00035     $opt->setOptions($clo);
00036     
00037     $opt = new gtOptionalSections();
00038     $opt->setOptions($clo);
00039     
00040     $this->assertEquals('standard', $opt->getSkipifExt() );
00041 
00042   }
00043   
00044   public function testSkipKey() {
00045     $clo = new gtCommandLineOptions();
00046     $clo->parse(array('generate-phpt.php', '-s', 'skipif', '-k', 'win'));
00047     $opt = new gtOptionalSections();
00048     $opt->setOptions($clo);
00049     
00050     $opt = new gtOptionalSections();
00051     $opt->setOptions($clo);
00052     
00053     $this->assertEquals('win', $opt->getSkipifKey() );
00054 
00055   }
00056 
00057 }
00058 ?>