There currently is no test for the "Do not check for path, that is duplicate of home page." (HOME_SEGMENT_VALIDATION_SKIP) config.
Issue fork easy_breadcrumb-3615358
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 #4
tribekk commentedOpened MR !211.
Adds a functional test for a breadcrumb path with an intermediate segment that resolves to the configured front page. It covers both the default behavior and HOME_SEGMENT_VALIDATION_SKIP enabled.
Checked locally:
- php -l tests/src/Functional/EasyBreadcrumbHomeSegmentValidationSkipTest.php
- composer validate --no-check-publish
- git diff --check
Comment #6
csakiistvan@tribekk the test needed two small fixes — the pipeline failure is reproducible locally and is caused by the test itself, not by the module. I pushed them to the MR branch; details below.
Environment
Prerequisites
2.xbranch inside a Drupal 11.4.4 site.grep -rn HOME_SEGMENT_VALIDATION_SKIP web/modules/contrib/easy_breadcrumb/tests/returns no matches.Steps
tests/src/Functional/EasyBreadcrumbHomeSegmentValidationSkipTest.php, a functional test that makes a node aliased/front-pagethe site front page, adds a child node aliased/front-page/child-page, and asserts the intermediate segment is dropped by default but kept once Do not check for path, that is duplicate of home page is enabled.ddev drush crHOME_SEGMENT_VALIDATION_SKIPbranch insrc/EasyBreadcrumbBuilder.php(around line 1004) and run the test again.EasyBreadcrumbBuilder.phpand run the test a final time.Expected results
2.x.HOME_SEGMENT_VALIDATION_SKIPbranch disabled, the test fails — proving it genuinely covers the setting.Actual results
The MR as committed fails, both in the
phpunitCI job and locally:Behat\Mink\Exception\ElementHtmlException: The string "Child page" was not found in the HTML of the element matching css "#block-breadcrumb li:nth-child(2)".Two problems in the test:system.site page.frontis set to$front_page->toUrl()->getInternalPath(), which returnsnode/1without the leading slash. Drupal stores this setting with a leading slash, andEasyBreadcrumbBuildercompares the processed path against it, so the front-page exclusion never matches. With the raw value the breadcrumb is identical (Home / Front Page / Child Page) whether the setting is on or off, so the test could not cover the config at all. Using'/' . $front_page->toUrl()->getInternalPath()produces the intended difference: Home / Child Page by default, Home / Front Page / Child Page with the setting enabled.With those two changes applied locally, the test passes on unmodified
2.x(1 test, 5 assertions; only pre-existing unrelated deprecation notices), and fails withElementHtmlException: The string "Front Page" was not found ...once theHOME_SEGMENT_VALIDATION_SKIPbranch is disabled — so the scenario itself is right and covers the config.phpcs --standard=Drupal,DrupalPracticereports no issues on the test file.Testing produced with the assistance of an LLM.
Comment #7
loopduplicate commentedComment #10
loopduplicate commentedComment #12
loopduplicate commented