Back to index

php5  5.3.10
gtIsValidMethodTest.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 gtIsValidMethodTest extends PHPUnit_Framework_TestCase {
00007 
00008   public function testValid() {
00009 
00010     $clo = new gtCommandLineOptions();
00011     $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument', '-m', 'createAttribute'));
00012     $ch = new gtIsValidMethod();
00013     $this->assertTrue($ch->check($clo));
00014   }
00015 
00016   public function testNotValid() {
00017 
00018     $clo = new gtCommandLineOptions();
00019     $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument', '-m', 'blah'));
00020     $ch = new gtIsValidMethod();
00021     $this->assertFalse($ch->check($clo));
00022   }
00023   
00024   public function testNotGiven() {
00025 
00026     $clo = new gtCommandLineOptions();
00027     $clo->parse(array('generate-phpt.php','-b'));
00028     $ch = new gtIsValidMethod();
00029     $this->assertTrue($ch->check($clo));
00030   }
00031   
00032   public function testMessage() {
00033 
00034     $clo = new gtCommandLineOptions();
00035     $clo->parse(array('generate-phpt.php', '-c', 'blah'));
00036     $ch = new gtIsvalidMethod();
00037     $this->assertEquals($ch->getMessage(), gtText::get('unknownMethod'));
00038   }
00039 }
00040 ?>