You are here

protected function TestBase::getAssertionCall in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/simpletest/src/TestBase.php \Drupal\simpletest\TestBase::getAssertionCall()

Cycles through backtrace until the first non-assertion method is found.

Return value

Array representing the true caller.

1 call to TestBase::getAssertionCall()
TestBase::assert in core/modules/simpletest/src/TestBase.php
Internal helper: stores the assert.

File

core/modules/simpletest/src/TestBase.php, line 543
Contains \Drupal\simpletest\TestBase.

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function getAssertionCall() {
  $backtrace = debug_backtrace();

  // The first element is the call. The second element is the caller.
  // We skip calls that occurred in one of the methods of our base classes
  // or in an assertion function.
  while (($caller = $backtrace[1]) && (isset($caller['class']) && isset($this->skipClasses[$caller['class']]) || substr($caller['function'], 0, 6) == 'assert')) {

    // We remove that call.
    array_shift($backtrace);
  }
  return Error::getLastCaller($backtrace);
}