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

Breadcrumb

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

function TestMethodBuilder::fromCallStack

Throws

NoTestCaseObjectOnCallStackException

File

vendor/phpunit/phpunit/src/Event/Value/Test/TestMethodBuilder.php, line 59

Class

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

Namespace

PHPUnit\Event\Code

Code

public static function fromCallStack() : TestMethod {
    foreach (debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
        if (isset($frame['object']) && $frame['object'] instanceof TestCase) {
            return $frame['object']->valueObjectForEvents();
        }
    }
    throw new NoTestCaseObjectOnCallStackException();
}
RSS feed
Powered by Drupal