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

MegaChriz created an issue. See original summary.

megachriz’s picture

Added link to parent issue.

megachriz’s picture

Issue summary: View changes

The error Error: Class 'Doctrine\Common\Inflector\Inflector' not found is caused by that Drupal core removed doctrine/common as a dependency for Drupal 9. This library depended on doctrine/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.

megachriz’s picture

Status: Active » Needs work
StatusFileSize
new686 bytes

This adds a dependency on "doctrine/inflector".

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.54 KB

I think that this patch also fixes the \Drupal::$container is not initialized yet. error.

megachriz’s picture

StatusFileSize
new2.88 KB
new610 bytes

I 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.

megachriz’s picture

StatusFileSize
new6.13 KB
new3.25 KB

Temporary added $defaultTheme here 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.

Status: Needs review » Needs work

The last submitted patch, 7: feeds-d9-test-failures-3129114-7.patch, failed testing. View results

megachriz’s picture

StatusFileSize
new17.5 KB
new11.38 KB

This 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.

megachriz’s picture

Issue summary: View changes
megachriz’s picture

StatusFileSize
new21.3 KB
new3.8 KB
megachriz’s picture

Issue summary: View changes
StatusFileSize
new21.59 KB
new603 bytes

The following test failure seems a bit harder to fix, so leaving that one out for now:

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.
megachriz’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new19.29 KB
new2.31 KB

Okay, enough tests failures fixed for D9 so far, let's remove $defaultTheme now as that change is causing test failures on D8.8, which is already worked on in #3095636: Add defaultTheme in tests extending BrowserTestBase..

  • MegaChriz committed bea701c on 8.x-3.x
    Issue #3129114 by MegaChriz: Fixed some Drupal 9 test failures.
    
megachriz’s picture

Committed most of #13. Issue remains open because there is still a test failure on a post update (see #12).

megachriz’s picture

Status: Needs review » Needs work

The 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:

$definition = \Drupal::service('plugin.manager.action')->getDefinition($this->getConfiguration('update_non_existent'));
if (isset($definition['provider'])) {
  $this->addDependency('module', $definition['provider']);
}

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.

megachriz’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.