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

Breadcrumb

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

function TestBuilder::build

@psalm-param non-empty-string $methodName

Throws

InvalidDataProviderException

File

vendor/phpunit/phpunit/src/Framework/TestBuilder.php, line 37

Class

TestBuilder
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Framework

Code

public function build(ReflectionClass $theClass, string $methodName) : Test {
    $className = $theClass->getName();
    $data = null;
    if ($this->requirementsSatisfied($className, $methodName)) {
        $data = (new DataProvider())->providedData($className, $methodName);
    }
    if ($data !== null) {
        return $this->buildDataProviderTestSuite($methodName, $className, $data, $this->shouldTestMethodBeRunInSeparateProcess($className, $methodName), $this->shouldGlobalStateBePreserved($className, $methodName), $this->shouldAllTestMethodsOfTestClassBeRunInSingleSeparateProcess($className), $this->backupSettings($className, $methodName));
    }
    $test = new $className($methodName);
    assert($test instanceof TestCase);
    $this->configureTestCase($test, $this->shouldTestMethodBeRunInSeparateProcess($className, $methodName), $this->shouldGlobalStateBePreserved($className, $methodName), $this->shouldAllTestMethodsOfTestClassBeRunInSingleSeparateProcess($className), $this->backupSettings($className, $methodName));
    return $test;
}

API Navigation

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