function TestSuite::addTestFile
Wraps both <code>addTest()</code> and <code>addTestSuite</code> 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 <code>PHPUnit\Framework\WarningTestCase</code> will be created instead, leaving the current test run untouched.
Throws
1 call to TestSuite::addTestFile()
- TestSuite::addTestFiles in vendor/
phpunit/ phpunit/ src/ Framework/ TestSuite.php - Wrapper for addTestFile() that adds multiple test files.
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ TestSuite.php, line 244
Class
- TestSuite
- @template-implements IteratorAggregate<int, Test>
Namespace
PHPUnit\FrameworkCode
public function addTestFile(string $filename) : void {
try {
if (str_ends_with($filename, '.phpt') && is_file($filename)) {
$this->addTest(new PhptTestCase($filename));
}
else {
$this->addTestSuite((new TestSuiteLoader())->load($filename));
}
} catch (RunnerException $e) {
Event\Facade::emitter()->testRunnerTriggeredWarning($e->getMessage());
}
}