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

Class: PHPUnit_TestSuite

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

Class Overview


A TestSuite is a Composite of Tests. It runs a collection of test cases.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 85]
A TestSuite is a Composite of Tests. It runs a collection of test cases.

Here is an example using the dynamic test definition.


1 <?php
2 $suite = new PHPUnit_TestSuite();
3 $suite->addTest(new MathTest('testPass'));
4 ?>

Alternatively, a TestSuite can extract the tests to be run automatically. To do so you pass the classname of your TestCase class to the TestSuite constructor.


1 <?php
2 $suite = new TestSuite('classname');
3 ?>

This constructor creates a suite with all the methods starting with "test" that take no arguments.



[ Top ]


Method Detail

PHPUnit_TestSuite (Constructor)   [line 108]

PHPUnit_TestSuite PHPUnit_TestSuite( [mixed $test = FALSE])

Constructs a TestSuite.
  • Access: public

Parameters:

mixed   $test     

[ Top ]

addTest   [line 121]

void addTest( object &$test)

Adds a test to the suite.
  • Access: public

Parameters:

object   &$test     

[ Top ]

addTestSuite   [line 131]

void addTestSuite( string $testClass)

Adds the tests from the given class to the suite.
  • Access: public

Parameters:

string   $testClass     

[ Top ]

countTestCases   [line 156]

integer countTestCases( )

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

[ Top ]

getName   [line 172]

string getName( )

Returns the name of the suite.
  • Access: public

[ Top ]

run   [line 182]

void run( object &$result)

Runs the tests and collects their result in a TestResult.
  • Access: public

Parameters:

object   &$result     

[ Top ]

runTest   [line 195]

void runTest( object &$test, object &$result)

Runs a test.
  • Access: public

Parameters:

object   &$test     
object   &$result     

[ Top ]

setName   [line 205]

void setName( string $name)

Sets the name of the suite.
  • Access: public

Parameters:

string   $name     

[ Top ]

testAt   [line 216]

object &testAt( integer $index)

Returns the test at the given index.
  • Access: public

Parameters:

integer   $index     

[ Top ]

testCount   [line 230]

integer testCount( )

Returns the number of tests in this suite.
  • Access: public

[ Top ]

tests   [line 240]

array &tests( )

Returns the tests as an enumeration.
  • Access: public

[ Top ]

toString   [line 250]

string toString( )

Returns a string representation of the test suite.
  • Access: public

[ Top ]


Documentation generated on Thu, 10 Nov 2005 05:02:25 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.