Back to index

php5  5.3.10
gtMethodTest.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 gtMethodTest extends PHPUnit_Framework_TestCase
00007 {
00008   public function testGetParams() {
00009     $m = new gtMethod('DOMDocument', 'createAttribute');
00010     $m->setArgumentNames();
00011     $a = $m->getMandatoryArgumentNames();
00012     $this->assertEquals($a[0], 'name');
00013   }
00014 
00015   public function testConstructor() {
00016     $m = new gtMethod('DOMDocument', 'createAttribute');
00017     $m->setConstructorArgumentNames();
00018     $a = $m->getConstructorArgumentNames();
00019     $this->assertEquals($a[0], 'version');
00020     $this->assertEquals($a[1], 'encoding');
00021   }
00022 
00023   public function testExtraParamList() {
00024     $m = new gtMethod('DOMDocument', 'createAttribute');
00025     $m->setArgumentNames();
00026     $m->setExtraArgumentList();
00027     $this->assertEquals('$name, $extra_arg',$m->getExtraArgumentList());
00028   }
00029 
00030   public function testShortParamList() {
00031     $m = new gtMethod('DOMDocument', 'createAttribute');
00032     $m->setArgumentNames();
00033     $m->setShortArgumentList();
00034     $this->assertEquals('',$m->getShortArgumentList());
00035   }
00036 
00037   public function testAllParamList() {
00038     $m = new gtMethod('DOMDocument', 'createAttribute');
00039     $m->setArgumentNames();
00040     $m->setValidArgumentLists();
00041     $a = $m->getValidArgumentLists();
00042     $this->assertEquals('$name',$a[0]);
00043   }
00044 
00045   public function testMaxParamList() {
00046     $m = new gtMethod('DOMDocument', 'createAttribute');
00047     $m->setArgumentNames();
00048     $m->setValidArgumentLists();
00049     $this->assertEquals('$name',$m->getMaximumArgumentList());
00050   }
00051 
00052 
00053 
00054   public function testConstructorList() {
00055     $m = new gtMethod('Phar', 'buildFromDirectory');
00056     $m->setArgumentNames();
00057     $m->setConstructorArgumentNames();
00058 
00059     $m->setConstructorArgumentList();
00060     $this->assertEquals('$filename, $flags, $alias, $fileformat',$m->getConstructorArgumentList());
00061 
00062   }
00063 
00064   public function testConstructorInit() {
00065     $m = new gtMethod('Phar', 'buildFromDirectory');
00066     $m->setArgumentNames();
00067     $m->setConstructorArgumentNames();
00068 
00069     $m->setConstructorInitStatements();
00070     $a = $m->getConstructorInitStatements();
00071     $this->assertEquals('$filename = ',$a[0]);
00072     $this->assertEquals('$flags = ',$a[1]);
00073     $this->assertEquals('$alias = ',$a[2]);
00074     $this->assertEquals('$fileformat = ',$a[3]);
00075   }
00076 
00077 
00078 
00079 
00080 }
00081 
00082 ?>