summaryrefslogtreecommitdiff
path: root/scripts/dev/generate-phpt/src
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dev/generate-phpt/src')
-rw-r--r--scripts/dev/generate-phpt/src/codeSnippets/emptyUnsetUndefNull.txt2
-rw-r--r--scripts/dev/generate-phpt/src/generate-phpt.php6
-rw-r--r--scripts/dev/generate-phpt/src/gtClassMap.php20
-rw-r--r--scripts/dev/generate-phpt/src/gtCodeSnippet.php20
-rw-r--r--scripts/dev/generate-phpt/src/gtFunction.php2
-rw-r--r--scripts/dev/generate-phpt/src/gtMethod.php10
-rw-r--r--scripts/dev/generate-phpt/src/gtTestCaseWriter.php8
-rw-r--r--scripts/dev/generate-phpt/src/gtTestSubject.php12
-rw-r--r--scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php6
-rw-r--r--scripts/dev/generate-phpt/src/setup/gtOptionalSections.php10
-rw-r--r--scripts/dev/generate-phpt/src/setup/gtPreCondition.php10
-rw-r--r--scripts/dev/generate-phpt/src/setup/gtPreConditionList.php4
-rw-r--r--scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php4
-rw-r--r--scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php6
-rw-r--r--scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php6
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtBasicTestCase.php4
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseFunction.php8
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtBasicTestCaseMethod.php18
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtErrorTestCase.php10
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseFunction.php8
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtErrorTestCaseMethod.php16
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtTestCase.php4
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtVariationContainer.php24
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtVariationContainerFunction.php16
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php24
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtVariationTestCase.php2
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseFunction.php16
-rw-r--r--scripts/dev/generate-phpt/src/testcase/gtVariationTestCaseMethod.php8
28 files changed, 142 insertions, 142 deletions
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() {