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[]
The test groups of the test suite.
string
The name of the test suite.
int
The number of tests in the test suite.
null|list<ExecutionOrderDependency>
null|list<ExecutionOrderDependency>
bool
bool
Test[]
The tests in the test suite.
Constructs a new TestSuite.
Adds a test to the suite.
Adds all the files in a directory to the test suite. Does not recursive through directories.
Recursively adds all the files in a directory to the test suite.
Wraps both addTest()
and addTestSuite
as well as the separate import statements for the user's convenience.
Wrapper for addTestFile() that adds multiple test files.
Adds the tests from the given class to the suite.
Counts the number of test cases that will be run by this test.
Creates a default TestResult object.
Returns the test groups of the suite.
Returns an iterator for this test suite.
Returns the name of the suite.
Mark the test suite as skipped.
Runs the tests and collects their result in a TestResult.
Set tests groups of the test case.
Set tests of the test suite.
Returns the tests as an enumeration.
Returns a string representation of the test suite.
__construct(ReflectionClass|string $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 Exception
addTest(Test $test, array $groups = []): void
Adds a test to the suite.
Test
$test array
$groups optional void
addTestDirectory(string $directory = '.'): void
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.
void
addTestDirectoryRecursive(string $directory = '.'): void
Recursively adds all the files in a directory to the test suite.
string
$directory optional The directory subtree to add tests from.
void
addTestFile(string $filename): void
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 void
Exception
addTestFiles(iterable $fileNames): void
Wrapper for addTestFile() that adds multiple test files.
iterable
$fileNames void
Exception
addTestMethod(ReflectionClass $class, ReflectionMethod $method): void
ReflectionClass
$class ReflectionMethod
$method void
Exception
addTestSuite(mixed $testClass): void
Adds the tests from the given class to the suite.
void
Exception
addWarning(string $warning): void
string
$warning void
count(): int
Counts the number of test cases that will be run by this test.
int
createResult(): TestResult
Creates a default TestResult object.
TestResult
getGroupDetails(): array
array
getGroups(): array
Returns the test groups of the suite.
array
getIterator(): Iterator
Returns an iterator for this test suite.
Iterator
getName(): string
Returns the name of the suite.
string
injectFilter(Factory $filter): void
Factory
$filter void
markTestSuiteSkipped(string $message = ''): void
Mark the test suite as skipped.
string
$message optional void
SkippedTestSuiteError
provides(): list<ExecutionOrderDependency>
list<ExecutionOrderDependency>
requires(): list<ExecutionOrderDependency>
list<ExecutionOrderDependency>
run(TestResult $result = null): TestResult
Runs the tests and collects their result in a TestResult.
TestResult
$result optional TestResult
PHPUnit\Framework\CodeCoverageException
SebastianBergmann\CodeCoverage\InvalidArgumentException
SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException
SebastianBergmann\RecursionContext\InvalidArgumentException
Warning
setBackupGlobals(bool $backupGlobals): void
bool
$backupGlobals void
setBackupStaticAttributes(bool $backupStaticAttributes): void
bool
$backupStaticAttributes void
setBeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState): void
bool
$beStrictAboutChangesToGlobalState void
setGroupDetails(array $groups): void
Set tests groups of the test case.
array
$groups void
setName(string $name): void
string
$name void
setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void
bool
$runTestInSeparateProcess void
setTests(Test[] $tests): void
Set tests of the test suite.
Test[]
$tests void
sortId(): string
string
tests(): Test[]
Returns the tests as an enumeration.
Test[]
toString(): string
Returns a string representation of the test suite.
string
warnings(): array
array
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.
The name of the test suite.
string
The number of tests in the test suite.
int
null|list<ExecutionOrderDependency>
null|list<ExecutionOrderDependency>
bool
bool
The tests in the test suite.
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.4/class-Cake.TestSuite.TestSuite.html