DrupalStandardsListenerDeprecationTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Drupal\Tests\Core\Listeners;
  3. use Drupal\Tests\UnitTestCase;
  4. /**
  5. * Test deprecation error handling by DrupalStandardsListener.
  6. *
  7. * DrupalStandardsListener has a dependency on composer/composer, so we can't
  8. * test it directly. However, we can create a test which is annotated as
  9. * covering a deprecated class. This way we can know whether the standards
  10. * listener process ignores deprecation errors.
  11. *
  12. * Note that this test is annotated as covering
  13. * \Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass::testFunction(),
  14. * but the reason the test exists is to cover
  15. * \Drupal\Tests\Listeners\DrupalStandardsListener::endTest(). We never
  16. * actually instantiate
  17. * \Drupal\deprecation_test\Deprecation\FixtureDeprecatedClass because that
  18. * would trigger another deprecation error.
  19. *
  20. * @group Listeners
  21. *
  22. * @coversDefaultClass \Drupal\deprecation_test\Deprecation\DrupalStandardsListenerDeprecatedClass
  23. */
  24. class DrupalStandardsListenerDeprecationTest extends UnitTestCase {
  25. /**
  26. * Exercise DrupalStandardsListener's coverage validation.
  27. *
  28. * @covers ::testFunction
  29. */
  30. public function testDeprecation() {
  31. // Meaningless assertion so this test is not risky.
  32. $this->assertTrue(TRUE);
  33. }
  34. }