Problem/Motivation
ComposerProjectTemplatesTest::testMinimumStabilityStrictness() tests that all the Composer dependencies of Drupal meet a minimum stability that's specified in the test.
However, the way this test is written, it doesn't check each dependency's stability against the required minimum and complain if one is not sufficient. Instead, it goes through all the dependencies, finds the lowest stability, and then that result is compared against the minimum.
This approach means that if the test fails, you just get this output:
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'dev'
+'stable'
/Users/joachim/Sites/drupal-core-composer/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121
/Users/joachim/Sites/drupal-core-composer/vendor/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php:94
/Users/joachim/Sites/drupal-core-composer/repos/drupal/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php:101
This is not useful, because it doesn't tell you which package caused the problem!
Steps to reproduce
Proposed resolution
Rewrite the test, so each package has its stability compared with the minimum.
(Ideally, we'd see ALL the failing packages in the test failure output, but I can't think how to do that.)
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3225706-3_5.txt | 688 bytes | gauravvvv |
| #5 | 3225706-5.patch | 3.64 KB | gauravvvv |
Issue fork drupal-3225706
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
joachim commentedSo we *could* make an array of all the projects's stabilities, keyed by projects, and then do:
which would fail if for example the array contains 'foo/bar' => 'dev'.
But PHPUnit doesn't show you the contents of the array in that circumstance: https://github.com/sebastianbergmann/phpunit/issues/3061
Comment #4
joachim commentedComment #5
gauravvvv commentedRe-rolled patch #3, Attached interdiff for same.
Comment #7
joachim commentedLGTM. Thanks!
Comment #9
yogeshmpawarMoving to RTBC as test failures are unrelated.
Comment #11
gauravvvv commentedRestoring status as test failures are unrelated.
Comment #12
alexpottThis is a good idea. I checked that contrib is not using the removed method - https://git.drupalcode.org/search?group_id=2&repository_ref=&scope=blobs...
However given we are removing a method only backported to 9.4.x.
Committed 8957175 and pushed to 10.0.x. Thanks!
Committed 7afe7f5 and pushed to 9.4.x. Thanks!