Problem/Motivation
Tests on Drupal 9 are currently failing:
https://www.drupal.org/pift-ci-job/1655810
Some of the failures are:
-
Drupal\Tests\feeds\Unit\FeedExpireHandlerTest::testPostExpire
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
Drupal\Tests\feeds\Kernel\Entity\FeedTest::testPushImport
Error: Class 'Doctrine\Common\Inflector\Inflector' not found
-
Drupal\Tests\feeds\Functional\Update\UpdateNonExistentActionUpdateTest::testUpdateActionsUpdateNonExistent
The update failed with the following message: "Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_unpublish_action" plugin does not exist.
There also deprecation errors and the error for $defaultTheme, for which separate issues exist:
#3095636: Add defaultTheme in tests extending BrowserTestBase.
#3129113: Replace @expectedException with expectException() call
The test failures above might require some extra effort, therefore I listed these separately.
See also the parent issue: #3129112: [meta] Drupal 9 support
Proposed resolution
To fix the error Error: Class 'Doctrine\Common\Inflector\Inflector' not found, Feeds needs to declare a dependency on doctrine/inflector. This dependency was removed from Drupal 9 core.
Remaining tasks
Add a dependency on doctrine/inflector in composer.json.
Add support for Ludwig module: add ludwig.json file with a dependency on doctrine/inflector in it.
- Make all tests pass, except for the FieldFormatter tests, which is handled in #3095636: Add defaultTheme in tests extending BrowserTestBase..
Remove $defaultTheme from tests as that is handled in #3095636: Add defaultTheme in tests extending BrowserTestBase..
- Fix update failure: Drupal\Tests\feeds\Functional\Update\UpdateNonExistentActionUpdateTest::testUpdateActionsUpdateNonExistent
The update failed with the following message: "Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_unpublish_action" plugin does not exist.
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
megachrizAdded link to parent issue.
Comment #3
megachrizThe error
Error: Class 'Doctrine\Common\Inflector\Inflector' not foundis caused by that Drupal core removeddoctrine/commonas a dependency for Drupal 9. This library depended ondoctrine/inflector, which Feeds uses.So that means Feeds would need to get a dependency on that library, adding that as a dependency in the composer.json file. It would also be good to add support for Ludwig module, so Feeds remains installable without Composer as well.
Comment #4
megachrizThis adds a dependency on "doctrine/inflector".
Comment #5
megachrizI think that this patch also fixes the
\Drupal::$container is not initialized yet.error.Comment #6
megachrizI decided to remove usage of doctrine/inflector now in #3123396: Feeds automatically uses English Plurals for all languages., so Feeds can still be installed on D9 without the need of using of Composer nor Ludwig.
The patch removes the changes to composer.json and removes the no longer needed ludwig.json file.
Comment #7
megachrizTemporary added
$defaultThemehere to reveal possible more D9 test failures.Also fixed a deprecation in
template_preprocess_feeds_feed()which got revealed in https://www.drupal.org/pift-ci-job/1677572.Comment #9
megachrizThis should fix at least some of the new test failures.
assertStringContainsString()is added to D8.8 for forward compatibility in #3126797: [D8 only] Add forwards-compatibility shim for assertString(Not)ContainsString()replacements in phpunit 6&7, so I assume that would not make the D8.8 tests fail here.Comment #10
megachrizComment #11
megachrizComment #12
megachrizThe following test failure seems a bit harder to fix, so leaving that one out for now:
Comment #13
megachrizOkay, enough tests failures fixed for D9 so far, let's remove
$defaultThemenow as that change is causing test failures on D8.8, which is already worked on in #3095636: Add defaultTheme in tests extending BrowserTestBase..Comment #15
megachrizCommitted most of #13. Issue remains open because there is still a test failure on a post update (see #12).
Comment #16
megachrizThe D9 test failure 'Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_unpublish_action" plugin does not exist.' happens in
EntityProcessorBase::calculateDependencies(). The following piece of code could cause that exception:This made me curious as what happens when you try to perform an import where a cleaning stage occurs, but you have an action configured that no longer exists? Then, bam! Fatal error! That's a bug, so I opened #3138185: Clean stage fails with fatal error when selected action for the 'update_non_existent' setting no longer exists for that.
Comment #17
megachrizWith #3138185: Clean stage fails with fatal error when selected action for the 'update_non_existent' setting no longer exists committed, all D9 test failures are fixed.