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

Class: PHPUnit_TestSuite

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

Class Overview


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


Author(s):

Copyright:

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

Methods


Inherited Variables

Inherited Methods


Class Details

[line 51]
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 74]

PHPUnit_TestSuite PHPUnit_TestSuite( [mixed $test = FALSE])

Constructs a TestSuite.
  • Access: public

Parameters:

mixed   $test   — 

[ Top ]

addTest   [line 87]

void addTest( object &$test)

Adds a test to the suite.
  • Access: public

Parameters:

object   &$test   — 

[ Top ]

addTestSuite   [line 97]

void addTestSuite( string $testClass)

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

Parameters:

string   $testClass   — 

[ Top ]

countTestCases   [line 122]

integer countTestCases( )

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

[ Top ]

getName   [line 138]

string getName( )

Returns the name of the suite.
  • Access: public

[ Top ]

run   [line 148]

void run( object &$result)

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

Parameters:

object   &$result   — 

[ Top ]

runTest   [line 161]

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

Runs a test.
  • Access: public

Parameters:

object   &$test   — 
object   &$result   — 

[ Top ]

setName   [line 171]

void setName( string $name)

Sets the name of the suite.
  • Access: public

Parameters:

string   $name   — 

[ Top ]

testAt   [line 182]

object &testAt( integer $index)

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

Parameters:

integer   $index   — 

[ Top ]

testCount   [line 196]

integer testCount( )

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

[ Top ]

tests   [line 206]

array &tests( )

Returns the tests as an enumeration.
  • Access: public

[ Top ]

toString   [line 216]

string toString( )

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

[ Top ]


Documentation generated on Thu, 10 Dec 2015 05:37:23 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.