Problem/Motivation

I was excited this morning that the i18n menu links patch was committed but later I was getting this error when working on commerce migrate.
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber' does not have a method 'onRouteMatch' in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 111 of core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php).
I tried enabling content_translation and, sure enough, the error went away.

During the long work to get i18n menu links done I often said to myself that the migration needed to move to content_translation, but I always didn't remember when at the keyboard. Sorry!

Just like d6_taxonomy_term_translation.yml d6_menu_links_translation.yml should be in content_translation, which should fix this problem.

There is a second part, in the the source plugin for both should also be in content_translation. The reason for that is because migrate_drupal_ui will use the source_module in the source plugin and then include that source_module in the list, which is should not.

Proposed resolution

At minimum, move d6_menu_links_translation.yml to content_translation

Remaining tasks

Write a patch
commit

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

quietone’s picture

Title: i18n translation in wrong directory » i18n menu links translation in wrong directory

Add menu links to title

jofitz’s picture

Status: Active » Needs review
FileSize
351 bytes

Moved d6_menu_links_translation.yml to content_translation.

Will this require any form of test?

Status: Needs review » Needs work

The last submitted patch, 3: 2960013-3.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
8.69 KB
9.03 KB
365 bytes

Jo Fitzgerald, thanks. Yes, it probably does need a test. So, here is a test and a fail patch.

The last submitted patch, 5: 2960013-5-fail.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 5: 2960013-5.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
9.8 KB
576 bytes

And the migration test needs to enable content_translation.

jofitz’s picture

@quietone You're a star!

mikeryan’s picture

Assigned: Unassigned » mikeryan
mikeryan’s picture

Assigned: mikeryan » Unassigned
Status: Needs review » Needs work

Just saw a couple minor comment issues.

  1. +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradei18nReviewPageTestBase.php
    @@ -0,0 +1,126 @@
    +  public static $modules = ['migrate_drupal_ui'];
    +  /**
    

    Should be a blank line here.

  2. +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradei18nReviewPageTestBase.php
    @@ -0,0 +1,126 @@
    +   * example modules. This means that we can test that the modules listed in the
    +   * the $noUpgradePath property of the update form class are correct, since
    

    Double "the".

quietone’s picture

Status: Needs work » Needs review
FileSize
9.8 KB
1.48 KB

@mikeryan, thanks for the review.

11.1 and 11.2 fixed.

mikeryan’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradei18nReviewPageTestBase.php
@@ -0,0 +1,127 @@
+  /**
+   * Tests the migrate upgrade review form.
+   *
+   * The upgrade review form displays a list of modules that will be upgraded
+   * and a list of modules that will not be upgraded. This test is to ensure
+   * that the review page works correctly for all contributed Drupal 6 and
+   * Drupal 7 modules that have moved to core, e.g. Views, and for modules that
+   * were in Drupal 6 or Drupal 7 core but are not in Drupal 8 core, e.g.
+   * Overlay.
+   *
+   * To do this all modules in the source fixtures are enabled, except test and
+   * example modules. This means that we can test that the modules listed in the
+   * $noUpgradePath property of the update form class are correct, since there
+   * will be no available migrations which declare those modules as their source
+   * module. It is assumed that the test fixtures include all modules that have
+   * moved to or dropped from core.
+   *
+   * The upgrade review form will also display errors for each migration that
+   * does not have a source_module definition. That function is not tested here.
+   *
+   * @see \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase
+   */
+  public function testMigrateUpgradeReviewPage() {

This is copied from \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeReviewPageTestBase::testMigrateUpgradeReviewPage() is there anyway we can refactor to share more code?

quietone’s picture

Status: Needs review » Needs work

Yes, it can be refactored but I was hoping to do that in a separate issue but can do here.

quietone’s picture

Status: Needs work » Needs review
FileSize
13.2 KB
16.59 KB

Did some refactoring to simplify the tests. The main points are that the declaration of all the modules to enable has been moved out of the test base classes. That should help anyone in contrib extending these tests. Hope it is enough.

Another was to extend the new MigrateUpgradei18nReviewPageTest from MigrateUpgradeReviewPageTest so that they could share a chunk of code in a new helper method, prepare(). Ideally that should go in setup() but it needs the source database which isn't loaded yet. I didn't work at that because I didn't want to get too far out of scope.

Let's see how this goes.

Edit: fix grammar and formatting

alexpott’s picture

Looks good to me. Thanks @quietone.

mikeryan’s picture

Status: Needs review » Reviewed & tested by the community
mikeryan’s picture

Assigned: Unassigned » mikeryan
Status: Reviewed & tested by the community » Needs review
mikeryan’s picture

Assigned: mikeryan » Unassigned
Status: Needs review » Needs work
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradei18nReviewPageTestBase.php
@@ -0,0 +1,45 @@
+ * Provides a base class for testing Uprade review form without translations.

Typo: "Uprade". And, I think there should be a "the" before upgrade.

Not sure it should be capitalized?

Other than that comment, looks good.

quietone’s picture

Status: Needs work » Needs review
FileSize
13.17 KB
721 bytes

@alexpott, your welcome.

Added the suggested changes in #20 and the summary line was > 80 so I removed the beginning phrase.

mikeryan’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradei18nReviewPageTestBase.php
@@ -0,0 +1,45 @@
+ * Tests the uprade review form without translations.

Ummm...

But, that can be fixed on commit...

quietone’s picture

Yea, sorry I stared at it for a bit and nothing better came forth.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Fixed uprade on commit. I also fixed the capitalisation of i18n in class names to follow our camel case format. So MigrateUpgrade6i18nReviewPageTest becomes MigrateUpgrade6I18nReviewPageTest because if we not using the shorthand this would be Internationalisation.

Committed and pushed 9f76972c25 to 8.6.x and b80873dcf5 to 8.5.x. Thanks!

  • alexpott committed 9f76972 on 8.6.x
    Issue #2960013 by quietone, Jo Fitzgerald, mikeryan, alexpott: i18n menu...

  • alexpott committed b80873d on 8.5.x
    Issue #2960013 by quietone, Jo Fitzgerald, mikeryan, alexpott: i18n menu...

  • alexpott committed 6e5d6e3 on 8.5.x
    Revert "Issue #2960013 by quietone, Jo Fitzgerald, mikeryan, alexpott:...
heddn’s picture

Does this need to be back ported to 8.5? It is a bug and our test coverage between 8.5 and 8.6 is effected on commerce migrate.

heddn’s picture

alexpott’s picture

@heddn yeah I originally backported this but it has BC implications - as your test proves.

Status: Fixed » Closed (fixed)

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