Comments

Gábor Hojtsy created an issue. See original summary.

catch’s picture

mile23’s picture

Re: #2: Not all deprecated code calls @trigger_error(), so we can't enforce with testing.

catch’s picture

gábor hojtsy’s picture

@catch re #2 I opened this because #2608062: [META] Requirements for tagging Drupal 9.0.0-alpha1 listed all these three issues as requirements for a section and they did not seem to be in an existing parent-children relationship and somewhat distinct. If that is not the case, we can repurpose one of those and close this :)

catch’s picture

Issue summary: View changes
mile23’s picture

StatusFileSize
new2.66 KB

Here's a test where the failing results are classes marked @deprecated but which don't @trigger_error().

It requires symfony/finder. It has a bunch of limitations, and we shouldn't include this in core.

Limiting the discovery to the simpletest module, it shows output like this:

$ ./vendor/bin/phpunit -c core/ core/tests/FindDeprecatedTest.php 
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\FindDeprecatedTest
FF......................F..........                               35 / 35 (100%)

Time: 14.4 seconds, Memory: 6.00MB

There were 3 failures:

1) Drupal\Tests\FindDeprecatedTest::testEachFile with data set #0 ('/Users/paul/projects/drupal/c...er.php')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/Users/paul/projects/drupal/core/modules/simpletest/src/RouteProvider.php'
+''

/Users/paul/projects/drupal/core/tests/FindDeprecatedTest.php:72

2) Drupal\Tests\FindDeprecatedTest::testEachFile with data set #1 ('/Users/paul/projects/drupal/c...rt.php')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/Users/paul/projects/drupal/core/modules/simpletest/src/WebAssert.php'
+''

/Users/paul/projects/drupal/core/tests/FindDeprecatedTest.php:72

3) Drupal\Tests\FindDeprecatedTest::testEachFile with data set #24 ('/Users/paul/projects/drupal/c...er.php')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/Users/paul/projects/drupal/core/modules/simpletest/src/TestServiceProvider.php'
+''

/Users/paul/projects/drupal/core/tests/FindDeprecatedTest.php:72

FAILURES!
Tests: 35, Assertions: 41, Failures: 3.

Lo and behold those files have deprecated classes which don't @trigger_error().

Uploading this now because it's dinner time and if I run against the full file system it will take all evening. :-)

mile23’s picture

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

gábor hojtsy’s picture

Reparenting where this is actually listed as a requirement :)

gábor hojtsy’s picture

mpdonadio’s picture

How are global constants going to be enforced with testing, eg

/**
 * Time of the current request in seconds elapsed since the Unix Epoch.
 * ...
 * @deprecated in drupal:8.3.0 and is removed from drupal:9.0.0.
 *   Use \Drupal::time()->getRequestTime();
 *
 * @see https://www.drupal.org/node/2785211
 */
define('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']);

This would only be a possible with a coverage report?

gábor hojtsy’s picture

@mpdonadio: I think we accepted that that will not be testable at this time.

berdir’s picture

I don't think there is anything left here except #2959269: [meta] Core should not trigger deprecated code except in tests and during updates, which is basically the same meta with the actual sub-issues, should we promote that and close this?

gábor hojtsy’s picture

Status: Active » Closed (duplicate)

Great! That one is already critical and has the Drupal 9.0.0-beta1 requirement tag. I'll replace this issue's mention in #3079680: [META] Requirements for tagging Drupal 9.0.0-beta1 with that to remove the indirection.