You are here

protected function DeprecationSuppressionTrait::setErrorHandler in Commerce Core 8.2

Sets an error handler to suppress specified deprecation messages.

4 calls to DeprecationSuppressionTrait::setErrorHandler()
CommerceBrowserTestBase::setUp in tests/src/Functional/CommerceBrowserTestBase.php
CommerceKernelTestBase::setUp in tests/src/Kernel/CommerceKernelTestBase.php
CommerceWebDriverTestBase::setUp in tests/src/FunctionalJavascript/CommerceWebDriverTestBase.php
UninstallTest::setUp in tests/src/Functional/UninstallTest.php

File

tests/src/Traits/DeprecationSuppressionTrait.php, line 21

Class

DeprecationSuppressionTrait
Enables suppression of select deprecation messages during testing.

Namespace

Drupal\Tests\commerce\Traits

Code

protected function setErrorHandler() {
  $previous_error_handler = set_error_handler(function ($severity, $message, $file, $line, $context = NULL) use (&$previous_error_handler) {
    $skipped_deprecations = [
      // @see https://www.drupal.org/project/address/issues/3089266
      'Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of theme_inline_entity_form_entity_table(). See https://www.drupal.org/node/1831138',
    ];
    if (!in_array($message, $skipped_deprecations, TRUE)) {
      return $previous_error_handler($severity, $message, $file, $line, $context);
    }
  }, E_USER_DEPRECATED);
}