From 1160fbbec4d96f79dac54c2d865f116776db931c Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Mon, 22 May 2017 10:49:55 +0100 Subject: [PATCH] Issue #2878248 by Mile23, dawehner: DrupalStandardsListener improper handling of @trigger_error() deprecation --- .../deprecation_test.info.yml | 6 +++ .../Deprecation/FixtureDeprecatedClass.php | 28 +++++++++++++ ...DrupalStandardsListenerDeprecationTest.php | 39 +++++++++++++++++++ .../Listeners/DrupalStandardsListener.php | 10 +++++ 4 files changed, 83 insertions(+) create mode 100644 core/modules/system/tests/modules/deprecation_test/deprecation_test.info.yml create mode 100644 core/modules/system/tests/modules/deprecation_test/src/Deprecation/FixtureDeprecatedClass.php create mode 100644 core/tests/Drupal/Tests/Core/Listeners/DrupalStandardsListenerDeprecationTest.php diff --git a/core/modules/system/tests/modules/deprecation_test/deprecation_test.info.yml b/core/modules/system/tests/modules/deprecation_test/deprecation_test.info.yml new file mode 100644 index 000000000000..5b289513caed --- /dev/null +++ b/core/modules/system/tests/modules/deprecation_test/deprecation_test.info.yml @@ -0,0 +1,6 @@ +name: 'Deprecation test' +type: module +description: 'Support module for testing deprecation behaviors.' +package: Testing +version: VERSION +core: 8.x diff --git a/core/modules/system/tests/modules/deprecation_test/src/Deprecation/FixtureDeprecatedClass.php b/core/modules/system/tests/modules/deprecation_test/src/Deprecation/FixtureDeprecatedClass.php new file mode 100644 index 000000000000..65aea782506b --- /dev/null +++ b/core/modules/system/tests/modules/deprecation_test/src/Deprecation/FixtureDeprecatedClass.php @@ -0,0 +1,28 @@ +assertTrue(TRUE); + } + +} diff --git a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php index fa2541886ef3..fd15f8218bc1 100644 --- a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php +++ b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php @@ -142,6 +142,16 @@ class DrupalStandardsListener extends BaseTestListener { /** * {@inheritdoc} + * + * We must mark this method as belonging to the special legacy group because + * it might trigger an E_USER_DEPRECATED error during coverage annotation + * validation. The legacy group allows symfony/phpunit-bridge to keep the + * deprecation notice as a warning instead of an error, which would fail the + * test. + * + * @group legacy + * + * @see http://symfony.com/doc/current/components/phpunit_bridge.html#mark-tests-as-legacy */ public function endTest(\PHPUnit_Framework_Test $test, $time) { // \PHPUnit_Framework_Test does not have any useful methods of its own for