function PhpUnitBridgeTest::testDeprecatedClass

Same name in this branch
  1. 9 core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php \Drupal\KernelTests\Core\Test\PhpUnitBridgeTest::testDeprecatedClass()
Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php \Drupal\KernelTests\Core\Test\PhpUnitBridgeTest::testDeprecatedClass()
  2. 8.9.x core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php \Drupal\Tests\Core\Test\PhpUnitBridgeTest::testDeprecatedClass()
  3. 10 core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php \Drupal\KernelTests\Core\Test\PhpUnitBridgeTest::testDeprecatedClass()
  4. 10 core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php \Drupal\Tests\Core\Test\PhpUnitBridgeTest::testDeprecatedClass()
  5. 11.x core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php \Drupal\KernelTests\Core\Test\PhpUnitBridgeTest::testDeprecatedClass()
  6. 11.x core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php \Drupal\Tests\Core\Test\PhpUnitBridgeTest::testDeprecatedClass()

Tests class-level deprecation.

File

core/tests/Drupal/Tests/Core/Test/PhpUnitBridgeTest.php, line 19

Class

PhpUnitBridgeTest
Test how unit tests interact with deprecation errors.

Namespace

Drupal\Tests\Core\Test

Code

public function testDeprecatedClass() {
    $this->expectDeprecation('Drupal\\deprecation_test\\Deprecation\\FixtureDeprecatedClass is deprecated.');
    $deprecated = new FixtureDeprecatedClass();
    $this->assertEquals('test', $deprecated->testFunction());
}

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