Problem/Motivation

Discovered while working on #3317769: Add support for linking to entities in CKEditor 5.

Steps to reproduce

See #2.

Proposed resolution

Re-enable path_alias.path_processor in our kernel test — see #3.

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

StatusFileSize
new967 bytes
wim leers’s picture

Assigned: wim leers » Unassigned
Issue summary: View changes
Status: Active » Needs review
Related issues: +#2304461: KernelTestBaseTNG™
StatusFileSize
new1.11 KB
new2.02 KB
+++ b/tests/src/Kernel/AssertLinkitFilterTrait.php
@@ -38,6 +38,8 @@ trait AssertLinkitFilterTrait {
+    $canonical_url_aka_not_path_alias = '/entity_test_mul/manage/1';
+    $this->assertStringNotContainsString($canonical_url_aka_not_path_alias, $this->process($input, $langcode)->getProcessedText());

Even though the test appears to claim to be testing that the filter puts the correct alias in place during filtering … that's not actually happening! 😅

This is caused by

    if ($container->hasDefinition('path_alias.path_processor')) {
      // The alias-based processor requires the path_alias entity schema to be
      // installed, so we prevent it from being registered to the path processor
      // manager. We do this by removing the tags that the compiler pass looks
      // for. This means that the URL generator can safely be used within tests.
      $container->getDefinition('path_alias.path_processor')
        ->clearTag('path_processor_inbound')
        ->clearTag('path_processor_outbound');
    }

in \Drupal\KernelTests\KernelTestBase::register(), which has been in place since KernelTestBase was introduced in #2304461: KernelTestBaseTNG™!

The solution is simple: undo that, because it's an assumption that is not a problem for this particular test, since we do install path_alias' entity schema.

The last submitted patch, 2: 3350223-2-FAIL.patch, failed testing. View results

wim leers’s picture

Issue summary: View changes

Note that this bug has only remained hidden for all these years because too much in the test was generated/computed. With more explicit expectations defined, this could never have happened.

As part of working on #3317769: Add support for linking to entities in CKEditor 5, I was hardening the test coverage, and that's how I discovered this. See that MR for a comprehensive strengthening of this module's filter kernel test.

Status: Needs review » Needs work

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

wim leers’s picture

Status: Needs work » Needs review

The failure is unrelated:

There was 1 failure:

1) Drupal\Tests\linkit\FunctionalJavascript\LinkitDialogCKEditor5Test::testLinkDialog
Failed asserting that a NULL is not empty.
mark_fullmer’s picture

Assigned: Unassigned » mark_fullmer

The failure is unrelated:

I was getting a similar (but different assertion) false failure in https://www.drupal.org/project/linkit/issues/3232190#comment-14898179

Assigning myself for review!

wim leers’s picture

I just realized that's probably due to #3344083: Update CKEditor 5 to 36.0.1 landing earlier today!

So, re-testing this against 10.0.x, then it should pass 🤓

wim leers’s picture

Looks like my hunch was correct 🥳

rajeshreeputra’s picture

In 10.0.7 CKEditor5 major upgrade to v36 has been now reverted .

mark_fullmer’s picture

Status: Needs review » Reviewed & tested by the community

// Undo what the parent did, to allow testing path aliases in kernel tests.

This comment clarifies what's going on here, so I think it's clear to our future selves why we're doing this :) . I also ran the tests against 9.5.x just to be sure after the 9.5.6/9.5.7 hullabaloo. Everything looks good!

mark_fullmer’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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