class ExpectDeprecationTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest
- 9 core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest
- 10 core/tests/Drupal/Tests/ExpectDeprecationTest.php \Drupal\Tests\ExpectDeprecationTest
@coversDefaultClass \Drupal\Tests\Traits\ExpectDeprecationTrait
@group Test @group legacy
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\PhpunitCompatibilityTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\ExpectDeprecationTest uses \Drupal\Tests\Traits\ExpectDeprecationTrait extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of ExpectDeprecationTest
File
-
core/
tests/ Drupal/ Tests/ ExpectDeprecationTest.php, line 13
Namespace
Drupal\TestsView source
class ExpectDeprecationTest extends UnitTestCase {
use ExpectDeprecationTrait;
/**
* @covers ::addExpectedDeprecationMessage
*/
public function testExpectDeprecation() {
$this->addExpectedDeprecationMessage('Test deprecation');
@trigger_error('Test deprecation', E_USER_DEPRECATED);
}
/**
* @covers ::addExpectedDeprecationMessage
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testExpectDeprecationInIsolation() {
$this->addExpectedDeprecationMessage('Test isolated deprecation');
$this->addExpectedDeprecationMessage('Test isolated deprecation2');
@trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
@trigger_error('Test isolated deprecation2', E_USER_DEPRECATED);
}
/**
* @covers ::expectDeprecation
*
* @todo the expectedDeprecation annotation does not work if tests are marked
* skipped.
* @see https://github.com/symfony/symfony/pull/25757
*/
public function testDeprecatedExpectDeprecation() {
$this->addExpectedDeprecationMessage('ExpectDeprecationTrait::expectDeprecation is deprecated in drupal:8.8.5 and is removed from drupal:9.0.0. Use ::addExpectedDeprecationMessage() instead. See https://www.drupal.org/node/3106024');
$this->expectDeprecation('Test deprecated expectDeprecation');
@trigger_error('Test deprecated expectDeprecation', E_USER_DEPRECATED);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.