diff options
| author | Zoe Slattery <zoe@php.net> | 2009-05-07 09:21:43 +0000 |
|---|---|---|
| committer | Zoe Slattery <zoe@php.net> | 2009-05-07 09:21:43 +0000 |
| commit | cba448a9d358451338d57c5e45f7c7e06f3143d2 (patch) | |
| tree | df77a5d196aca30ffeb295d7dd5e79dc2429422a /scripts/dev/generate-phpt/tests/gtMethodTest.php | |
| parent | 903f306a60fddda0c7faf824d9252b08add34456 (diff) | |
| download | php-git-cba448a9d358451338d57c5e45f7c7e06f3143d2.tar.gz | |
Replacing generate script with a new version
Diffstat (limited to 'scripts/dev/generate-phpt/tests/gtMethodTest.php')
| -rw-r--r-- | scripts/dev/generate-phpt/tests/gtMethodTest.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/scripts/dev/generate-phpt/tests/gtMethodTest.php b/scripts/dev/generate-phpt/tests/gtMethodTest.php new file mode 100644 index 0000000000..430161ee1c --- /dev/null +++ b/scripts/dev/generate-phpt/tests/gtMethodTest.php @@ -0,0 +1,82 @@ +<?php +require_once 'PHPUnit/Framework.php'; +require_once dirname(__FILE__) . '/../src/gtAutoload.php'; + + +class gtMethodTest extends PHPUnit_Framework_TestCase +{ + public function testGetParams() { + $m = new gtMethod('DOMDocument', 'createAttribute'); + $m->setArgumentNames(); + $a = $m->getMandatoryArgumentNames(); + $this->assertEquals($a[0], 'name'); + } + + public function testConstructor() { + $m = new gtMethod('DOMDocument', 'createAttribute'); + $m->setConstructorArgumentNames(); + $a = $m->getConstructorArgumentNames(); + $this->assertEquals($a[0], 'version'); + $this->assertEquals($a[1], 'encoding'); + } + + public function testExtraParamList() { + $m = new gtMethod('DOMDocument', 'createAttribute'); + $m->setArgumentNames(); + $m->setExtraArgumentList(); + $this->assertEquals('$name, $extra_arg',$m->getExtraArgumentList()); + } + + public function testShortParamList() { + $m = new gtMethod('DOMDocument', 'createAttribute'); + $m->setArgumentNames(); + $m->setShortArgumentList(); + $this->assertEquals('',$m->getShortArgumentList()); + } + + public function testAllParamList() { + $m = new gtMethod('DOMDocument', 'createAttribute'); + $m->setArgumentNames(); + $m->setValidArgumentLists(); + $a = $m->getValidArgumentLists(); + $this->assertEquals('$name',$a[0]); + } + + public function testMaxParamList() { + $m = new gtMethod('DOMDocument', 'createAttribute'); + $m->setArgumentNames(); + $m->setValidArgumentLists(); + $this->assertEquals('$name',$m->getMaximumArgumentList()); + } + + + + public function testConstructorList() { + $m = new gtMethod('Phar', 'buildFromDirectory'); + $m->setArgumentNames(); + $m->setConstructorArgumentNames(); + + $m->setConstructorArgumentList(); + $this->assertEquals('$filename, $flags, $alias, $fileformat',$m->getConstructorArgumentList()); + + } + + public function testConstructorInit() { + $m = new gtMethod('Phar', 'buildFromDirectory'); + $m->setArgumentNames(); + $m->setConstructorArgumentNames(); + + $m->setConstructorInitStatements(); + $a = $m->getConstructorInitStatements(); + $this->assertEquals('$filename = ',$a[0]); + $this->assertEquals('$flags = ',$a[1]); + $this->assertEquals('$alias = ',$a[2]); + $this->assertEquals('$fileformat = ',$a[3]); + } + + + + +} + +?>
\ No newline at end of file |
