class ExpectDeprecationTest

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest
  2. 10 core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest
  3. 9 core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest
  4. 8.9.x core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest

Ensures test coverage for deprecation testing.

Attributes

#[Group('Test')] #[IgnoreDeprecations]

Hierarchy

Expanded class hierarchy of ExpectDeprecationTest

File

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

Namespace

Drupal\Tests
View source
class ExpectDeprecationTest extends TestCase {
  use ExpectDeprecationTrait;
  
  /**
   * Tests expectDeprecation.
   */
  public function testExpectDeprecation() : void {
    $this->expectDeprecation('Test deprecation');
    // phpcs:ignore Drupal.Semantics.FunctionTriggerError
    @trigger_error('Test deprecation', E_USER_DEPRECATED);
  }
  
  /**
   * Tests expectDeprecation in isolated test.
   */
  public function testExpectDeprecationInIsolation() : void {
    $this->expectDeprecation('Test isolated deprecation');
    // phpcs:ignore Drupal.Semantics.FunctionTriggerError
    @trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
  }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary
ExpectDeprecationTest::testExpectDeprecation public function Tests expectDeprecation.
ExpectDeprecationTest::testExpectDeprecationInIsolation public function Tests expectDeprecation in isolated test.
ExpectDeprecationTrait::expectDeprecation Deprecated public function Adds an expected deprecation.
ExpectDeprecationTrait::regularExpressionForFormatDescription private function

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