TestSuite
class TestSuite implements Test, SelfDescribing, IteratorAggregate (View source)
A TestSuite is a composite of Tests. It runs a collection of test cases.
Properties
protected bool | $backupGlobals | Enable or disable the backup and restoration of the $GLOBALS array. | |
protected bool | $backupStaticAttributes | Enable or disable the backup and restoration of static attributes. | |
protected bool | $runTestInSeparateProcess | ||
protected string | $name | The name of the test suite. | |
protected array | $groups | The test groups of the test suite. | |
protected TestCase[] | $tests | The tests in the test suite. | |
protected int | $numTests | The number of tests in the test suite. | |
protected bool | $testCase | ||
protected array | $foundClasses |
Methods
Constructs a new TestSuite:
Returns a string representation of the test suite.
Adds the tests from the given class to the suite.
Wraps both addTest()
and addTestSuite
as well as the separate import statements for the user's convenience.
Counts the number of test cases that will be run by this test.
Creates a default TestResult object.
Returns the name of the suite.
Returns the test groups of the suite.
No description
Set tests groups of the test case
No description
Sets the name of the suite.
Returns the tests as an enumeration.
Set tests of the test suite
Mark the test suite as skipped.
No description
No description
No description
No description
No description
No description
Returns an iterator for this test suite.
Template Method that is called before the tests of this test suite are run.
Template Method that is called after the tests of this test suite have finished running.
Details
at line 124
__construct(mixed $theClass = '', string $name = '')
Constructs a new TestSuite:
PHPUnit\Framework\TestSuite() constructs an empty TestSuite.
PHPUnit\Framework\TestSuite(ReflectionClass) constructs a TestSuite from the given class.
PHPUnit\Framework\TestSuite(ReflectionClass, String) constructs a TestSuite from the given class with the given name.
PHPUnit\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.
at line 202
string
toString()
Returns a string representation of the test suite.
at line 250
addTestSuite(mixed $testClass)
Adds the tests from the given class to the suite.
at line 302
addTestFile(string $filename)
Wraps both addTest()
and 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 PHPUnit\Framework\WarningTestCase
will be created instead,
leaving the current test run untouched.
at line 380
addTestFiles(array|Iterator $filenames)
Wrapper for addTestFile() that adds multiple test files.
at line 402
int
count(bool $preferCache = false)
Counts the number of test cases that will be run by this test.
at line 427
static Test
createTest(ReflectionClass $theClass, string $name)
at line 618
protected TestResult
createResult()
Creates a default TestResult object.
at line 628
string
getName()
Returns the name of the suite.
at line 638
array
getGroups()
Returns the test groups of the suite.
at line 643
getGroupDetails()
at line 653
setGroupDetails(array $groups)
Set tests groups of the test case
at line 665
TestResult
run(TestResult $result = null)
Runs the tests and collects their result in a TestResult.
at line 764
setRunTestInSeparateProcess(bool $runTestInSeparateProcess)
at line 781
runTest(Test $test, TestResult $result)
deprecated
deprecated
Runs a test.
at line 791
setName(string $name)
Sets the name of the suite.
at line 817
array
tests()
Returns the tests as an enumeration.
at line 827
setTests(array $tests)
Set tests of the test suite
at line 839
markTestSuiteSkipped(string $message = '')
Mark the test suite as skipped.
at line 848
protected
addTestMethod(ReflectionClass $class, ReflectionMethod $method)
at line 889
static bool
isTestMethod(ReflectionMethod $method)
at line 908
static protected WarningTestCase
warning(string $message)
at line 920
static protected SkippedTestCase
skipTest(string $class, string $methodName, string $message)
at line 932
static protected IncompleteTestCase
incompleteTest(string $class, string $methodName, string $message)
at line 940
setbeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState)
at line 950
setBackupGlobals(bool $backupGlobals)
at line 960
setBackupStaticAttributes(bool $backupStaticAttributes)
at line 972
TestSuiteIterator
getIterator()
Returns an iterator for this test suite.
at line 997
protected
setUp()
Template Method that is called before the tests of this test suite are run.
at line 1005
protected
tearDown()
Template Method that is called after the tests of this test suite have finished running.