Back to index

php5  5.3.10
Public Member Functions | Static Public Member Functions | Protected Attributes
gtErrorTestCase Class Reference

Class for simple errors - one too many args and one too few. More...

Inheritance diagram for gtErrorTestCase:
Inheritance graph
[legend]
Collaboration diagram for gtErrorTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 getShortArgumentList ()
 getLongArgumentList ()
 constructSubjectCalls ()
 addErrorEcho ()
 toString ()
 Convert test case from array to string.
 getTestCase ()
 Returns test case as a array.
 ConstructCommonHeaders ()
 Construct the common headers (title, file section..) of the test case.
 ConstructCommonClosing ()
 Construct the common closing statements (clean, done, EXPECTF...)
 fileOpening ()
 Start the FILE section of the test.
 constructorArgInit ()
 Add contructor argument initialisation to test case.
 constructorCreateInstance ()
 Create instance of class in the test case.
 argInit ()
 Add function or method initilaisation statements to the test case.
 fileClosing ()
 Add FILE section closing tag to the test case.
 addSkipif ()
 Add a skipif section to the test case.
 addIni ()
 Add an INI section to the test case.
 addClean ()
 Add a clean section to the test case.
 addDone ()
 Add a ===DONE=== statement to the test case.
 addExpectf ()
 Add an EXPECTF section.
 getOpt ()

Static Public Member Functions

static getInstance ($optionalSections, $type= 'function')
 Return instance of either method or function error test case.

Protected Attributes

 $shortArgumentList = ''
 $longArgumentList = ''
 $subject
 $testCase
 $optionalSections

Detailed Description

Class for simple errors - one too many args and one too few.

Definition at line 7 of file gtErrorTestCase.php.


Member Function Documentation

gtTestCase::addClean ( ) [inherited]

Add a clean section to the test case.

Definition at line 199 of file gtTestCase.php.

                             {
    $this->testCase[] = "--CLEAN--";
    $this->testCase[] = "<?php";
    $this->testCase[] = "?>";
  }

Here is the caller graph for this function:

gtTestCase::addDone ( ) [inherited]

Add a ===DONE=== statement to the test case.

Definition at line 210 of file gtTestCase.php.

                            {
    $this->testCase[] = "===DONE===";
  }

Here is the caller graph for this function:

Definition at line 47 of file gtErrorTestCase.php.

                                {
    $this->testCase[] = "echo \"*** Test by calling method or function with incorrect numbers of arguments ***\\n\";";
    $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase );
  }

Here is the call graph for this function:

Here is the caller graph for this function:

gtTestCase::addExpectf ( ) [inherited]

Add an EXPECTF section.

Definition at line 219 of file gtTestCase.php.

                               {
    $this->testCase[] = "--EXPECTF--";
    if ($this->optionalSections->hasDone() ){
      $this->testCase[] = '===DONE===';
    }
  }

Here is the caller graph for this function:

gtTestCase::addIni ( ) [inherited]

Add an INI section to the test case.

Definition at line 189 of file gtTestCase.php.

                           {
    $this->testCase[] = "--INI--";
    $this->testCase[] = "";
  }

Here is the caller graph for this function:

gtTestCase::addSkipif ( ) [inherited]

Add a skipif section to the test case.

