diff options
Diffstat (limited to 'scripts/dev/generate-phpt')
44 files changed, 204 insertions, 204 deletions
diff --git a/scripts/dev/generate-phpt/build.xml b/scripts/dev/generate-phpt/build.xml index c01954bda9..098dfcac83 100755 --- a/scripts/dev/generate-phpt/build.xml +++ b/scripts/dev/generate-phpt/build.xml @@ -3,7 +3,7 @@ <project name="generate" default="test" basedir="."> <property name="build.dir" value="_build" /> - + <target name="docs" description="Create API documentation."> <exec command="doxygen doxygen.conf" /> </target> diff --git a/scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt b/scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt index 7e28494f5b..a957781205 100644 --- a/scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt +++ b/scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt @@ -3,7 +3,7 @@ unset($unset_var); $variation_array = array( 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, + 'undefined var' => @$undefined_var, 'empty string DQ' => "", 'empty string SQ' => '', 'uppercase NULL' => NULL, diff --git a/scripts/dev/generate-phpt/src/generate-phpt.php b/scripts/dev/generate-phpt/src/generate-phpt.php index 4f57a70b54..73071e2846 100644 --- a/scripts/dev/generate-phpt/src/generate-phpt.php +++ b/scripts/dev/generate-phpt/src/generate-phpt.php @@ -39,17 +39,17 @@ try { 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(); diff --git a/scripts/dev/generate-phpt/src/gtClassMap.php b/scripts/dev/generate-phpt/src/gtClassMap.php index 3e45b4764d..1c346b83ce 100644 --- a/scripts/dev/generate-phpt/src/gtClassMap.php +++ b/scripts/dev/generate-phpt/src/gtClassMap.php @@ -1,23 +1,23 @@ <?php $gtClassMap = array( - + 'gtCodeSnippet' => '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', @@ -26,21 +26,21 @@ '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', diff --git a/scripts/dev/generate-phpt/src/gtCodeSnippet.php b/scripts/dev/generate-phpt/src/gtCodeSnippet.php index 220fbdf699..dc6543201a 100644 --- a/scripts/dev/generate-phpt/src/gtCodeSnippet.php +++ b/scripts/dev/generate-phpt/src/gtCodeSnippet.php @@ -2,7 +2,7 @@ /** * Retrieves code snippets for adding to test cases - * + * */ class gtCodeSnippet { @@ -14,21 +14,21 @@ class gtCodeSnippet * @return array */ public static function get($name) { - + $filename = dirname(__FILE__) . '/codeSnippets/' . $name . '.txt'; if (!file_exists($filename)) { throw new LogicException('The code snippet ' . $name . ' does not exist'); } - + $lines = file($filename); foreach($lines as $l) { $array[] = rtrim($l); } return $array; } - - + + /** * Append the code snippet on to an existing array * @@ -47,11 +47,11 @@ class gtCodeSnippet foreach ($text as $t) { $array[] = rtrim($t); } - + return $array; } - - + + /** * Appends blank entries on to an array * @@ -64,9 +64,9 @@ class gtCodeSnippet for ($i=0; $i< $numberOfLines; $i++) { $array[] = ""; } - + return $array; } - + } ?>
\ No newline at end of file diff --git a/scripts/dev/generate-phpt/src/gtFunction.php b/scripts/dev/generate-phpt/src/gtFunction.php index 47f4bafcb3..b2752ad637 100644 --- a/scripts/dev/generate-phpt/src/gtFunction.php +++ b/scripts/dev/generate-phpt/src/gtFunction.php @@ -7,7 +7,7 @@ class gtFunction extends gtTestSubject { private $functionName; - + /** * Set the name of the name of the function * diff --git a/scripts/dev/generate-phpt/src/gtMethod.php b/scripts/dev/generate-phpt/src/gtMethod.php index 820d7e0a76..dc8438c3b5 100644 --- a/scripts/dev/generate-phpt/src/gtMethod.php +++ b/scripts/dev/generate-phpt/src/gtMethod.php @@ -39,7 +39,7 @@ class gtMethod extends gtTestSubject { } } - + /** * Set the names of the mandatory and optional arguments to the method * @@ -87,14 +87,14 @@ class gtMethod extends gtTestSubject { 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].", "; } @@ -112,7 +112,7 @@ class gtMethod extends gtTestSubject { return $this->constructorArgumentList; } - + /** * Set up the source statements that initialise constructor arguments; * @@ -126,7 +126,7 @@ class gtMethod extends gtTestSubject { } - + /** * Return the constructor initialisation statements * diff --git a/scripts/dev/generate-phpt/src/gtTestCaseWriter.php b/scripts/dev/generate-phpt/src/gtTestCaseWriter.php index cc57863d9b..9438e0f2ea 100644 --- a/scripts/dev/generate-phpt/src/gtTestCaseWriter.php +++ b/scripts/dev/generate-phpt/src/gtTestCaseWriter.php @@ -5,20 +5,20 @@ * */ class gtTestCaseWriter { - + public static function write($name, $string, $type, $count = 0) { if ($type == 'b') { $fileName = $name."_basic.phpt"; } - + if ($type == 'e') { $fileName = $name."_error.phpt"; } - + if ($type == 'v') { $fileName = $name."_variation".$count.".phpt"; } - + $fh = fopen($fileName, 'w'); fwrite ($fh, $string); fclose($fh); diff --git a/scripts/dev/generate-phpt/src/gtTestSubject.php b/scripts/dev/generate-phpt/src/gtTestSubject.php index 76454dc7b8..782c99d6c7 100644 --- a/scripts/dev/generate-phpt/src/gtTestSubject.php +++ b/scripts/dev/generate-phpt/src/gtTestSubject.php @@ -10,7 +10,7 @@ abstract class gtTestSubject { protected $allowedArgumentLists; protected $maximumArgumentList; - + protected $initialisationStatements; @@ -31,7 +31,7 @@ abstract class gtTestSubject { public function getOptionalArgumentNames() { return $this->optionalArgumentNames; } - + public function setArgumentLists() { $this->setValidArgumentLists(); $this->setExtraArgumentList(); @@ -48,7 +48,7 @@ abstract class gtTestSubject { $this->extraArgumentList .= "\$".$this->mandatoryArgumentNames[$i].", "; } } - + if(count ($this->optionalArgumentNames) > 0) { for( $i = 0; $i < count( $this->optionalArgumentNames ); $i++) { $this->extraArgumentList .= "\$".$this->optionalArgumentNames[$i].", "; @@ -57,7 +57,7 @@ abstract class gtTestSubject { $this->extraArgumentList= $this->extraArgumentList. "\$extra_arg"; } - + /** * Return the list of arguments as it appears in the function call @@ -105,7 +105,7 @@ abstract class gtTestSubject { $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].", "; @@ -153,7 +153,7 @@ abstract class gtTestSubject { } } } - + /** * Return the initialisation statements * diff --git a/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php b/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php index 0e4d878bab..b1068e4600 100644 --- a/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php +++ b/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php @@ -22,7 +22,7 @@ class gtCommandLineOptions { 'x', 'k', ); - + protected $options; protected function isShortOption($arg) @@ -44,7 +44,7 @@ class gtCommandLineOptions { if(count($argv) < 2) { throw new gtMissingOptionsException('Command line options are required'); } - + for ($i=1; $i<count($argv); $i++) { if ($this->isShortOption($argv[$i])) { @@ -72,7 +72,7 @@ class gtCommandLineOptions { $this->options[$option] = $argv[$i]; } } - + /** * */ diff --git a/scripts/dev/generate-phpt/src/setup/gtOptionalSections.php b/scripts/dev/generate-phpt/src/setup/gtOptionalSections.php index 1d2a163175..6c6de18345 100644 --- a/scripts/dev/generate-phpt/src/setup/gtOptionalSections.php +++ b/scripts/dev/generate-phpt/src/setup/gtOptionalSections.php @@ -28,11 +28,11 @@ class gtOptionalSections { if($commandLineOptions->hasOption('k')) { $this->skipifKey = $commandLineOptions->getOption('k'); } - + if($commandLineOptions->hasOption('x')) { $this->skipifExt = $commandLineOptions->getOption('x'); } - + } } @@ -46,7 +46,7 @@ class gtOptionalSections { public function getSkipifKey() { return $this->skipifKey; } - + public function getSkipifExt() { return $this->skipifExt; } @@ -61,7 +61,7 @@ class gtOptionalSections { } return false; } - + public function hasSkipifExt() { if($this->skipifExt != '') { return true; @@ -75,7 +75,7 @@ class gtOptionalSections { public function hasClean() { return $this->optSections['clean']; } - + public function hasDone() { return $this->optSections['done']; } diff --git a/scripts/dev/generate-phpt/src/setup/gtPreCondition.php b/scripts/dev/generate-phpt/src/setup/gtPreCondition.php index 858395bc9d..294b41e9f2 100644 --- a/scripts/dev/generate-phpt/src/setup/gtPreCondition.php +++ b/scripts/dev/generate-phpt/src/setup/gtPreCondition.php @@ -5,10 +5,10 @@ * */ abstract class gtPreCondition { - - abstract public function check($clo); - - abstract public function getMessage(); - + + abstract public function check($clo); + + abstract public function getMessage(); + } ?>
\ 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 index 06c17521f2..88f9b36205 100644 --- a/scripts/dev/generate-phpt/src/setup/gtPreConditionList.php +++ b/scripts/dev/generate-phpt/src/setup/gtPreConditionList.php @@ -5,10 +5,10 @@ * */ class gtPreConditionList { - + private $preConditions = array( 'gtIsSpecifiedTestType', - 'gtIsSpecifiedFunctionOrMethod', + 'gtIsSpecifiedFunctionOrMethod', 'gtIfClassHasMethod', 'gtIsValidClass', 'gtIsValidFunction', diff --git a/scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php b/scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php index c91b210714..edd7a1cbae 100644 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php +++ b/scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php @@ -5,7 +5,7 @@ * */ class gtIfClassHasMethod extends gtPreCondition { - + public function check( $clo) { if($clo->hasOption('c')) { if(!$clo->hasOption('m')) { @@ -15,7 +15,7 @@ class gtIfClassHasMethod extends gtPreCondition { } return true; } - + 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 index 7495c73eca..f70af881ec 100644 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php +++ b/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php @@ -5,15 +5,15 @@ * */ class gtIsSpecifiedFunctionOrMethod extends gtPreCondition { - + public function check( $clo) { if($clo->hasOption('f') || $clo->hasOption('m')) { - + return true; } return false; } - + 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 index 40530f3aca..ebc0a68f57 100644 --- a/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php +++ b/scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php @@ -5,15 +5,15 @@ * */ class gtIsSpecifiedTestType extends gtPreCondition { - + public function check( $clo) { if($clo->hasOption('b') || $clo->hasOption('e') || $clo->hasOption('v') ) { - + return true; } return false; } - + public function getMessage() { return gtText::get('testTypeNotSpecified'); } diff --git a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php index 684c24dd7e..92560c8631 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php +++ b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php @@ -23,12 +23,12 @@ abstract class gtBasicTestCase extends gtTestCase { return new gtBasicTestCaseMethod($optionalSections); } } - + public function constructSubjectCalls() { $this->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 ); diff --git a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php index f64c6daf32..c0fc9eb61f 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php +++ b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php @@ -22,13 +22,13 @@ class gtBasicTestCaseFunction extends gtBasicTestCase { public function constructTestCase() { $this->constructCommonHeaders(); - + $this->addBasicEcho(); - + $this->constructSubjectCalls(); - + $this->constructCommonClosing(); - + } diff --git a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php index 3d3896e233..d009d5038a 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php +++ b/scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php @@ -10,34 +10,34 @@ class gtBasicTestCaseMethod extends gtBasicTestCase { } /** - * Set the method + * 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(); @@ -45,7 +45,7 @@ public function constructTestCase() { $this->testCase[] = "var_dump( \$class->".$this->subject->getName()."( ".$list." ) );"; $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); } - $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); + $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); } } diff --git a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php index 214e3d28ba..82f955cf46 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php +++ b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php @@ -17,7 +17,7 @@ abstract class gtErrorTestCase extends gtTestCase { * @return test case object */ public static function getInstance($optionalSections, $type = 'function') { - + if($type == 'function') { return new gtErrorTestCaseFunction($optionalSections); } @@ -34,16 +34,16 @@ abstract class gtErrorTestCase extends gtTestCase { 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 ); diff --git a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php index 2453acf6fd..fcba6d798c 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php +++ b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php @@ -26,13 +26,13 @@ class gtErrorTestCaseFunction extends gtErrorTestCase { */ public function constructTestCase() { $this->constructCommonHeaders(); - + $this->addErrorEcho(); - + $this->constructSubjectCalls(); - + $this->constructCommonClosing(); - + } diff --git a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php index 647e52f93e..fa1c8ca3f1 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php +++ b/scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php @@ -27,33 +27,33 @@ class gtErrorTestCaseMethod extends gtErrorTestCase { */ 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 index 60c115a9c1..e6fa7affcf 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtTestCase.php +++ b/scripts/dev/generate-phpt/src/testcase/gtTestCase.php @@ -80,11 +80,11 @@ abstract class gtTestCase { */ public function ConstructCommonClosing() { $this->fileClosing(); - + if ($this->optionalSections->hasDone()) { $this->addDone(); } - + if ($this->optionalSections->hasClean()) { $this->addClean(); } diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php b/scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php index 59951707ce..f445d9e7f4 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php +++ b/scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php @@ -4,9 +4,9 @@ * Container for all possible variation test cases */ abstract class gtVariationContainer { - + protected $variationTests; - + protected $dataTypes = array ( 'array', 'boolean', @@ -16,9 +16,9 @@ abstract class gtVariationContainer { 'object', 'string', ); - - - + + + /** * Return an instance of a containers for either function or method tests * @@ -26,21 +26,21 @@ abstract class gtVariationContainer { * @return variation test container */ public static function getInstance ($optionalSections, $type = 'function') { - + if($type == 'function') { return new gtVariationContainerFunction($optionalSections); } if($type =='method') { return new gtVariationContainerMethod($optionalSections); } - + } - - + + public function constructAll() { } - - + + /** * Returns all varaition tests as an array of arrays * @@ -49,6 +49,6 @@ abstract class gtVariationContainer { public function getVariationTests() { return $this->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 index a62882a81a..b6a3aa473c 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php +++ b/scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php @@ -4,14 +4,14 @@ * Container for all possible variation test cases of functions */ class gtVariationContainerFunction extends gtVariationContainer { - + protected $function; protected $optionalSections; - + public function __construct($osl) { $this->optionalSections = $osl; } - + /** * Sets function being tested * @@ -20,15 +20,15 @@ class gtVariationContainerFunction extends gtVariationContainer { 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) { @@ -38,6 +38,6 @@ class gtVariationContainerFunction extends gtVariationContainer { $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 index bee26b08aa..0d24337b3b 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php +++ b/scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php @@ -3,15 +3,15 @@ * Container for all possible variation test cases for a method */ class gtVariationContainerMethod extends gtVariationContainer { - + protected $method; protected $optionalSections; - + public function __construct($osl) { $this->optionalSections = $osl; } - - + + /** * Sets the method to be tested * @@ -20,27 +20,27 @@ class gtVariationContainerMethod extends gtVariationContainer { 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 index 039367d5b3..e868b80795 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCase.php +++ b/scripts/dev/generate-phpt/src/testcase/gtVariationTestCase.php @@ -15,7 +15,7 @@ abstract class gtVariationTestCase extends gtTestCase { * @return test case object */ public static function getInstance($optionalSections, $type = 'function') { - + if($type == 'function') { return new gtVariationTestCaseFunction($optionalSections); } diff --git a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php b/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php index 7bf1c8b778..45cbe2046c 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php +++ b/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php @@ -32,22 +32,22 @@ class gtVariationTestCaseFunction extends gtVariationTestCase { * */ public function constructTestCase() { - $this->constructCommonHeaders(); - + $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() { + + public function subjectCalls() { $this->testCase = gtCodeSnippet::append('loopStart', $this->testCase); // Construct the argument list to pass to the function being tested @@ -59,6 +59,6 @@ class gtVariationTestCaseFunction extends gtVariationTestCase { $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 index a9c921f9db..db923f078a 100644 --- a/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseMethod.php +++ b/scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseMethod.php @@ -34,15 +34,15 @@ class gtVariationTestCaseMethod extends gtVariationTestCase { */ public function constructTestCase() { $this->constructCommonHeaders(); - + $this->addVariationEcho(); - + $this->constructorArgInit(); $this->constructorCreateInstance(); - + $this->constructSubjectcalls(); $this->constructCommonClosing(); - + } public function testHeader() { diff --git a/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php b/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php index dbba0d6470..fa80c0766d 100644 --- a/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php +++ b/scripts/dev/generate-phpt/tests/gtBasicTestCaseFunctionTest.php @@ -6,13 +6,13 @@ 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(); diff --git a/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php b/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php index 81307f139c..18768b6294 100644 --- a/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php +++ b/scripts/dev/generate-phpt/tests/gtBasicTestCaseMethodTest.php @@ -6,7 +6,7 @@ class gtBasicTestCaseMethodTest extends PHPUnit_Framework_TestCase { public function testTestCase() { - + $f = new gtMethod('DOMDocument','createAttribute'); $f->setArgumentNames(); $f->setArgumentLists(); @@ -18,11 +18,11 @@ class gtBasicTestCaseMethodTest extends PHPUnit_Framework_TestCase { $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 index bc0c48a5a1..6d4d5861c3 100644 --- a/scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php +++ b/scripts/dev/generate-phpt/tests/gtCodeSnippetTest.php @@ -5,7 +5,7 @@ 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); diff --git a/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php b/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php index 2fd6818a45..1bf32b4608 100644 --- a/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php +++ b/scripts/dev/generate-phpt/tests/gtCommandLineOptionsTest.php @@ -5,7 +5,7 @@ require_once 'PHPUnit/Framework.php'; class gtCommandLineOptionsTest extends PHPUnit_Framework_TestCase { - + /** * @expectedException RuntimeException */ @@ -26,7 +26,7 @@ require_once 'PHPUnit/Framework.php'; $this->assertTrue($clo->hasOption('f')); $this->assertEquals('some-function', $clo->getOption('f')); } - + /** * @expectedException RuntimeException */ @@ -34,7 +34,7 @@ require_once 'PHPUnit/Framework.php'; $clo = new gtCommandLineOptions(); $clo->parse(array('generate-phpt.php', '-z')); } - + /** * @expectedException RuntimeException */ diff --git a/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php b/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php index 5b72fcc9f5..c6399168be 100644 --- a/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php +++ b/scripts/dev/generate-phpt/tests/gtErrorTestCaseFunctionTest.php @@ -6,23 +6,23 @@ 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 index 7077881296..894a551597 100644 --- a/scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php +++ b/scripts/dev/generate-phpt/tests/gtErrorTestCaseMethodTest.php @@ -6,7 +6,7 @@ class gtErrorTestCaseMethodTest extends PHPUnit_Framework_TestCase { public function testTestCase() { - + $f = new gtMethod('DOMDocument', 'createAttribute'); $f->setArgumentNames(); $f->setArgumentLists(); @@ -15,14 +15,14 @@ class gtErrorTestCaseMethodTest extends PHPUnit_Framework_TestCase { $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)); } diff --git a/scripts/dev/generate-phpt/tests/gtFunctionTest.php b/scripts/dev/generate-phpt/tests/gtFunctionTest.php index 0aa7eac119..5afcd950d4 100644 --- a/scripts/dev/generate-phpt/tests/gtFunctionTest.php +++ b/scripts/dev/generate-phpt/tests/gtFunctionTest.php @@ -43,25 +43,25 @@ class gtFunctionTest extends PHPUnit_Framework_TestCase $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]); diff --git a/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php b/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php index 064edf3b65..a60f77ef37 100644 --- a/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php +++ b/scripts/dev/generate-phpt/tests/gtIsSpecifiedFunctionOrMethodTest.php @@ -20,16 +20,16 @@ class gtIsSpecifiedFunctionOrMethodTest extends PHPUnit_Framework_TestCase { $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(); diff --git a/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php b/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php index c8b0a4e36a..bc7cf9412d 100644 --- a/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php +++ b/scripts/dev/generate-phpt/tests/gtIsSpecifiedTestTypeTest.php @@ -20,7 +20,7 @@ class gtIsSpecifiedTestTypeTest extends PHPUnit_Framework_TestCase { $ch = new gtIsSpecifiedTestType(); $this->assertFalse($ch->check($clo)); } - + public function testMessage() { $clo = new gtCommandLineOptions(); diff --git a/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php b/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php index 51ca87879d..507ca232db 100644 --- a/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php +++ b/scripts/dev/generate-phpt/tests/gtIsValidClassTest.php @@ -20,7 +20,7 @@ class gtIsValidClassTest extends PHPUnit_Framework_TestCase { $ch = new gtIsValidClass(); $this->assertFalse($ch->check($clo)); } - + public function testNotGiven() { $clo = new gtCommandLineOptions(); @@ -28,7 +28,7 @@ class gtIsValidClassTest extends PHPUnit_Framework_TestCase { $ch = new gtIsValidClass(); $this->assertTrue($ch->check($clo)); } - + public function testMessage() { $clo = new gtCommandLineOptions(); diff --git a/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php b/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php index d4700b9d66..07a7038dcc 100644 --- a/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php +++ b/scripts/dev/generate-phpt/tests/gtIsValidFunctionTest.php @@ -20,7 +20,7 @@ class gtIsValidFunctionTest extends PHPUnit_Framework_TestCase { $ch = new gtIsValidFunction(); $this->assertFalse($ch->check($clo)); } - + public function testNotSupplied() { $clo = new gtCommandLineOptions(); @@ -28,7 +28,7 @@ class gtIsValidFunctionTest extends PHPUnit_Framework_TestCase { $ch = new gtIsValidFunction(); $this->assertTrue($ch->check($clo)); } - + public function testMessage() { $clo = new gtCommandLineOptions(); diff --git a/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php b/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php index fe069977ef..0f1b349f4d 100644 --- a/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php +++ b/scripts/dev/generate-phpt/tests/gtIsValidMethodTest.php @@ -20,7 +20,7 @@ class gtIsValidMethodTest extends PHPUnit_Framework_TestCase { $ch = new gtIsValidMethod(); $this->assertFalse($ch->check($clo)); } - + public function testNotGiven() { $clo = new gtCommandLineOptions(); @@ -28,7 +28,7 @@ class gtIsValidMethodTest extends PHPUnit_Framework_TestCase { $ch = new gtIsValidMethod(); $this->assertTrue($ch->check($clo)); } - + public function testMessage() { $clo = new gtCommandLineOptions(); diff --git a/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php b/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php index dbf2994567..541dbdf2dd 100644 --- a/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php +++ b/scripts/dev/generate-phpt/tests/gtOptionalSectionsTest.php @@ -27,29 +27,29 @@ class gtOptionalSectionsTest extends PHPUnit_Framework_TestCase $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() ); } diff --git a/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php b/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php index df9f21c309..83178b21e7 100644 --- a/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php +++ b/scripts/dev/generate-phpt/tests/gtVariationTestCaseFunctionTest.php @@ -5,55 +5,55 @@ 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 index d99b6562d0..a074fcceeb 100644 --- a/scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php +++ b/scripts/dev/generate-phpt/tests/gtVariationTestCaseMethodTest.php @@ -5,23 +5,23 @@ 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 |