Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
drupal-check still reports some deprecations in 1.16 after #3023170: Test for compatibility with Drupal 9.
% drupal-check .
380/380 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ -----------------------------------------------------------------------------------------------------------------------
Line search_api.behat.inc
------ -----------------------------------------------------------------------------------------------------------------------
Class SearchApiSubContext was not found while trying to analyse it - autoloading is probably not configured properly.
------ -----------------------------------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line tests/src/Functional/IntegrationTest.php
------ -----------------------------------------------------------------------------------
907 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
1049 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
1110 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
------ -----------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line tests/src/Kernel/Processor/RenderedItemTest.php
------ -----------------------------------------------------------------------------------
247 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
------ -----------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line tests/src/Kernel/System/CommandHelperTest.php
------ -----------------------------------------------------------------------------------
122 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
140 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
152 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
281 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
294 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
------ -----------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line tests/src/Kernel/System/SerializationTest.php
------ -----------------------------------------------------------------------------------
135 Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:
https://github.com/sebastianbergmann/phpunit/issues/3369
------ -----------------------------------------------------------------------------------
[ERROR] Found 11 errors
Comment | File | Size | Author |
---|---|---|---|
#7 | 3126751-7--fix_phpunit_deprecations.patch | 11.37 KB | drunken monkey |
|
Comments
Comment #2
douggreen CreditAttribution: douggreen as a volunteer commentedpatch attached. This fixes everything except the warning about SearchApiSubContext, which I hope is a false positive.
Comment #3
douggreen CreditAttribution: douggreen as a volunteer commentedComment #4
douggreen CreditAttribution: douggreen as a volunteer commentedComment #5
effulgentsia CreditAttribution: effulgentsia at Acquia commentedThe test results in #2 are interesting. The Autocomplete test failure only happen on MySQL 5.6 and 5.7. It passes on MySQL 5.5 and MySQL 8, and also on SQLite and PostgreSQL.
On MySQL 5.6 and 5.7, the same failure happens on HEAD as well (without the #2 patch).
Comment #6
drunken monkeyThanks for reporting this issue!
I unfortunately have no clue about Behat, but in #3115214-12: Add Search API support for Behat Drupal Extension I was assured that the file structure needs to be like this (at the moment). So, yes, I also think that
SearchApiSubContext
is a false positive. Pretty unfortunate, but probably nothing we can do about it.The rest are all just
assertInternalType()
, so I think just having that as the title is much more appropriate. Especially as that’s a third-party deprecation, so I didn’t think it had anything to do with Drupal 9, or was urgent. Checking back now, though, I see that our tests are actually failing on this for Drupal 9. So yes, apparently really something we need to fix.However, I myself am only on PHPUnit 6.5, so those tests are now failing for me locally with “Call to undefined method”, and
composer update phpunit/phpunit
fails to do anything. (Trying further, it seems there are once again some version conflicts.) Looking through the change notices, I also don’t see anything about PHPUnit 7 now being required for Drupal 8 (just a bit more trouble in this regard on the horizon). Core’s usual information policy, I guess.Anyways, I guess my question is: Do you have any concrete information about how contrib modules should handle PHPUnit compatibility at the moment? (Also: Do you know how I can update to PHPUnit 7?)
If we shouldn’t rely on PHPUnit 7 at the moment, then I guess our best option is to ignore/hide those warnings somehow, at least for the moment.
Comment #7
drunken monkeyNB: Tests on D9 are now also failing on other method calls, namely
assertContains()
andassertNotContains()
, when used with string haystacks. The attached patch revision would fix those as well.Increasing priority as this keeps us from testing Drupal 9 compatibility.
However, I still need information on whether Drupal 8 code should still support PHPUnit 6. If it should, we’ll have to find a different solution.
Comment #9
Berdir> However, I still need information on whether Drupal 8 code should still support PHPUnit 6. If it should, we’ll have to find a different solution.
Some of the PHPunit 8 replacement methods have been backported to make it possible to be forward-compatible. But you definitely still want to tests to pass against Drupal 8, in other words, assertIsArray() is a no-go currently and you need to use something like assertTrue(is_array()) or just get rid of them in a different way...
The is array check here doesn't really serve a purpose. xpath() always returns an array, the not empty check alone should be enough.
same. And you could write this like this:
(untested)
The array stuff is just there to avoid a fatal error, the elementExists() will fail with an exception and abort the test if the element doesn't exist.
Same for all of these I think. The following asserts should all fail fairly clearly if it's not an array. assertCount() on NULL gives:
Argument #2 of PHPUnit\Framework\Assert::assertCount() must be a countable or iterable
Comment #10
drunken monkeyRe-triggered the tests and apparently all necessary shims are now in place. After pulling the latest 8.9 commits, the tests pass for me locally, too.
With this, I think this is RTBC?
Comment #12
drunken monkeyAlright, then: committed.
Thanks again, everyone!