There currently is no test for the "Include invalid paths alias as plain-text segments" (INCLUDE_INVALID_PATHS) config.
Issue fork easy_breadcrumb-3614715
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
loopduplicate commentedComment #4
csakiistvanComment #5
csakiistvanEnvironment
c68c5f0, MR !195)Prerequisites
Pick alias segments that are unused on the site — if a segment such as
/testhappens to be a valid path, it is rendered as a link by the valid-path branch instead.Steps
tests/src/Functional/EasyBreadcrumbIncludeInvalidPathsTest.php, which places the breadcrumb block, creates a node with the alias/test/invalid/paths, enables the Include invalid paths alias as plain-text segments setting and asserts each of the four breadcrumb segments./admin/config/user-interface/easy-breadcrumb, visit/invalid/parent/pathsand observe the breadcrumb./invalid/parent/pathsand observe the breadcrumb again.src/EasyBreadcrumbBuilder.php(line 691) never add a segment, re-run both the new test and the pre-existing test suite, then restore the file.Expected results
2.xbranch./invalid/parent/pathsrenders Home › Test Page 1; with it enabled the invalid segments appear as plain text: Home › Invalid › Parent › Test Page 1.Actual results
The test does what it says. On the unmodified
2.xbranch it passes: 1 test, 6 assertions. The four reported deprecations are unrelated to this issue — they come from other contrib modules installed on the test site (paragraphs_module_implements_alterwithout the#[LegacyModuleImplementsAlter]attribute,Drupal\quick_node_clone\EventSubscriber\AddressEventSubscriber::getSubscribedEvents()) and from core/Twig itself.phpcswith theDrupalandDrupalPracticestandards reports no violations on the new file. In the browser the asserted behaviour matches: with the setting disabled the breadcrumb renders as Home › Test Page 1, and with it enabled the two invalid parent segments are rendered as plain text, Home › Invalid › Parent › Test Page 1 — capitalised and with the current page still last.The coverage gap the issue describes is real, and the new test closes it. Before the MR,
INCLUDE_INVALID_PATHSappeared only ineasy_breadcrumb.install,src/EasyBreadcrumbConstants.php,src/Form/EasyBreadcrumbGeneralSettingsForm.phpandsrc/EasyBreadcrumbBuilder.php— no test referenced it. Making the condition atsrc/EasyBreadcrumbBuilder.phpline 691 never fire leaves the whole pre-existing suite green (14 tests, 132 assertions, OK). The new functional test does fail under the same change (1 test, 5 assertions, 1 failure, on the second breadcrumb segment) and passes again once the file is restored.Scope note: the test relies on the alias
/test/invalid/pathshaving no valid parent paths, which holds on a freshly installed test site but not necessarily on an existing one — on the manual verification site/testwas an existing alias, so a different alias was used for the browser check. This does not affect the test itself, which runs on a clean Stark install. The test covers the default values of the related settings, which is consistent with the scope stated in the issue.Testing produced with the assistance of an LLM.
Comment #7
loopduplicate commentedThank you @csakiistvan
Comment #9
csakiistvanWelcome @loopduplicate :)