A class to contain test cases and run them with shared fixtures
bool
Enable or disable the backup and restoration of the $GLOBALS array.
bool
Enable or disable the backup and restoration of static attributes.
string[]
array
The test groups of the test suite.
string
The name of the test suite.
int
The number of tests in the test suite.
bool
bool
\PHPUnit\Framework\Test[]
The tests in the test suite.
Adds all the files in a directory to the test suite. Does not recursive through directories.
Wraps both addTest()
and addTestSuite
as well as the separate import statements for the user's convenience.
__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.
\ReflectionClass|string
$theClass optional string
$name optional PHPUnit\Framework\Exception
addTest(\PHPUnit\Framework\Test $test, mixed $groups)
Adds a test to the suite.
\PHPUnit\Framework\Test
$test array
$groups optional addTestDirectory(string $directory)
Adds all the files in a directory to the test suite. Does not recursive through directories.
string
$directory optional The directory to add tests from.
addTestDirectoryRecursive(string $directory)
Recursively adds all the files in a directory to the test suite.
string
$directory optional The directory subtree to add tests from.
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.
string
$filename PHPUnit\Framework\Exception
addTestFiles(iterable $fileNames)
Wrapper for addTestFile() that adds multiple test files.
iterable
$fileNames PHPUnit\Framework\Exception
addTestMethod(\ReflectionClass $class, \ReflectionMethod $method)
\ReflectionClass
$class \ReflectionMethod
$method PHPUnit\Framework\Exception
addTestSuite(mixed $testClass)
Adds the tests from the given class to the suite.
object|string
$testClass PHPUnit\Framework\Exception
count(bool $preferCache)
Counts the number of test cases that will be run by this test.
bool
$preferCache optional createResult()
Creates a default TestResult object.
getGroupDetails()
getGroups()
Returns the test groups of the suite.
getIterator()
Returns an iterator for this test suite.
getName()
Returns the name of the suite.
injectFilter(\PHPUnit\Runner\Filter\Factory $filter)
\PHPUnit\Runner\Filter\Factory
$filter markTestSuiteSkipped(mixed $message)
Mark the test suite as skipped.
string
$message optional PHPUnit\Framework\SkippedTestSuiteError
run(\PHPUnit\Framework\TestResult $result)
Runs the tests and collects their result in a TestResult.
\PHPUnit\Framework\TestResult
$result optional PHPUnit\Framework\CodeCoverageException
SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException
SebastianBergmann\CodeCoverage\InvalidArgumentException
SebastianBergmann\CodeCoverage\MissingCoversAnnotationException
SebastianBergmann\CodeCoverage\RuntimeException
SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Warning
setBackupGlobals(mixed $backupGlobals)
bool
$backupGlobals setBackupStaticAttributes(mixed $backupStaticAttributes)
bool
$backupStaticAttributes setBeStrictAboutChangesToGlobalState(mixed $beStrictAboutChangesToGlobalState)
bool
$beStrictAboutChangesToGlobalState setGroupDetails(array $groups)
Set tests groups of the test case
array
$groups setName(string $name)
string
$name setRunTestInSeparateProcess(bool $runTestInSeparateProcess)
bool
$runTestInSeparateProcess setTests(array $tests)
Set tests of the test suite
\PHPUnit\Framework\Test[]
$tests testAt(int $index)
Returns the test at the given index.
int
$index false|\PHPUnit\Framework\Test
tests()
Returns the tests as an enumeration.
\PHPUnit\Framework\Test[]
toString()
Returns a string representation of the test suite.
Enable or disable the backup and restoration of the $GLOBALS array.
bool
Enable or disable the backup and restoration of static attributes.
bool
string[]
The test groups of the test suite.
array
The name of the test suite.
string
The number of tests in the test suite.
int
bool
bool
The tests in the test suite.
\PHPUnit\Framework\Test[]
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.TestSuite.TestSuite.html