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

Class: PHPUnit_RepeatedTest

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

Class Overview

PHPUnit_TestDecorator
   |
   --PHPUnit_RepeatedTest

A Decorator that runs a test repeatedly.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 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 102]
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 PHPUnit_RepeatedTest(
27 new MathTest('testAdd'),
28 10
29 )
30 );
31
32 $result = PHPUnit::run($suite);
33 print $result->toString();
34 ?>



[ Top ]


Method Detail

PHPUnit_RepeatedTest (Constructor)   [line 116]

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

Constructor.
  • Access: public

Parameters:

object   &$test     
integer   $timesRepeat     

[ Top ]

countTestCases   [line 128]

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 140]

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 Thu, 10 Nov 2005 05:02:22 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.