Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TestSuite.php

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

Exception

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\Framework

Code

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());
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal