function TranslatableMarkupTest::errorHandler

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\TranslatableMarkupTest::errorHandler()
  2. 10 core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\TranslatableMarkupTest::errorHandler()
  3. 11.x core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\TranslatableMarkupTest::errorHandler()

Custom error handler that saves the last error.

We need this custom error handler because we cannot rely on the error to exception conversion as __toString is never allowed to leak any kind of exception.

Parameters

int $error_number: The error number.

string $error_message: The error message.

File

core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php, line 44

Class

TranslatableMarkupTest
Tests the TranslatableMarkup class.

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function errorHandler($error_number, $error_message) {
    $this->lastErrorNumber = $error_number;
    $this->lastErrorMessage = $error_message;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.