ExpectDeprecationTest.php 901 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Drupal\Tests;
  3. use Drupal\Tests\Traits\ExpectDeprecationTrait;
  4. /**
  5. * @coversDefaultClass \Drupal\Tests\Traits\ExpectDeprecationTrait
  6. *
  7. * @group Test
  8. * @group legacy
  9. */
  10. class ExpectDeprecationTest extends UnitTestCase {
  11. use ExpectDeprecationTrait;
  12. /**
  13. * @covers ::expectDeprecation
  14. */
  15. public function testExpectDeprecation() {
  16. $this->expectDeprecation('Test deprecation');
  17. @trigger_error('Test deprecation', E_USER_DEPRECATED);
  18. }
  19. /**
  20. * @covers ::expectDeprecation
  21. * @runInSeparateProcess
  22. * @preserveGlobalState disabled
  23. */
  24. public function testExpectDeprecationInIsolation() {
  25. $this->expectDeprecation('Test isolated deprecation');
  26. $this->expectDeprecation('Test isolated deprecation2');
  27. @trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
  28. @trigger_error('Test isolated deprecation2', E_USER_DEPRECATED);
  29. }
  30. }