From ba138a3746b3077ebe5b7356b5b49f21cfc30438 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Mon, 23 Jul 2018 17:38:26 +0200 Subject: [PATCH] =?utf8?q?Removed=20the=20generated-tests=20library,=20thi?= =?utf8?q?s=20is=20a=20left=20Z=C3=B6e's=20phpruntests=20repository=20it?= =?utf8?q?=20seems=20and=20never=20fully=20implemented.=20The=20only=20tim?= =?utf8?q?es=20this=20part=20of=20the=20code=20has=20been=20touched=20thro?= =?utf8?q?ughout=20the=20years=20has=20been=20minor=20PRs=20and=20entire?= =?utf8?q?=20php-src=20grep=20commits.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If anything this belongs to the phpruntests.git repository. --- scripts/dev/generate-phpt/build.xml | 15 -- scripts/dev/generate-phpt/gtPackage.php | 30 --- .../generate-phpt/src/codeSnippets/array.txt | 9 - .../src/codeSnippets/boolean.txt | 6 - .../src/codeSnippets/commentEnd.txt | 2 - .../src/codeSnippets/commentStart.txt | 2 - .../src/codeSnippets/emptyUnsetUndefNull.txt | 11 - .../generate-phpt/src/codeSnippets/float.txt | 7 - .../generate-phpt/src/codeSnippets/int.txt | 6 - .../src/codeSnippets/loopClose.txt | 1 - .../src/codeSnippets/loopStart.txt | 1 - .../generate-phpt/src/codeSnippets/object.txt | 25 -- .../src/codeSnippets/skipif64b.txt | 1 - .../src/codeSnippets/skipifnot64b.txt | 1 - .../src/codeSnippets/skipifnotwin.txt | 1 - .../src/codeSnippets/skipifwin.txt | 1 - .../generate-phpt/src/codeSnippets/string.txt | 10 - .../dev/generate-phpt/src/generate-phpt.php | 115 --------- scripts/dev/generate-phpt/src/gtAutoload.php | 63 ----- scripts/dev/generate-phpt/src/gtClassMap.php | 48 ---- .../dev/generate-phpt/src/gtCodeSnippet.php | 72 ------ scripts/dev/generate-phpt/src/gtFunction.php | 48 ---- scripts/dev/generate-phpt/src/gtMethod.php | 139 ----------- .../generate-phpt/src/gtTestCaseWriter.php | 27 -- .../dev/generate-phpt/src/gtTestSubject.php | 166 ------------- scripts/dev/generate-phpt/src/gtText.php | 27 -- .../exceptions/gtMissingArgumentException.php | 7 - .../exceptions/gtMissingOptionsException.php | 7 - .../exceptions/gtUnknownOptionException.php | 7 - .../exceptions/gtUnknownSectionException.php | 6 - .../src/setup/gtCommandLineOptions.php | 98 -------- .../src/setup/gtOptionalSections.php | 79 ------ .../src/setup/gtPreCondition.php | 14 -- .../src/setup/gtPreConditionList.php | 33 --- .../preconditions/gtIfClassHasMethod.php | 18 -- .../gtIsSpecifiedFunctionOrMethod.php | 17 -- .../preconditions/gtIsSpecifiedTestType.php | 17 -- .../setup/preconditions/gtIsValidClass.php | 21 -- .../setup/preconditions/gtIsValidFunction.php | 22 -- .../setup/preconditions/gtIsValidMethod.php | 28 --- .../src/testcase/gtBasicTestCase.php | 37 --- .../src/testcase/gtBasicTestCaseFunction.php | 62 ----- .../src/testcase/gtBasicTestCaseMethod.php | 52 ---- .../src/testcase/gtErrorTestCase.php | 53 ---- .../src/testcase/gtErrorTestCaseFunction.php | 57 ----- .../src/testcase/gtErrorTestCaseMethod.php | 59 ----- .../generate-phpt/src/testcase/gtTestCase.php | 230 ------------------ .../src/testcase/gtVariationContainer.php | 54 ---- .../testcase/gtVariationContainerFunction.php | 43 ---- .../testcase/gtVariationContainerMethod.php | 46 ---- .../src/testcase/gtVariationTestCase.php | 55 ----- .../testcase/gtVariationTestCaseFunction.php | 64 ----- .../testcase/gtVariationTestCaseMethod.php | 68 ------ .../texts/functionOrMethodNotSpecified.txt | 3 - scripts/dev/generate-phpt/src/texts/help.txt | 14 -- .../src/texts/methodNotSpecified.txt | 4 - .../src/texts/testTypeNotSpecified.txt | 3 - .../generate-phpt/src/texts/unknownClass.txt | 4 - .../src/texts/unknownFunction.txt | 4 - .../generate-phpt/src/texts/unknownMethod.txt | 4 - .../tests/gtBasicTestCaseFunctionTest.php | 24 -- .../tests/gtBasicTestCaseMethodTest.php | 28 --- .../generate-phpt/tests/gtCodeSnippetTest.php | 15 -- .../tests/gtCommandLineOptionsTest.php | 46 ---- .../tests/gtErrorTestCaseFunctionTest.php | 28 --- .../tests/gtErrorTestCaseMethodTest.php | 30 --- .../generate-phpt/tests/gtFunctionTest.php | 71 ------ .../tests/gtIfClassHasMethodTest.php | 41 ---- .../gtIsSpecifiedFunctionOrMethodTest.php | 41 ---- .../tests/gtIsSpecifiedTestTypeTest.php | 32 --- .../tests/gtIsValidClassTest.php | 41 ---- .../tests/gtIsValidFunctionTest.php | 40 --- .../tests/gtIsValidMethodTest.php | 40 --- .../dev/generate-phpt/tests/gtMethodTest.php | 82 ------- .../tests/gtOptionalSectionsTest.php | 58 ----- .../tests/gtVariationTestCaseFunctionTest.php | 59 ----- .../tests/gtVariationTestCaseMethodTest.php | 27 -- 77 files changed, 2827 deletions(-) delete mode 100755 scripts/dev/generate-phpt/build.xml delete mode 100644 scripts/dev/generate-phpt/gtPackage.php delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/array.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/boolean.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/commentEnd.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/commentStart.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/float.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/int.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/loopClose.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/loopStart.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/object.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/skipif64b.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/skipifnot64b.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/skipifnotwin.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/skipifwin.txt delete mode 100644 scripts/dev/generate-phpt/src/codeSnippets/string.txt delete mode 100644 scripts/dev/generate-phpt/src/generate-phpt.php delete mode 100644 scripts/dev/generate-phpt/src/gtAutoload.php delete mode 100644 scripts/dev/generate-phpt/src/gtClassMap.php delete mode 100644 scripts/dev/generate-phpt/src/gtCodeSnippet.php delete mode 100644 scripts/dev/generate-phpt/src/gtFunction.php delete mode 100644 scripts/dev/generate-phpt/src/gtMethod.php delete mode 100644 scripts/dev/generate-phpt/src/gtTestCaseWriter.php delete mode 100644 scripts/dev/generate-phpt/src/gtTestSubject.php delete mode 100644 scripts/dev/generate-phpt/src/gtText.php delete mode 100644 scripts/dev/generate-phpt/src/setup/exceptions/gtMissingArgumentException.php delete mode 100644 scripts/dev/generate-phpt/src/setup/exceptions/gtMissingOptionsException.php delete mode 100644 scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownOptionException.php delete mode 100644 scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownSectionException.php delete mode 100644 scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php delete mode 100644 scripts/dev/generate-phpt/src/setup/gtOptionalSections.php delete mode 100644 scripts/dev/generate-phpt/src/setup/gtPreCondition.php delete mode 100644 scripts/dev/generate-phpt/src/setup/gtPreConditionList.php delete mode 100644 scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php delete mode 100644 scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php delete mode 100644 scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php delete mode 100644 scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidClass.php delete mode 100644 scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidFunction.php delete mode 100644 scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidMethod.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtTestCase.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtVariationTestCase.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php delete mode 100644 scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseMethod.php delete mode 100644 scripts/dev/generate-phpt/src/texts/functionOrMethodNotSpecified.txt delete mode 100644 scripts/dev/generate-phpt/src/texts/help.txt delete mode 100644 scripts/dev/generate-phpt/src/texts/methodNotSpecified.txt delete mode 100644 scripts/dev/generate-phpt/src/texts/testTypeNotSpecified.txt delete mode 100644 scripts/dev/generate-phpt/src/texts/unknownClass.txt delete mode 100644 scripts/dev/generate-phpt/src/texts/unknownFunction.txt delete mode 100644 scripts/dev/generate-phpt/src/texts/unknownMethod.txt delete mode 100644 scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtFunctionTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtIfClassHasMethodTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtIsValidClassTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtMethodTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php delete mode 100644 scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php diff --git a/scripts/dev/generate-phpt/build.xml b/scripts/dev/generate-phpt/build.xml deleted file mode 100755 index c01954bda9..0000000000 --- a/scripts/dev/generate-phpt/build.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/scripts/dev/generate-phpt/gtPackage.php b/scripts/dev/generate-phpt/gtPackage.php deleted file mode 100644 index 566899d8de..0000000000 --- a/scripts/dev/generate-phpt/gtPackage.php +++ /dev/null @@ -1,30 +0,0 @@ -' at the command line. - */ - -if (Phar::canWrite()) { - echo "Writing phar archive\n"; -} else { - echo "Unable to write archive, check that phar.readonly is 0 in your php.ini\n"; - exit(); -} -$thisDir = dirname(__FILE__); -$pharPath = substr($thisDir, 0, -strlen('/generate-phpt')); - -$phar = new Phar($pharPath.'/generate-phpt.phar'); - -$phar->buildFromDirectory($thisDir.'/src'); - -$stub = <<setStub($stub); - -?> diff --git a/scripts/dev/generate-phpt/src/codeSnippets/array.txt b/scripts/dev/generate-phpt/src/codeSnippets/array.txt deleted file mode 100644 index 69a4af72c1..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/array.txt +++ /dev/null @@ -1,9 +0,0 @@ -$index_array = array(1, 2, 3); -$assoc_array = array(1 => 'one', 2 => 'two'); - -$variation_array = array( - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - ); \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/boolean.txt b/scripts/dev/generate-phpt/src/codeSnippets/boolean.txt deleted file mode 100644 index 53db40d30b..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/boolean.txt +++ /dev/null @@ -1,6 +0,0 @@ -$variation_array = array( - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - ); \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/commentEnd.txt b/scripts/dev/generate-phpt/src/codeSnippets/commentEnd.txt deleted file mode 100644 index d116022fb8..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/commentEnd.txt +++ /dev/null @@ -1,2 +0,0 @@ - * - */ \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/commentStart.txt b/scripts/dev/generate-phpt/src/codeSnippets/commentStart.txt deleted file mode 100644 index e3466d5a1a..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/commentStart.txt +++ /dev/null @@ -1,2 +0,0 @@ -/** - * \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt b/scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt deleted file mode 100644 index 7e28494f5b..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt +++ /dev/null @@ -1,11 +0,0 @@ -$unset_var = 10; -unset($unset_var); - -$variation_array = array( - 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, - 'empty string DQ' => "", - 'empty string SQ' => '', - 'uppercase NULL' => NULL, - 'lowercase null' => null, - ); \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/float.txt b/scripts/dev/generate-phpt/src/codeSnippets/float.txt deleted file mode 100644 index 75c2b6cd52..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/float.txt +++ /dev/null @@ -1,7 +0,0 @@ -$variation_array = array( - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - ); \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/int.txt b/scripts/dev/generate-phpt/src/codeSnippets/int.txt deleted file mode 100644 index cdd28ae435..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/int.txt +++ /dev/null @@ -1,6 +0,0 @@ -$variation_array = array ( - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - ); \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/loopClose.txt b/scripts/dev/generate-phpt/src/codeSnippets/loopClose.txt deleted file mode 100644 index ff30235f07..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/loopClose.txt +++ /dev/null @@ -1 +0,0 @@ -} \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/loopStart.txt b/scripts/dev/generate-phpt/src/codeSnippets/loopStart.txt deleted file mode 100644 index 8fd5eb20fd..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/loopStart.txt +++ /dev/null @@ -1 +0,0 @@ -foreach ( $variation_array as $var ) { \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/object.txt b/scripts/dev/generate-phpt/src/codeSnippets/object.txt deleted file mode 100644 index 28ee61bfae..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/object.txt +++ /dev/null @@ -1,25 +0,0 @@ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - - - -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -$variation_array = array( - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - ); \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/codeSnippets/skipif64b.txt b/scripts/dev/generate-phpt/src/codeSnippets/skipif64b.txt deleted file mode 100644 index f05e9808d8..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/skipif64b.txt +++ /dev/null @@ -1 +0,0 @@ -if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); diff --git a/scripts/dev/generate-phpt/src/codeSnippets/skipifnot64b.txt b/scripts/dev/generate-phpt/src/codeSnippets/skipifnot64b.txt deleted file mode 100644 index e44071a6a2..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/skipifnot64b.txt +++ /dev/null @@ -1 +0,0 @@ -if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); diff --git a/scripts/dev/generate-phpt/src/codeSnippets/skipifnotwin.txt b/scripts/dev/generate-phpt/src/codeSnippets/skipifnotwin.txt deleted file mode 100644 index 75ea3e1ef2..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/skipifnotwin.txt +++ /dev/null @@ -1 +0,0 @@ -if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only"); diff --git a/scripts/dev/generate-phpt/src/codeSnippets/skipifwin.txt b/scripts/dev/generate-phpt/src/codeSnippets/skipifwin.txt deleted file mode 100644 index f712116527..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/skipifwin.txt +++ /dev/null @@ -1 +0,0 @@ -if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test is not for Windows platforms"); diff --git a/scripts/dev/generate-phpt/src/codeSnippets/string.txt b/scripts/dev/generate-phpt/src/codeSnippets/string.txt deleted file mode 100644 index a1d42376da..0000000000 --- a/scripts/dev/generate-phpt/src/codeSnippets/string.txt +++ /dev/null @@ -1,10 +0,0 @@ -$heredoc = << "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - ); \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/generate-phpt.php b/scripts/dev/generate-phpt/src/generate-phpt.php deleted file mode 100644 index 4f57a70b54..0000000000 --- a/scripts/dev/generate-phpt/src/generate-phpt.php +++ /dev/null @@ -1,115 +0,0 @@ -parse($argv); -} catch (exception $e) { - echo $e->getMessage()."\n"; - die(); -} - -if($options->hasOption('h')) { - die(gtText::get('help')); -} - -try { - $preConditions = new gtPreConditionList(); - $preConditions->check($options); -} catch (exception $e) { - echo $e->getMessage()."\n"; - die(); -} - -if($options->hasOption('s')) { - $optionalSections->setOptions($options); -} - - - -if($options->hasOption('c')) { - $name = $options->getOption('c')."_".$options->getOption('m'); - $method = new gtMethod($options->getOption('c'), $options->getOption('m')); - - $method->setArgumentNames(); - $method->setArgumentLists(); - $method->setInitialisationStatements(); - - $method->setConstructorArgumentNames(); - $method->setConstructorInitStatements(); - $method->setConstructorArgumentList(); -} - -if($options->hasOption('f')) { - $name = $options->getOption('f'); - $function = new gtFunction($name); - $function->setArgumentNames(); - $function->setArgumentLists(); - $function->setInitialisationStatements(); -} - - -if($options->hasOption('b')) { - if($options->hasOption('c')) { - $testCase = gtBasicTestCase::getInstance($optionalSections, 'method'); - $testCase->setMethod($method); - } else { - $testCase = gtBasicTestCase::getInstance($optionalSections); - $testCase->setFunction($function); - } - - $testCase->constructTestCase(); - gtTestCaseWriter::write($name, $testCase->toString(), 'b'); -} - -if($options->hasOption('e')) { - if($options->hasOption('c')) { - $testCase = gtErrorTestCase::getInstance($optionalSections, 'method'); - $testCase->setMethod($method); - } else { - $testCase = gtErrorTestCase::getInstance($optionalSections); - $testCase->setFunction($function); - } - - $testCase->constructTestCase(); - gtTestCaseWriter::write($name, $testCase->toString(), 'e'); -} - - - -if($options->hasOption('v')) { - if($options->hasOption('c')) { - $testCaseContainer = gtVariationContainer::getInstance($optionalSections, 'method'); - $testCaseContainer->setMethod($method); - } else { - $testCaseContainer = gtVariationContainer::getInstance ($optionalSections); - $testCaseContainer->setFunction($function); - } - - $testCaseContainer->constructAll(); - - $tests = $testCaseContainer->getVariationTests(); - - $count = 1; - foreach($tests as $test) { - gtTestCaseWriter::write($name, $test, 'v', $count); - $count++; - } - -} -?> diff --git a/scripts/dev/generate-phpt/src/gtAutoload.php b/scripts/dev/generate-phpt/src/gtAutoload.php deleted file mode 100644 index 8c18c179eb..0000000000 --- a/scripts/dev/generate-phpt/src/gtAutoload.php +++ /dev/null @@ -1,63 +0,0 @@ - \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/gtClassMap.php b/scripts/dev/generate-phpt/src/gtClassMap.php deleted file mode 100644 index 3e45b4764d..0000000000 --- a/scripts/dev/generate-phpt/src/gtClassMap.php +++ /dev/null @@ -1,48 +0,0 @@ - 'gtCodeSnippet.php', - 'gtTestSubject' => 'gtTestSubject.php', - 'gtFunction' => 'gtFunction.php', - 'gtMethod' => 'gtMethod.php', - 'gtTestCaseWriter' => 'gtTestCaseWriter.php', - 'gtText' => 'gtText.php', - - - - 'gtCommandLineOptions' => 'setup/gtCommandLineOptions.php', - 'gtOptionalSections' => 'setup/gtOptionalSections.php', - 'gtMissingArgumentException' => 'setup/exceptions/gtMissingArgumentException.php', - 'gtUnknownOptionException' => 'setup/exceptions/gtUnknownOptionException.php', - 'gtUnknownSectionException' => 'setup/exceptions/gtUnknownSectionException.php', - 'gtMissingOptionsException' => 'setup/exceptions/gtMissingOptionsException.php', - - 'gtPreCondition' => 'setup/gtPreCondition.php', - 'gtPreConditionList' => 'setup/gtPreConditionList.php', - 'gtIsSpecifiedTestType' => 'setup/preconditions/gtIsSpecifiedTestType.php', - 'gtIfClassHasMethod' => 'setup/preconditions/gtIfClassHasMethod.php', - 'gtIsSpecifiedFunctionOrMethod' => 'setup/preconditions/gtIsSpecifiedFunctionOrMethod.php', - 'gtIsValidClass' => 'setup/preconditions/gtIsValidClass.php', - 'gtIsValidMethod' => 'setup/preconditions/gtIsValidMethod.php', - 'gtIsValidFunction' => 'setup/preconditions/gtIsValidFunction.php', - - - 'gtTestCase' => 'testcase/gtTestCase.php', - 'gtVariationTestCase' => 'testcase/gtVariationTestCase.php', - 'gtVariationTestCaseFunction' => 'testcase/gtVariationTestCaseFunction.php', - 'gtVariationTestCaseMethod' => 'testcase/gtVariationTestCaseMethod.php', - - 'gtBasicTestCase' => 'testcase/gtBasicTestCase.php', - 'gtBasicTestCaseFunction' => 'testcase/gtBasicTestCaseFunction.php', - 'gtBasicTestCaseMethod' => 'testcase/gtBasicTestCaseMethod.php', - - 'gtErrorTestCase' => 'testcase/gtErrorTestCase.php', - 'gtErrorTestCaseFunction' => 'testcase/gtErrorTestCaseFunction.php', - 'gtErrorTestCaseMethod' => 'testcase/gtErrorTestCaseMethod.php', - - 'gtVariationContainer' => 'testcase/gtVariationContainer.php', - 'gtVariationContainerMethod' => 'testcase/gtVariationContainerMethod.php', - 'gtVariationContainerFunction' => 'testcase/gtVariationContainerFunction.php', - ); -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/gtCodeSnippet.php b/scripts/dev/generate-phpt/src/gtCodeSnippet.php deleted file mode 100644 index 220fbdf699..0000000000 --- a/scripts/dev/generate-phpt/src/gtCodeSnippet.php +++ /dev/null @@ -1,72 +0,0 @@ - \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/gtFunction.php b/scripts/dev/generate-phpt/src/gtFunction.php deleted file mode 100644 index 47f4bafcb3..0000000000 --- a/scripts/dev/generate-phpt/src/gtFunction.php +++ /dev/null @@ -1,48 +0,0 @@ -functionName = $functionName; - } - - - /** - * Get the names of function arguments and initialise mandatory and optional argument arrays - * - */ - public function setArgumentNames() { - $function= new ReflectionFunction($this->functionName); - - foreach ($function->getParameters() as $i => $param) { - if($param->isOptional()) { - $this->optionalArgumentNames[] = $param->getName(); - } else { - $this->mandatoryArgumentNames[] = $param->getName(); - } - } - } - - - /** - * Return the name of the function - * - * @return string - */ - public function getName() { - return $this->functionName; - } - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/gtMethod.php b/scripts/dev/generate-phpt/src/gtMethod.php deleted file mode 100644 index 820d7e0a76..0000000000 --- a/scripts/dev/generate-phpt/src/gtMethod.php +++ /dev/null @@ -1,139 +0,0 @@ -className = $className; - $this->methodName = $methodName; - } - - - /** - * Set the names of the class constructor arguments. Take only mandatory argument names. - * - */ - public function setConstructorArgumentNames() { - $reflectionClass = new ReflectionClass($this->className); - $constructor = $reflectionClass->getConstructor(); - foreach($constructor->getParameters() as $i => $param) { - //if(!$param->isOptional()) { - $this->constructorArgumentNames[] = $param->getName(); - //} - } - } - - - /** - * Set the names of the mandatory and optional arguments to the method - * - */ - public function setArgumentNames() { - - $methodClass = new reflectionMethod($this->className, $this->methodName); - $parameters = $methodClass->getParameters(); - - foreach ($methodClass->getParameters() as $i => $param) { - if($param->isOptional()) { - $this->optionalArgumentNames[] = $param->getName(); - } else { - $this->mandatoryArgumentNames[] = $param->getName(); - } - - } - } - - - /** - * Return the list of constructor argument names - * - * @return array - */ - public function getConstructorArgumentNames() { - return $this->constructorArgumentNames; - } - - /** - * Return the name of the method - * - * @return string - */ - public function getName() { - return $this->methodName; - } - - - /** - * Return the name of the class - * - * @return string - */ - public function getClassName() { - return $this->className; - } - - /** - * Set the list of arguments to be passed to the constructor - * - */ - public function setConstructorArgumentList() { - if(count ($this->constructorArgumentNames) > 0) { - - for( $i = 0; $i < count( $this->constructorArgumentNames ); $i++) { - $this->constructorArgumentList .= "\$".$this->constructorArgumentNames[$i].", "; - } - $this->constructorArgumentList = substr($this->constructorArgumentList, 0, -2); - } - } - - - /** - * Return the list of the arguments to be passed to the constructor - * - * @return string - */ - public function getConstructorArgumentList() { - return $this->constructorArgumentList; - } - - - /** - * Set up the source statements that initialise constructor arguments; - * - */ - public function setConstructorInitStatements() { - if(count ($this->constructorArgumentNames) > 0) { - foreach( $this->constructorArgumentNames as $name) { - $this->constructorInitialisationStatements[] = "\$".$name." = "; - } - } - - } - - - /** - * Return the constructor initialisation statements - * - * @return array - */ - public function getConstructorInitStatements() { - return $this->constructorInitialisationStatements; - } -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/gtTestCaseWriter.php b/scripts/dev/generate-phpt/src/gtTestCaseWriter.php deleted file mode 100644 index cc57863d9b..0000000000 --- a/scripts/dev/generate-phpt/src/gtTestCaseWriter.php +++ /dev/null @@ -1,27 +0,0 @@ - \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/gtTestSubject.php b/scripts/dev/generate-phpt/src/gtTestSubject.php deleted file mode 100644 index 76454dc7b8..0000000000 --- a/scripts/dev/generate-phpt/src/gtTestSubject.php +++ /dev/null @@ -1,166 +0,0 @@ -mandatoryArgumentNames; - } - - - /** - * Return the list of all optional argument names - * - * @return array - */ - public function getOptionalArgumentNames() { - return $this->optionalArgumentNames; - } - - public function setArgumentLists() { - $this->setValidArgumentLists(); - $this->setExtraArgumentList(); - $this->setShortArgumentList(); - } - - /** - * Set the argument list to call the subject with. Adds one extra argument. - * - */ - public function setExtraArgumentList() { - if(count ($this->mandatoryArgumentNames) > 0) { - for( $i = 0; $i < count( $this->mandatoryArgumentNames ); $i++) { - $this->extraArgumentList .= "\$".$this->mandatoryArgumentNames[$i].", "; - } - } - - if(count ($this->optionalArgumentNames) > 0) { - for( $i = 0; $i < count( $this->optionalArgumentNames ); $i++) { - $this->extraArgumentList .= "\$".$this->optionalArgumentNames[$i].", "; - } - } - - $this->extraArgumentList= $this->extraArgumentList. "\$extra_arg"; - } - - - /** - * Return the list of arguments as it appears in the function call - * - * @return string - list of arguments - */ - public function getExtraArgumentList() { - return $this->extraArgumentList; - } - - - /** - * Set the list of function arguments to be one less that the number of mandatory arguments - * - */ - public function setShortArgumentList() { - - if(count ($this->mandatoryArgumentNames) > 0) { - for( $i = 0; $i < count( $this->mandatoryArgumentNames ) - 1; $i++) { - $this->shortArgumentList .= "\$".$this->mandatoryArgumentNames[$i].", "; - } - $this->shortArgumentList = substr($this->shortArgumentList, 0, -2); - } - } - - - /** - * Return the short list of arguments - * - * @return string - list of arguments - */ - public function getShortArgumentList() { - return $this->shortArgumentList; - } - - - /** - * Construct the list of all possible ways to call the subject (function or method) - * - */ - public function setValidArgumentLists() { - $this->allowedArgumentLists[0] = ''; - if(count ($this->mandatoryArgumentNames) > 0) { - for( $i = 0; $i < count( $this->mandatoryArgumentNames ); $i++) { - $this->allowedArgumentLists[0] .= "\$".$this->mandatoryArgumentNames[$i].", "; - } - } - - if(count ($this->optionalArgumentNames) > 0) { - for( $i = 0; $i < count( $this->optionalArgumentNames ); $i++) { - $this->allowedArgumentLists[] = $this->allowedArgumentLists[$i]."\$".$this->optionalArgumentNames[$i].", "; - $this->allowedArgumentLists[$i] = substr ($this->allowedArgumentLists[$i], 0, -2); - } - } - - $this->allowedArgumentLists[count($this->allowedArgumentLists) -1 ] = substr($this->allowedArgumentLists[count($this->allowedArgumentLists) -1 ], 0, -2); - } - - - /** - * Return the array of all possible sets of method/function arguments - * - * @return unknown - */ - public function getValidArgumentLists() { - return $this->allowedArgumentLists; - } - - - /** - * Returns the argument list with the greatest possible number of arguments. - * - * @return string - */ - public function getMaximumArgumentList() { - return end($this->allowedArgumentLists); - } - - - /** - * Write initialisation statemenst for all the variables that might be used - * - */ - public function setInitialisationStatements() { - if(count ($this->mandatoryArgumentNames) > 0) { - foreach( $this->mandatoryArgumentNames as $name) { - $this->initialisationStatements[] = "\$".$name." = "; - } - } - if(count ($this->optionalArgumentNames) > 0) { - foreach( $this->optionalArgumentNames as $name) { - $this->initialisationStatements[] = "\$".$name." = "; - } - } - } - - /** - * Return the initialisation statements - * - * @return unknown - */ - public function getInitialisationStatements() { - return $this->initialisationStatements; - } -} -?> diff --git a/scripts/dev/generate-phpt/src/gtText.php b/scripts/dev/generate-phpt/src/gtText.php deleted file mode 100644 index 8cbd1650d4..0000000000 --- a/scripts/dev/generate-phpt/src/gtText.php +++ /dev/null @@ -1,27 +0,0 @@ - \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/setup/exceptions/gtMissingArgumentException.php b/scripts/dev/generate-phpt/src/setup/exceptions/gtMissingArgumentException.php deleted file mode 100644 index 91638e5ade..0000000000 --- a/scripts/dev/generate-phpt/src/setup/exceptions/gtMissingArgumentException.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/scripts/dev/generate-phpt/src/setup/exceptions/gtMissingOptionsException.php b/scripts/dev/generate-phpt/src/setup/exceptions/gtMissingOptionsException.php deleted file mode 100644 index 5bff5e01a0..0000000000 --- a/scripts/dev/generate-phpt/src/setup/exceptions/gtMissingOptionsException.php +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownOptionException.php b/scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownOptionException.php deleted file mode 100644 index 9b1a820985..0000000000 --- a/scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownOptionException.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownSectionException.php b/scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownSectionException.php deleted file mode 100644 index c4843240d7..0000000000 --- a/scripts/dev/generate-phpt/src/setup/exceptions/gtUnknownSectionException.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php b/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php deleted file mode 100644 index 0e4d878bab..0000000000 --- a/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php +++ /dev/null @@ -1,98 +0,0 @@ -isShortOption($argv[$i])) { - $option = substr($argv[$i], 1); - } else { - throw new gtUnknownOptionException('Unrecognised command line option ' . $argv[$i]); - } - - if (!in_array($option, array_merge($this->shortOptions, $this->shortOptionsWithArgs))) - { - throw new gtUnknownOptionException('Unknown option ' . $argv[$i]); - } - - if (in_array($option, $this->shortOptions)) { - $this->options[$option] = true; - continue; - } - - if (!$this->isValidOptionArg($argv, $i + 1)) - { - throw new gtMissingArgumentException('Missing argument for command line option ' . $argv[$i]); - } - - $i++; - $this->options[$option] = $argv[$i]; - } - } - - /** - * - */ - public function getOption($option) - { - if (!isset($this->options[$option])) { - return false; - } - return $this->options[$option]; - } - - - /** - * Check whether an option exists - */ - public function hasOption($option) - { - return isset($this->options[$option]); - } - - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/setup/gtOptionalSections.php b/scripts/dev/generate-phpt/src/setup/gtOptionalSections.php deleted file mode 100644 index 17409bc455..0000000000 --- a/scripts/dev/generate-phpt/src/setup/gtOptionalSections.php +++ /dev/null @@ -1,79 +0,0 @@ - false, - 'ini' => false, - 'clean' => false, - 'done' => false, - ); - - private $skipifKey = ''; - private $skipifExt = ''; - - - public function setOptions($commandLineOptions) { - if($commandLineOptions->hasOption('s')) { - $options = explode(':', $commandLineOptions->getOption('s')); - - foreach($options as $option) { - - if(array_key_exists($option, $this->optSections )) { - $this->optSections[$option] = true; - } else { - throw new gtUnknownSectionException('Unrecognised optional section'); - } - } - - if($commandLineOptions->hasOption('k')) { - $this->skipifKey = $commandLineOptions->getOption('k'); - } - - if($commandLineOptions->hasOption('x')) { - $this->skipifExt = $commandLineOptions->getOption('x'); - } - - } - } - - - - public function getOptions() { - return $this->optSections; - } - - - public function getSkipifKey() { - return $this->skipifKey; - } - - public function getSkipifExt() { - return $this->skipifExt; - } - - public function hasSkipif() { - return $this->optSections['skipif']; - } - - public function hasSkipifKey() { - return $this->skipifKey != ''; - } - - public function hasSkipifExt() { - return $this->skipifExt != ''; - } - public function hasIni() { - return $this->optSections['ini']; - } - - public function hasClean() { - return $this->optSections['clean']; - } - - public function hasDone() { - return $this->optSections['done']; - } - - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/setup/gtPreCondition.php b/scripts/dev/generate-phpt/src/setup/gtPreCondition.php deleted file mode 100644 index 858395bc9d..0000000000 --- a/scripts/dev/generate-phpt/src/setup/gtPreCondition.php +++ /dev/null @@ -1,14 +0,0 @@ - \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/setup/gtPreConditionList.php b/scripts/dev/generate-phpt/src/setup/gtPreConditionList.php deleted file mode 100644 index 06c17521f2..0000000000 --- a/scripts/dev/generate-phpt/src/setup/gtPreConditionList.php +++ /dev/null @@ -1,33 +0,0 @@ -preConditions as $preCon) { - $checkThis = new $preCon; - if(!$checkThis->check($clo)) { - echo $checkThis->getMessage(); - die(gtText::get('help')); - } - } - } -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php b/scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php deleted file mode 100644 index f4cb23a266..0000000000 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php +++ /dev/null @@ -1,18 +0,0 @@ -hasOption('c') || $clo->hasOption('m'); - } - - public function getMessage() { - return gtText::get('methodNotSpecified'); - } - -} -?> diff --git a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php b/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php deleted file mode 100644 index 0d2b6df7f5..0000000000 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php +++ /dev/null @@ -1,17 +0,0 @@ -hasOption('f') || $clo->hasOption('m'); - } - - public function getMessage() { - return gtText::get('functionOrMethodNotSpecified'); - } -} -?> diff --git a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php b/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php deleted file mode 100644 index 9069a604ea..0000000000 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php +++ /dev/null @@ -1,17 +0,0 @@ -hasOption('b') || $clo->hasOption('e') || $clo->hasOption('v'); - } - - public function getMessage() { - return gtText::get('testTypeNotSpecified'); - } -} -?> diff --git a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidClass.php b/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidClass.php deleted file mode 100644 index 363fdc9594..0000000000 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidClass.php +++ /dev/null @@ -1,21 +0,0 @@ -hasOption('c') ) { - $className = $clo->getOption('c'); - return in_array( $className, get_declared_classes() ); - } - return true; - } - - public function getMessage() { - return gtText::get('unknownClass'); - } -} -?> diff --git a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidFunction.php b/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidFunction.php deleted file mode 100644 index 9d7f2a5b75..0000000000 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidFunction.php +++ /dev/null @@ -1,22 +0,0 @@ -hasOption('f') ) { - $function = $clo->getOption('f'); - $functions = get_defined_functions(); - return in_array( $function, $functions['internal'] ); - } - return true; - } - - public function getMessage() { - return gtText::get('unknownFunction'); - } -} -?> diff --git a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidMethod.php b/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidMethod.php deleted file mode 100644 index a52988aa6d..0000000000 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidMethod.php +++ /dev/null @@ -1,28 +0,0 @@ -hasOption('m') ) { - $className = $clo->getOption('c'); - $class = new ReflectionClass($className); - $methods = $class->getMethods(); - foreach($methods as $method) { - if($clo->getOption('m') == $method->getName()) { - return true; - } - } - return false; - } - return true; - } - - public function getMessage() { - return gtText::get('unknownMethod'); - } -} -?> diff --git a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php deleted file mode 100644 index 684c24dd7e..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php +++ /dev/null @@ -1,37 +0,0 @@ -argInit(); - $this->subjectCalls(); - } - - public function addBasicEcho() { - $this->testCase[] = "echo \"*** Test by calling method or function with its expected arguments ***\\n\";"; - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - } -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php deleted file mode 100644 index f64c6daf32..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php +++ /dev/null @@ -1,62 +0,0 @@ -optionalSections = $opt; - } - - /** - * Set the function name - * - * @param gtFunction $function - */ - public function setFunction($function) { - $this->subject = $function; - } - - public function constructTestCase() { - $this->constructCommonHeaders(); - - $this->addBasicEcho(); - - $this->constructSubjectCalls(); - - $this->constructCommonClosing(); - - } - - - /** - * Construct test case header - * - */ - public function testHeader() { - //Opening section and start of test case array. - $this->testCase[] = "--TEST--"; - $this->testCase[] = "Test function ".$this->subject->getName()."() by calling it with its expected arguments"; - } - - /** - * Add the test section to call the function - * - */ - public function subjectCalls() { - // Construct the argument list to pass to the function being tested - $lists = $this->subject->getValidArgumentLists(); - - foreach($lists as $list){ - - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - $this->testCase[] = "var_dump(".$this->subject->getName()."( ".$list." ) );"; - } - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php deleted file mode 100644 index 3d3896e233..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php +++ /dev/null @@ -1,52 +0,0 @@ -optionalSections = $opt; - } - - /** - * Set the method - * - * @param gtMethod $method - */ - public function setMethod($method) { - $this->subject = $method; - } - -public function constructTestCase() { - $this->constructCommonHeaders(); - - $this->addBasicEcho(); - - $this->constructorArgInit(); - $this->constructorCreateInstance(); - - $this->constructSubjectCalls(); - - $this->constructCommonClosing(); - - } - - public function testHeader() { - $this->testCase[] = "--TEST--"; - $this->testCase[] = "Test class ".$this->subject->getClassName()." method ".$this->subject->getName()."() by calling it with its expected arguments"; - - } - - public function subjectCalls() { - $lists = $this->subject->getValidArgumentLists(); - - foreach($lists as $list){ - $this->testCase[] = "var_dump( \$class->".$this->subject->getName()."( ".$list." ) );"; - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - } - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php deleted file mode 100644 index 214e3d28ba..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php +++ /dev/null @@ -1,53 +0,0 @@ -shortArgumentList; - } - - public function getLongArgumentList() { - return $this->longArgumentList; - } - - public function constructSubjectCalls() { - $this->argInit(); - - //Initialise the additional argument - $this->testCase[] = "\$extra_arg = "; - - $this->subjectCalls(); - } - - public function addErrorEcho() { - $this->testCase[] = "echo \"*** Test by calling method or function with incorrect numbers of arguments ***\\n\";"; - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - } -} - -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php deleted file mode 100644 index 2453acf6fd..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php +++ /dev/null @@ -1,57 +0,0 @@ -optionalSections = $opt; - } - - /** - * Set the function name - * - * @param string $function - */ - public function setFunction($function) { - $this->subject = $function; - } - - - /** - * Construct the test case as an array of strings - * - */ - public function constructTestCase() { - $this->constructCommonHeaders(); - - $this->addErrorEcho(); - - $this->constructSubjectCalls(); - - $this->constructCommonClosing(); - - } - - - public function testHeader() { - $this->testCase[] = "--TEST--"; - $this->testCase[] = "Test function ".$this->subject->getName()."() by calling it more than or less than its expected arguments"; - } - - public function subjectCalls() { - // Construct the argument lists to pass to the function being tested - $list = $this->subject->getExtraArgumentList(); - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - $this->testCase[] = "var_dump(".$this->subject->getName()."( ".$list." ) );"; - - $list = $this->subject->getShortArgumentList(); - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - $this->testCase[] = "var_dump(".$this->subject->getName()."( ".$list." ) );"; - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php deleted file mode 100644 index 647e52f93e..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php +++ /dev/null @@ -1,59 +0,0 @@ -optionalSections = $opt; - } - private $method; - - /** - * Set the method name - * - * @param string $method - */ - public function setMethod($method) { - $this->subject = $method; - } - - - /** - * Construct the test case as an array of strings - * - */ - public function constructTestCase() { - $this->constructCommonHeaders(); - - $this->addErrorEcho(); - - $this->constructorArgInit(); - $this->constructorCreateInstance(); - - $this->constructSubjectCalls(); - - $this->constructCommonClosing(); - } - - public function testHeader() { - $this->testCase[] = "--TEST--"; - $this->testCase[] = "Test class ".$this->subject->getClassName()." method ".$this->subject->getName()."() by calling it more than or less than its expected arguments"; - } - - public function subjectCalls() { - - // Construct the argument list to pass to the method being tested - $list = $this->subject->getExtraArgumentList(); - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - $this->testCase[] = "var_dump(".$this->subject->getName()."( ".$list." ) );"; - - $list = $this->subject->getShortArgumentList(); - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - $this->testCase[] = "var_dump(".$this->subject->getName()."( ".$list." ) );"; - - } -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtTestCase.php b/scripts/dev/generate-phpt/src/testcase/gtTestCase.php deleted file mode 100644 index 60c115a9c1..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtTestCase.php +++ /dev/null @@ -1,230 +0,0 @@ -testCase as $line) { - $testCaseString .= $line."\n"; - } - return $testCaseString; - } - - - - /** - * Returns test case as a array - * - * @return array - */ - public function getTestCase() { - return $this->testCase; - } - - - /** - * Construct the common headers (title, file section..) of the test case - * - */ - public function ConstructCommonHeaders() { - $this->testHeader(); - - if($this->optionalSections->hasSkipif()) { - $this->addSkipif(); - } - - if($this->optionalSections->hasIni()) { - $this->addIni(); - } - - $this->fileOpening(); - } - - - /** - * Construct the common closing statements (clean, done, EXPECTF...) - * - */ - public function ConstructCommonClosing() { - $this->fileClosing(); - - if ($this->optionalSections->hasDone()) { - $this->addDone(); - } - - if ($this->optionalSections->hasClean()) { - $this->addClean(); - } - - $this->addExpectf(); - } - - /** - * Start the FILE section of the test - * - */ - public function fileOpening() { - $this->testCase[] = "--FILE--"; - $this->testCase[] = "testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - - - /** - * Add constructor argument initialisation to test case - * - */ - public function constructorArgInit() { - $conStatements = $this->subject->getConstructorInitStatements(); - foreach($conStatements as $statement) { - $this->testCase[] = $statement; - } - } - - - /** - * Create instance of class in the test case - * - */ - public function constructorCreateInstance() { - $constructorList = $this->subject->getConstructorArgumentList(); - $this->testCase[] = "\$class = new ".$this->subject->getClassName()."( ".$constructorList." );"; - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - - - /** - * Add function or method initilaisation statements to the test case - * - */ - public function argInit() { - $statements = $this->subject->getInitialisationStatements(); - foreach($statements as $statement) { - $this->testCase[] = $statement; - } - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - - - /** - * Add FILE section closing tag to the test case - * - */ - public function fileClosing() { - $this->testCase[] = "?>"; - } - - - /** - * Add a skipif section to the test case - * - */ - public function addSkipif() { - $this->testCase[] = "--SKIPIF--"; - $this->testCase[] = "optionalSections->hasSkipifKey()) { - $key = $this->optionalSections->getSkipifKey(); - //test standard skipif sections - if($key == 'win') { - $this->testCase = gtCodeSnippet::append('skipifwin', $this->testCase); - } - if($key == 'notwin' ) { - $this->testCase = gtCodeSnippet::append('skipifnotwin', $this->testCase); - } - - if($key == '64b' ) { - $this->testCase = gtCodeSnippet::append('skipif64b', $this->testCase); - } - - if($key == 'not64b' ) { - $this->testCase = gtCodeSnippet::append('skipifnot64b', $this->testCase); - } - } - - if($this->optionalSections->hasSkipifExt()) { - $ext = $this->optionalSections->getSkipifExt(); - $this->testCase[] = "if (!extension_loaded('$ext')) die ('skip $ext extension not available in this build');"; - } - $this->testCase[] = "?>"; - } - - - /** - * Add an INI section to the test case - * - */ - public function addIni() { - $this->testCase[] = "--INI--"; - $this->testCase[] = ""; - } - - - /** - * Add a clean section to the test case - * - */ - public function addClean() { - $this->testCase[] = "--CLEAN--"; - $this->testCase[] = "testCase[] = "?>"; - } - - - /** - * Add a ===DONE=== statement to the test case - * - */ - public function addDone() { - $this->testCase[] = "===DONE==="; - } - - - /** - * Add an EXPECTF section - * - */ - public function addExpectf() { - $this->testCase[] = "--EXPECTF--"; - if ($this->optionalSections->hasDone() ){ - $this->testCase[] = '===DONE==='; - } - } - - public function getOpt() { - return $this->optionalSections; - } -} -?> diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php b/scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php deleted file mode 100644 index 59951707ce..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php +++ /dev/null @@ -1,54 +0,0 @@ -variationTests; - } - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php b/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php deleted file mode 100644 index a62882a81a..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php +++ /dev/null @@ -1,43 +0,0 @@ -optionalSections = $osl; - } - - /** - * Sets function being tested - * - * @param gtFunction $function - */ - public function setFunction(gtFunction $function) { - $this->function = $function; - } - - - /** - * constructs all possible variation testcases in array $this->variationTests - * - */ - public function constructAll() { - - - $numberOfArguments = count($this->function->getMandatoryArgumentNames()) + count($this->function->getOptionalArgumentNames()); - for($i = 1; $i <= $numberOfArguments; $i++) { - foreach ($this->dataTypes as $d) { - $testCase = gtVariationTestCase::getInstance($this->optionalSections); - $testCase->setUp($this->function, $i, $d); - $testCase->constructTestCase(); - $this->variationTests[] = $testCase->toString(); - } - } - } -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php b/scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php deleted file mode 100644 index bee26b08aa..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php +++ /dev/null @@ -1,46 +0,0 @@ -optionalSections = $osl; - } - - - /** - * Sets the method to be tested - * - * @param gtMethod $method - */ - public function setMethod(gtMethod $method) { - $this->method = $method; - } - - - /** - * Constructs all variation tests in $this_variationTests - * - */ - public function constructAll() { - - $numberOfArguments = count($this->method->getMandatoryArgumentNames()) + count($this->method->getOptionalArgumentNames()); - - for($i = 1; $i <= $numberOfArguments; $i++) { - - foreach ($this->dataTypes as $d) { - - $testCase = gtVariationTestCase::getInstance($this->optionalSections, 'method'); - $testCase->setUp($this->method, $i, $d); - $testCase->constructTestCase(); - $this->variationTests[] = $testCase->toString(); - - } - } - } -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCase.php b/scripts/dev/generate-phpt/src/testcase/gtVariationTestCase.php deleted file mode 100644 index 039367d5b3..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCase.php +++ /dev/null @@ -1,55 +0,0 @@ - -subject->getInitialisationStatements(); - for($i=0; $iargumentNumber -1) ) { - $this->testCase[] = $statements[$i]; - } - } - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - - public function addVariationCode() { - $this->testCase = gtCodeSnippet::append($this->variationData, $this->testCase); - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); - } - - public function constructSubjectCalls() { - $this->argInitVariation(); - $this->addVariationCode(); - $this->subjectCalls(); - } - - public function addVariationEcho() { - $this->testCase[] = "echo \"*** Test substituting argument ".$this->argumentNumber." with ".$this->variationData." values ***\\n\";"; - $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); - } - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php b/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php deleted file mode 100644 index 7bf1c8b778..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php +++ /dev/null @@ -1,64 +0,0 @@ -optionalSections = $opt; - } - /** - * Set data neede to construct variation tests - * - * @param gtfunction $function - * @param string $argumentNumber - * @param string $variationData - */ - public function setUp(gtfunction $function, $argumentNumber, $variationData) { - $this->subject = $function; - $this->argumentNumber = $argumentNumber; - $this->variationData = $variationData; - - } - - - /** - * Constructs the test case as a array of strings - * - */ - public function constructTestCase() { - $this->constructCommonHeaders(); - - $this->addVariationEcho(); - - $this->constructSubjectCalls(); - - $this->constructCommonClosing(); - - } - public function testHeader() { - $this->testCase[] = "--TEST--"; - $this->testCase[] = "Test function ".$this->subject->getName()."() by substituting argument ".$this->argumentNumber." with ".$this->variationData." values."; - } - - - public function subjectCalls() { - $this->testCase = gtCodeSnippet::append('loopStart', $this->testCase); - - // Construct the argument list to pass to the function being tested - $argumentList = explode(",", $this->subject->getMaximumArgumentList()); - $argumentList[$this->argumentNumber -1 ] = "\$var "; - $list = implode(", ", $argumentList); - - - $this->testCase[] = " var_dump(".$this->subject->getName()."( ".$list." ) );"; - $this->testCase = gtCodeSnippet::append('loopClose', $this->testCase); - } - -} -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseMethod.php b/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseMethod.php deleted file mode 100644 index a9c921f9db..0000000000 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseMethod.php +++ /dev/null @@ -1,68 +0,0 @@ -optionalSections = $opt; - } - - /** - * Set data neede to construct variation tests - * - * @param gtMethod $method - * @param string $argumentNumber - * @param string $variationData - */ - public function setUp(gtMethod $method, $argumentNumber, $variationData) { - $this->subject = $method; - $this->argumentNumber = $argumentNumber; - $this->variationData = $variationData; - } - - - /** - * Constructs the test case as a array of strings - * - */ - public function constructTestCase() { - $this->constructCommonHeaders(); - - $this->addVariationEcho(); - - $this->constructorArgInit(); - $this->constructorCreateInstance(); - - $this->constructSubjectcalls(); - $this->constructCommonClosing(); - - } - - public function testHeader() { - $this->testCase[] = "--TEST--"; - $this->testCase[] = "Test class ".$this->subject->getClassName()." method ".$this->subject->getName()."() by substituting argument ".$this->argumentNumber." with ".$this->variationData." values."; - } - - public function subjectCalls() { - $this->testCase = gtCodeSnippet::append('loopStart', $this->testCase); - // Construct the argument list to pass to the method being tested - $argumentList = explode(",", $this->subject->getMaximumArgumentList()); - $argumentList[$this->argumentNumber -1 ] = "\$var "; - $list = implode(", ", $argumentList); - - - $this->testCase[] = " var_dump(\$class->".$this->subject->getName()."( ".$list." ) );"; - $this->testCase = gtCodeSnippet::append('loopClose', $this->testCase); - - } - -} - -?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/texts/functionOrMethodNotSpecified.txt b/scripts/dev/generate-phpt/src/texts/functionOrMethodNotSpecified.txt deleted file mode 100644 index b497682cb7..0000000000 --- a/scripts/dev/generate-phpt/src/texts/functionOrMethodNotSpecified.txt +++ /dev/null @@ -1,3 +0,0 @@ - -Please supply a function or method name to be tested. - diff --git a/scripts/dev/generate-phpt/src/texts/help.txt b/scripts/dev/generate-phpt/src/texts/help.txt deleted file mode 100644 index cfc3b626e5..0000000000 --- a/scripts/dev/generate-phpt/src/texts/help.txt +++ /dev/null @@ -1,14 +0,0 @@ -Usage: -php generate-phpt.php -f |-c -m -b|e|v [-s skipif:ini:clean:done] [-k win|notwin|64b|not64b] [-x ext] - -Where: --f function_name ................. Name of PHP function, eg cos --c class name .....................Name of class, eg DOMDocument --m method name ....................Name of method, eg createAttribute --b ............................... Generate basic tests --e ............................... Generate error tests --v ............................... Generate variation tests --s sections....................... Create optional sections, colon separated list --k skipif key..................... Skipif option, only used if -s skipif is used. --x extension.......................Skipif option, specify extension to check for --h ............................... Print this message diff --git a/scripts/dev/generate-phpt/src/texts/methodNotSpecified.txt b/scripts/dev/generate-phpt/src/texts/methodNotSpecified.txt deleted file mode 100644 index 1f11a3a1ba..0000000000 --- a/scripts/dev/generate-phpt/src/texts/methodNotSpecified.txt +++ /dev/null @@ -1,4 +0,0 @@ - -You have given a class name but not supplied a method name to test. -The method name is required. - diff --git a/scripts/dev/generate-phpt/src/texts/testTypeNotSpecified.txt b/scripts/dev/generate-phpt/src/texts/testTypeNotSpecified.txt deleted file mode 100644 index e83ddbb5c2..0000000000 --- a/scripts/dev/generate-phpt/src/texts/testTypeNotSpecified.txt +++ /dev/null @@ -1,3 +0,0 @@ - -Please specify basic, error or variation tests. - diff --git a/scripts/dev/generate-phpt/src/texts/unknownClass.txt b/scripts/dev/generate-phpt/src/texts/unknownClass.txt deleted file mode 100644 index b0a47ca8b9..0000000000 --- a/scripts/dev/generate-phpt/src/texts/unknownClass.txt +++ /dev/null @@ -1,4 +0,0 @@ - -The class name is not a valid PHP class name. -Check that the extension containing the class is loaded. - diff --git a/scripts/dev/generate-phpt/src/texts/unknownFunction.txt b/scripts/dev/generate-phpt/src/texts/unknownFunction.txt deleted file mode 100644 index 2e76978a52..0000000000 --- a/scripts/dev/generate-phpt/src/texts/unknownFunction.txt +++ /dev/null @@ -1,4 +0,0 @@ - -The function name is not a valid PHP function name. -Check that the extension containing the function is loaded. - diff --git a/scripts/dev/generate-phpt/src/texts/unknownMethod.txt b/scripts/dev/generate-phpt/src/texts/unknownMethod.txt deleted file mode 100644 index 8cc9eaeda6..0000000000 --- a/scripts/dev/generate-phpt/src/texts/unknownMethod.txt +++ /dev/null @@ -1,4 +0,0 @@ - -The method name is not a valid PHP method name. -Check that the extension containing the method is loaded. - diff --git a/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php b/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php deleted file mode 100644 index dbba0d6470..0000000000 --- a/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100644 index 81307f139c..0000000000 --- a/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100644 index bc0c48a5a1..0000000000 --- a/scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 2fd6818a45..0000000000 --- a/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php +++ /dev/null @@ -1,46 +0,0 @@ -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 deleted file mode 100644 index 5b72fcc9f5..0000000000 --- a/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100644 index 7077881296..0000000000 --- a/scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php +++ /dev/null @@ -1,30 +0,0 @@ -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 deleted file mode 100644 index 0aa7eac119..0000000000 --- a/scripts/dev/generate-phpt/tests/gtFunctionTest.php +++ /dev/null @@ -1,71 +0,0 @@ -cd -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 deleted file mode 100644 index b9f2410b5d..0000000000 --- a/scripts/dev/generate-phpt/tests/gtIfClassHasMethodTest.php +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index 064edf3b65..0000000000 --- a/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index c8b0a4e36a..0000000000 --- a/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php +++ /dev/null @@ -1,32 +0,0 @@ -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 deleted file mode 100644 index 51ca87879d..0000000000 --- a/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index d4700b9d66..0000000000 --- a/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index fe069977ef..0000000000 --- a/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index 430161ee1c..0000000000 --- a/scripts/dev/generate-phpt/tests/gtMethodTest.php +++ /dev/null @@ -1,82 +0,0 @@ -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 deleted file mode 100644 index dbf2994567..0000000000 --- a/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php +++ /dev/null @@ -1,58 +0,0 @@ -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 deleted file mode 100644 index df9f21c309..0000000000 --- a/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100644 index d99b6562d0..0000000000 --- a/scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php +++ /dev/null @@ -1,27 +0,0 @@ -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 -- 2.40.0