summaryrefslogtreecommitdiff
path: root/scripts/dev/generate-phpt/tests
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dev/generate-phpt/tests')
-rw-r--r--scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php24
-rw-r--r--scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php28
-rw-r--r--scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php15
-rw-r--r--scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php46
-rw-r--r--scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php28
-rw-r--r--scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php30
-rw-r--r--scripts/dev/generate-phpt/tests/gtFunctionTest.php71
-rw-r--r--scripts/dev/generate-phpt/tests/gtIfClassHasMethodTest.php41
-rw-r--r--scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php41
-rw-r--r--scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php32
-rw-r--r--scripts/dev/generate-phpt/tests/gtIsValidClassTest.php41
-rw-r--r--scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php40
-rw-r--r--scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php40
-rw-r--r--scripts/dev/generate-phpt/tests/gtMethodTest.php82
-rw-r--r--scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php58
-rw-r--r--scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php59
-rw-r--r--scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php27
17 files changed, 703 insertions, 0 deletions
diff --git a/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php b/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php
new file mode 100644
index 0000000..dbba0d6
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php
@@ -0,0 +1,24 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+class gtBasicTestCaseFunctionTest extends PHPUnit_Framework_TestCase {
+
+
+ public function testTestCase() {
+
+ $f = new gtFunction('cos');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+ $f->setInitialisationStatements();
+ $optSect = new gtOptionalSections();
+
+ $btc = gtBasicTestCase::getInstance($optSect);
+ $btc->setFunction($f);
+ $btc->constructTestCase();
+
+ $fs = $btc->toString();
+ $this->assertTrue(is_string($fs));
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php b/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php
new file mode 100644
index 0000000..81307f1
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php
@@ -0,0 +1,28 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+class gtBasicTestCaseMethodTest extends PHPUnit_Framework_TestCase {
+
+
+ public function testTestCase() {
+
+ $f = new gtMethod('DOMDocument','createAttribute');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+ $f->setInitialisationStatements();
+ $f->setConstructorArgumentNames();
+ $f->setConstructorInitStatements();
+
+ $optSect = new gtOptionalSections();
+ $btc = gtBasicTestCaseMethod::getInstance($optSect, 'method');
+ $btc->setMethod($f);
+ $btc->constructTestCase();
+
+
+ $fs = $btc->toString();
+ $this->assertTrue(is_string($fs));
+
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php b/scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php
new file mode 100644
index 0000000..bc0c48a
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php
@@ -0,0 +1,15 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtCodeSnippetTest extends PHPUnit_Framework_TestCase
+{
+
+ public function testAppend() {
+ $array = array('something', 'nothing');
+ $array = gtCodeSnippet::append('loopClose', $array);
+ $this->assertEquals($array[2], '}');
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php b/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php
new file mode 100644
index 0000000..2fd6818
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php
@@ -0,0 +1,46 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+ require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+ class gtCommandLineOptionsTest extends PHPUnit_Framework_TestCase
+ {
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testNoOption() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php'));
+ }
+
+ public function testShortOption() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-h'));
+ $this->assertTrue($clo->hasOption('h'));
+ }
+
+ public function testShortOptionArgument() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-f', 'some-function'));
+ $this->assertTrue($clo->hasOption('f'));
+ $this->assertEquals('some-function', $clo->getOption('f'));
+ }
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testInvalidOption() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-z'));
+ }
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testMissingArgument() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-f'));
+ }
+ }
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php b/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php
new file mode 100644
index 0000000..5b72fcc
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php
@@ -0,0 +1,28 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+class gtErrorTestCaseFunctionTest extends PHPUnit_Framework_TestCase {
+
+
+ public function testTestCase() {
+
+ $f = new gtFunction('cos');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+ $f->setInitialisationStatements();
+
+ $optSect = new gtOptionalSections();
+
+ $btc = gtErrorTestCase::getInstance($optSect);
+ $btc->setFunction($f);
+ $btc->constructTestCase();
+
+
+ $fs = $btc->toString();
+ $this->assertTrue(is_string($fs));
+
+ }
+
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php b/scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php
new file mode 100644
index 0000000..7077881
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php
@@ -0,0 +1,30 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+class gtErrorTestCaseMethodTest extends PHPUnit_Framework_TestCase {
+
+
+ public function testTestCase() {
+
+ $f = new gtMethod('DOMDocument', 'createAttribute');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+
+ $f->setInitialisationStatements();
+
+ $f->setConstructorArgumentNames();
+ $f->setConstructorInitStatements();
+
+ $optSect = new gtOptionalSections();
+
+ $btc = gtErrorTestCase::getInstance($optSect,'method');
+ $btc->setMethod($f);
+ $btc->constructTestCase();
+
+
+ $fs = $btc->toString();
+ $this->assertTrue(is_string($fs));
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtFunctionTest.php b/scripts/dev/generate-phpt/tests/gtFunctionTest.php
new file mode 100644
index 0000000..0aa7eac
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtFunctionTest.php
@@ -0,0 +1,71 @@
+cd
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtFunctionTest extends PHPUnit_Framework_TestCase
+{
+ public function testArguments() {
+
+ $f = new gtFunction('cos');
+ $f->setArgumentNames();
+ $m = $f->getMandatoryArgumentNames();
+ $this->assertEquals($m[0], 'number');
+ }
+
+ public function testArguments2() {
+
+ $f = new gtFunction('version_compare');
+ $f->setArgumentNames();
+ $m = $f->getMandatoryArgumentNames();
+ $o = $f->getOptionalArgumentNames();
+ $this->assertEquals($m[0], 'ver1');
+ $this->assertEquals($m[1], 'ver2');
+ $this->assertEquals($o[0], 'oper');
+
+ }
+
+ public function testExtraArguments() {
+
+ $f = new gtFunction('version_compare');
+ $f->setArgumentNames();
+ $f->setExtraArgumentList();
+
+ $this->assertEquals('$ver1, $ver2, $oper, $extra_arg', $f->getExtraArgumentList());
+ }
+
+ public function testShortArguments() {
+
+ $f = new gtFunction('version_compare');
+ $f->setArgumentNames();
+ $f->setShortArgumentList();
+
+ $this->assertEquals('$ver1', $f->getShortArgumentList());
+ }
+
+ public function testAllArgumentList() {
+
+ $f = new gtFunction('version_compare');
+ $f->setArgumentNames();
+ $f->setValidArgumentLists();
+ $a = $f->getValidArgumentLists();
+
+ $this->assertEquals('$ver1, $ver2', $a[0]);
+ $this->assertEquals('$ver1, $ver2, $oper', $a[1]);
+ }
+
+ public function testInitialisation() {
+
+ $f = new gtFunction('version_compare');
+ $f->setArgumentNames();
+ $f->setInitialisationStatements();
+ $a = $f->getInitialisationStatements();
+
+ $this->assertEquals('$ver1 = ', $a[0]);
+ $this->assertEquals('$ver2 = ', $a[1]);
+ $this->assertEquals('$oper = ', $a[2]);
+ }
+
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtIfClassHasMethodTest.php b/scripts/dev/generate-phpt/tests/gtIfClassHasMethodTest.php
new file mode 100644
index 0000000..b9f2410
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtIfClassHasMethodTest.php
@@ -0,0 +1,41 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtIfClassHasMethodTest extends PHPUnit_Framework_TestCase {
+
+ public function testValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah', '-m', 'blah'));
+ $ch = new gtIfClassHasMethod();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testNotValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIfClassHasMethod();
+ $this->assertFalse($ch->check($clo));
+ }
+
+ public function testNotSpecified() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-b'));
+ $ch = new gtIfClassHasMethod();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testMessage() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIfClassHasMethod();
+ $this->assertEquals($ch->getMessage(), gtText::get('methodNotSpecified'));
+ }
+}
+
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php b/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php
new file mode 100644
index 0000000..064edf3
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php
@@ -0,0 +1,41 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtIsSpecifiedFunctionOrMethodTest extends PHPUnit_Framework_TestCase {
+
+ public function testValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-m', 'blah'));
+ $ch = new gtIsSpecifiedFunctionOrMethod();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testValid2() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-f', 'blah'));
+ $ch = new gtIsSpecifiedFunctionOrMethod();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testNotValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-b'));
+ $ch = new gtIsSpecifiedFunctionOrMethod();
+ $this->assertFalse($ch->check($clo));
+
+ }
+
+ public function testMessage() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIsSpecifiedFunctionOrMethod();
+ $this->assertEquals($ch->getMessage(), gtText::get('functionOrMethodNotSpecified'));
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php b/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php
new file mode 100644
index 0000000..c8b0a4e
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php
@@ -0,0 +1,32 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtIsSpecifiedTestTypeTest extends PHPUnit_Framework_TestCase {
+
+ public function testValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument','-b'));
+ $ch = new gtIsSpecifiedTestType();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testNotValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument'));
+ $ch = new gtIsSpecifiedTestType();
+ $this->assertFalse($ch->check($clo));
+ }
+
+ public function testMessage() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIsSpecifiedtestType();
+ $this->assertEquals($ch->getMessage(), gtText::get('testTypeNotSpecified'));
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php b/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php
new file mode 100644
index 0000000..51ca878
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php
@@ -0,0 +1,41 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtIsValidClassTest extends PHPUnit_Framework_TestCase {
+
+ public function testValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument'));
+ $ch = new gtIsValidClass();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testNotValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIsValidClass();
+ $this->assertFalse($ch->check($clo));
+ }
+
+ public function testNotGiven() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php','-b'));
+ $ch = new gtIsValidClass();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testMessage() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIsvalidClass();
+ $this->assertEquals($ch->getMessage(), gtText::get('unknownClass'));
+ }
+}
+
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php b/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php
new file mode 100644
index 0000000..d4700b9
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php
@@ -0,0 +1,40 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtIsValidFunctionTest extends PHPUnit_Framework_TestCase {
+
+ public function testValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-f', 'cos'));
+ $ch = new gtIsValidFunction();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testNotValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-f', 'blah'));
+ $ch = new gtIsValidFunction();
+ $this->assertFalse($ch->check($clo));
+ }
+
+ public function testNotSupplied() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php','-b'));
+ $ch = new gtIsValidFunction();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testMessage() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIsvalidFunction();
+ $this->assertEquals($ch->getMessage(), gtText::get('unknownFunction'));
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php b/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php
new file mode 100644
index 0000000..fe06997
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php
@@ -0,0 +1,40 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtIsValidMethodTest extends PHPUnit_Framework_TestCase {
+
+ public function testValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument', '-m', 'createAttribute'));
+ $ch = new gtIsValidMethod();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testNotValid() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'DOMDocument', '-m', 'blah'));
+ $ch = new gtIsValidMethod();
+ $this->assertFalse($ch->check($clo));
+ }
+
+ public function testNotGiven() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php','-b'));
+ $ch = new gtIsValidMethod();
+ $this->assertTrue($ch->check($clo));
+ }
+
+ public function testMessage() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-c', 'blah'));
+ $ch = new gtIsvalidMethod();
+ $this->assertEquals($ch->getMessage(), gtText::get('unknownMethod'));
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtMethodTest.php b/scripts/dev/generate-phpt/tests/gtMethodTest.php
new file mode 100644
index 0000000..430161e
--- /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
diff --git a/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php b/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php
new file mode 100644
index 0000000..dbf2994
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php
@@ -0,0 +1,58 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+
+class gtOptionalSectionsTest extends PHPUnit_Framework_TestCase
+{
+ public function testBasic() {
+
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-s', 'skipif:ini'));
+
+ $opt = new gtOptionalSections();
+ $opt->setOptions($clo);
+ $a = $opt->getOptions();
+ $this->assertEquals(true, $a['skipif']);
+ $this->assertEquals(true, $a['ini']);
+ $this->assertEquals(false, $a['clean']);
+ }
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testException() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-s', 'blah'));
+ $opt = new gtOptionalSections();
+ $opt->setOptions($clo);
+ }
+
+ public function testSkip() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-s', 'skipif', '-x', 'standard'));
+ $opt = new gtOptionalSections();
+ $opt->setOptions($clo);
+
+ $opt = new gtOptionalSections();
+ $opt->setOptions($clo);
+
+ $this->assertEquals('standard', $opt->getSkipifExt() );
+
+ }
+
+ public function testSkipKey() {
+ $clo = new gtCommandLineOptions();
+ $clo->parse(array('generate-phpt.php', '-s', 'skipif', '-k', 'win'));
+ $opt = new gtOptionalSections();
+ $opt->setOptions($clo);
+
+ $opt = new gtOptionalSections();
+ $opt->setOptions($clo);
+
+ $this->assertEquals('win', $opt->getSkipifKey() );
+
+ }
+
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php b/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php
new file mode 100644
index 0000000..df9f21c
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php
@@ -0,0 +1,59 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+class gtVariationTestCaseFunctionTest extends PHPUnit_Framework_TestCase {
+
+ public function testTestCase() {
+
+ $f = new gtFunction('cos');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+
+ $optSect = new gtOptionalSections();
+
+ $vtc = gtVariationTestCase::getInstance($optSect);
+ $vtc->setUp($f, 1, 'int');
+ $vtc->constructTestCase();
+
+ $fs = $vtc->toString();
+ $this->assertTrue(is_string($fs));
+
+ }
+
+ public function testTestCase2() {
+
+ $f = new gtFunction('date_sunrise');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+ $a = $f->getMandatoryArgumentNames();
+
+ $optSect = new gtOptionalSections();
+
+ $vtc = gtVariationTestCase::getInstance($optSect);
+ $vtc->setUp($f, 6, 'int');
+ $vtc->constructTestCase();
+
+ $fs = $vtc->toString();
+ $this->assertTrue(is_string($fs));
+
+ }
+
+ public function testTestCase3() {
+
+ $f = new gtFunction('date_sunrise');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+
+ $optSect = new gtOptionalSections();
+
+ $vtc = gtVariationTestCase::getInstance($optSect);
+ $vtc->setUp($f, 6, 'array');
+ $vtc->constructTestCase();
+
+ $fs = $vtc->toString();
+ $this->assertTrue(is_string($fs));
+
+ }
+}
+?> \ No newline at end of file
diff --git a/scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php b/scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php
new file mode 100644
index 0000000..d99b656
--- /dev/null
+++ b/scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php
@@ -0,0 +1,27 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/../src/gtAutoload.php';
+
+class gtVariationTestCaseMethodTest extends PHPUnit_Framework_TestCase {
+
+ public function testTestCase() {
+
+ $f = new gtMethod('DOMDocument','createAttribute');
+ $f->setArgumentNames();
+ $f->setArgumentLists();
+
+ $f->setConstructorArgumentNames();
+ $f->setConstructorInitStatements();
+
+ $optSect = new gtOptionalSections();
+
+ $vtc = gtVariationTestCase::getInstance($optSect, 'method');
+ $vtc->setUp($f, 1, 'int');
+ $vtc->constructTestCase();
+ $fs = $vtc->toString();
+
+ $this->assertTrue(is_string($fs));
+
+ }
+}
+?> \ No newline at end of file