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

Breadcrumb

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

function TestSuite::addTestMethod

Throws

Event\TestData\MoreThanOneDataSetFromDataProviderException

Exception

File

vendor/phpunit/phpunit/src/Framework/TestSuite.php, line 503

Class

TestSuite
@template-implements IteratorAggregate<int, Test>

Namespace

PHPUnit\Framework

Code

protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method) : void {
    $className = $class->getName();
    $methodName = $method->getName();
    assert(!empty($methodName));
    try {
        $test = (new TestBuilder())->build($class, $methodName);
    } catch (InvalidDataProviderException $e) {
        Event\Facade::emitter()->testTriggeredPhpunitError(new TestMethod($className, $methodName, $class->getFileName(), $method->getStartLine(), Event\Code\TestDoxBuilder::fromClassNameAndMethodName($className, $methodName), MetadataCollection::fromArray([]), Event\TestData\TestDataCollection::fromArray([])), sprintf("The data provider specified for %s::%s is invalid\n%s", $className, $methodName, $this->throwableToString($e)));
        return;
    }
    if ($test instanceof TestCase || $test instanceof DataProviderTestSuite) {
        $test->setDependencies(Dependencies::dependencies($class->getName(), $methodName));
    }
    $this->addTest($test, (new Groups())->groups($class->getName(), $methodName));
}
RSS feed
Powered by Drupal