Definition at line 155 of file gtTestCase.php.

                              {
    $this->testCase[] = "--SKIPIF--";
    $this->testCase[] = "<?php";
    if($this->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[] = "?>";
  }

Here is the call graph for this function:

Here is the caller graph for this function:

gtTestCase::argInit ( ) [inherited]

Add function or method initilaisation statements to the test case.

Definition at line 133 of file gtTestCase.php.

                            {
    $statements = $this->subject->getInitialisationStatements();
    foreach($statements as $statement) {
      $this->testCase[] = $statement;
    }
    $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase );
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Construct the common closing statements (clean, done, EXPECTF...)

Definition at line 81 of file gtTestCase.php.

                                           {
    $this->fileClosing();
     
    if ($this->optionalSections->hasDone()) {
      $this->addDone();
    }
     
    if ($this->optionalSections->hasClean()) {
      $this->addClean();
    }

    $this->addExpectf();
  }

Here is the call graph for this function:

Construct the common headers (title, file section..) of the test case.

Definition at line 62 of file gtTestCase.php.

                                           {
    $this->testHeader();

    if($this->optionalSections->hasSkipif()) {
      $this->addSkipif();
    }

    if($this->optionalSections->hasIni()) {
      $this->addIni();
    }

    $this->fileOpening();
  }

Here is the call graph for this function:

Add contructor argument initialisation to test case.

Definition at line 110 of file gtTestCase.php.

                                       {
    $conStatements = $this->subject->getConstructorInitStatements();
    foreach($conStatements as $statement) {
      $this->testCase[] = $statement;
    }
  }

Here is the caller graph for this function:

Create instance of class in the test case.

Definition at line 122 of file gtTestCase.php.

                                              {
    $constructorList = $this->subject->getConstructorArgumentList();
    $this->testCase[] = "\$class = new ".$this->subject->getClassName()."( ".$constructorList." );";
    $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase );
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 38 of file gtErrorTestCase.php.

                                          {
    $this->argInit();
    
    //Initialise the additional argument
    $this->testCase[] = "\$extra_arg = ";
    
    $this->subjectCalls();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

gtTestCase::fileClosing ( ) [inherited]

Add FILE section closing tag to the test case.

Definition at line 146 of file gtTestCase.php.

                                {
    $this->testCase[] = "?>";
  }

Here is the caller graph for this function:

gtTestCase::fileOpening ( ) [inherited]

Start the FILE section of the test.

Definition at line 99 of file gtTestCase.php.

                                {
    $this->testCase[] = "--FILE--";
    $this->testCase[] = "<?php";
    $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase );
  }

Here is the call graph for this function:

Here is the caller graph for this function:

static gtErrorTestCase::getInstance ( optionalSections,
type = 'function' 
) [static]

Return instance of either method or function error test case.

Parameters:
string$type
Returns:
test case object

Definition at line 19 of file gtErrorTestCase.php.

                                                                            {
     
    if($type == 'function') {
      return new gtErrorTestCaseFunction($optionalSections);
    }
    if($type =='method') {
      return new gtErrorTestCaseMethod($optionalSections);
    }

  }

Here is the caller graph for this function:

Definition at line 34 of file gtErrorTestCase.php.

gtTestCase::getOpt ( ) [inherited]

Definition at line 226 of file gtTestCase.php.

Definition at line 30 of file gtErrorTestCase.php.

gtTestCase::getTestCase ( ) [inherited]

Returns test case as a array.

Returns:
array

Definition at line 53 of file gtTestCase.php.

                                {
    return $this->testCase;
  }
gtTestCase::toString ( ) [inherited]

Convert test case from array to string.

Returns:
string

Definition at line 38 of file gtTestCase.php.

                             {
    $testCaseString = "";
    foreach($this->testCase as $line) {
      $testCaseString .= $line."\n";
    }
    return $testCaseString;
  }

Member Data Documentation

Definition at line 10 of file gtErrorTestCase.php.

gtTestCase::$optionalSections [protected, inherited]

Definition at line 30 of file gtTestCase.php.

Definition at line 9 of file gtErrorTestCase.php.

gtTestCase::$subject [protected, inherited]

Reimplemented in gtBasicTestCase, and gtVariationTestCaseMethod.

Definition at line 14 of file gtTestCase.php.

gtTestCase::$testCase [protected, inherited]

Reimplemented in gtVariationTestCaseMethod, and gtVariationTestCaseFunction.

Definition at line 22 of file gtTestCase.php.


The documentation for this class was generated from the following file: