PHPUnit
[ class tree: PHPUnit ] [ index: PHPUnit ] [ all elements ]

Class: PHPUnit_RepeatedTest

Source Location: /PHPUnit-1.2.2/PHPUnit/RepeatedTest.php

Class Overview

PHPUnit_TestDecorator
   |
   --PHPUnit_RepeatedTest

A Decorator that runs a test repeatedly.


Author(s):

Copyright:

  • Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Inherited Variables

Inherited Methods

Class: PHPUnit_TestDecorator

PHPUnit_TestDecorator::PHPUnit_TestDecorator()
Constructor.
PHPUnit_TestDecorator::basicRun()
Runs the test and collects the result in a TestResult.
PHPUnit_TestDecorator::countTestCases()
Counts the number of test cases that will be run by this test.
PHPUnit_TestDecorator::getTest()
Returns the test to be run.
PHPUnit_TestDecorator::run()
Runs the decorated test and collects the result in a TestResult.
PHPUnit_TestDecorator::toString()
Returns a string representation of the test.

Class Details

[line 68]
A Decorator that runs a test repeatedly.

Here is an example:

  1.  <?php
  2.  require_once 'PHPUnit.php';
  3.  require_once 'PHPUnit/RepeatedTest.php';
  4.  
  5.  class MathTest extends PHPUnit_TestCase {
  6.      var $fValue1;
  7.      var $fValue2;
  8.  
  9.      function MathTest($name{
  10.          $this->PHPUnit_TestCase($name);
  11.      }
  12.  
  13.      function setUp({
  14.          $this->fValue1 = 2;
  15.          $this->fValue2 = 3;
  16.      }
  17.  
  18.      function testAdd({
  19.          $this->assertTrue($this->fValue1 $this->fValue2 == 5);
  20.      }
  21.  }
  22.  
  23.  $suite = new PHPUnit_TestSuite;
  24.  
  25.  $suite->addTest(
  26.      new MathTest('testAdd'),
  27.      10
  28.    )
  29.  );
  30.  
  31.  $result PHPUnit::run($suite);
  32.  print $result->toString();
  33.  ?>



[ Top ]


Method Detail

PHPUnit_RepeatedTest (Constructor)   [line 82]

PHPUnit_RepeatedTest PHPUnit_RepeatedTest( object &$test, [integer $timesRepeat = 1])

Constructor.
  • Access: public

Parameters:

object   &$test   — 
integer   $timesRepeat   — 

[ Top ]

countTestCases   [line 94]

integer countTestCases( )

Counts the number of test cases that will be run by this test.
  • Access: public

Overrides PHPUnit_TestDecorator::countTestCases() (Counts the number of test cases that will be run by this test.)
[ Top ]

run   [line 106]

void run( object &$result)

Runs the decorated test and collects the result in a TestResult.
  • Abstract:
  • Access: public

Overrides PHPUnit_TestDecorator::run() (Runs the decorated test and collects the result in a TestResult.)

Parameters:

object   &$result   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:22:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.