function ExpectDeprecationTest::testExpectDeprecation

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest::testExpectDeprecation()
  2. 10 core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest::testExpectDeprecation()
  3. 11.x core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest::testExpectDeprecation()

@covers ::addExpectedDeprecationMessage

File

core/tests/Drupal/Tests/ExpectDeprecationTest.php, line 23

Class

ExpectDeprecationTest
@coversDefaultClass <a href="/api/drupal/core%21tests%21Drupal%21Tests%21Traits%21ExpectDeprecationTrait.php/trait/ExpectDeprecationTrait/9" title="Adds the ability to dynamically set expected deprecation messages in tests." class="local">\Drupal\Tests\Traits\ExpectDeprecationTrait</a>

Namespace

Drupal\Tests

Code

public function testExpectDeprecation() {
    $this->expectDeprecation('Drupal\\Tests\\Traits\\ExpectDeprecationTrait::addExpectedDeprecationMessage() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \\Symfony\\Bridge\\PhpUnit\\ExpectDeprecationTrait::expectDeprecation() instead. See https://www.drupal.org/node/3161901');
    $this->addExpectedDeprecationMessage('Test deprecation');
    @trigger_error('Test deprecation', E_USER_DEPRECATED);
}

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