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

Breadcrumb

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

function TestRunner::runTestWithTimeout

Throws

Throwable

1 call to TestRunner::runTestWithTimeout()
TestRunner::run in vendor/phpunit/phpunit/src/Framework/TestRunner.php

File

vendor/phpunit/phpunit/src/Framework/TestRunner.php, line 415

Class

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

Namespace

PHPUnit\Framework

Code

private function runTestWithTimeout(TestCase $test) : bool {
    $_timeout = $this->configuration
        ->defaultTimeLimit();
    $testSize = $test->size();
    if ($testSize->isSmall()) {
        $_timeout = $this->configuration
            ->timeoutForSmallTests();
    }
    elseif ($testSize->isMedium()) {
        $_timeout = $this->configuration
            ->timeoutForMediumTests();
    }
    elseif ($testSize->isLarge()) {
        $_timeout = $this->configuration
            ->timeoutForLargeTests();
    }
    try {
        (new Invoker())->invoke([
            $test,
            'runBare',
        ], [], $_timeout);
    } catch (TimeoutException) {
        Event\Facade::emitter()->testConsideredRisky($test->valueObjectForEvents(), sprintf('This test was aborted after %d second%s', $_timeout, $_timeout !== 1 ? 's' : ''));
        return true;
    }
    return false;
}
RSS feed
Powered by Drupal