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

Class: PHPUnit2_Framework_TestSuite

Source Location: /PHPUnit2-3.0.0alpha11/Framework/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-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 95]
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 PHPUnit2_Framework_TestSuite;
3 $suite->addTest(new MathTest('testPass'));
4 ?>

Alternatively, a TestSuite can extract the tests to be run automatically. To do so you pass a ReflectionClass instance for your PHPUnit2_Framework_TestCase class to the PHPUnit2_Framework_TestSuite constructor.


1 <?php
2 $suite = new PHPUnit2_Framework_TestSuite(
3 new ReflectionClass('MathTest')
4 );
5 ?>

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



[ Top ]


Method Detail

addTest   [line 227]

void addTest( mixed PHPUnit2_Framework_Test$test, PHPUnit2_Framework_Test $test)

Adds a test to the suite.
  • Access: public

Parameters:

PHPUnit2_Framework_Test   $test     

[ Top ]

addTestFile   [line 265]

void addTestFile( string $filename)

Wraps both

1 addTest()
and

1 addTestSuite
as well as the separate import statements for the user's convenience.

If the named file cannot be read or there are no new tests that can be added, a


1 PHPUnit2_Framework_Warning
will be created instead, leaving the current test run untouched.

  • Author: Stefano F. Rausch <mailto:stefano@rausch-e.net>
  • Since: Method available since Release 2.3.0
  • Access: public
  • Throws: InvalidArgumentException

Parameters:

string   $filename     

[ Top ]

addTestFiles   [line 325]

void addTestFiles( mixed {foreach($filenamesas$filename, Array $filenames)

Wrapper for addTestFile() that adds multiple test files.
  • Since: Method available since Release 2.3.0
  • Access: public
  • Throws: InvalidArgumentException

Parameters:

Array   $filenames     

[ Top ]

addTestSuite   [line 238]

void addTestSuite( mixed $testClass)

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

Parameters:

mixed   $testClass     

[ Top ]

toString   [line 216]

string toString( )

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

[ Top ]

__construct   [line 135]

void __construct( [mixed $theClass = ''], [string $name = ''])

Constructs a new TestSuite:

  • PHPUnit2_Framework_TestSuite() constructs an empty TestSuite.
  • PHPUnit2_Framework_TestSuite(ReflectionClass) constructs a TestSuite from the given class.
  • PHPUnit2_Framework_TestSuite(ReflectionClass, String) constructs a TestSuite from the given class with the given name.
  • PHPUnit2_Framework_TestSuite(String) either constructs a TestSuite from the given class (if the passed string is the name of an existing class) or constructs an empty TestSuite with the given name.

  • Access: public
  • Throws: InvalidArgumentException

Parameters:

mixed   $theClass     
string   $name     

[ Top ]


Documentation generated on Tue, 12 Sep 2006 09:38:04 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.