There currently is no test for the "Paths to be excluded while generating segments" (EXCLUDED_PATHS) config.

Command icon 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

loopduplicate created an issue. See original summary.

loopduplicate’s picture

Assigned: loopduplicate » Unassigned
Status: Active » Needs review
Issue tags: -Needs test
csakiistvan’s picture

Assigned: Unassigned » csakiistvan
csakiistvan’s picture

Assigned: csakiistvan » Unassigned
Status: Needs review » Reviewed & tested by the community

Environment

  • Drupal: 11.4.4
  • PHP: 8.5.5
  • Database: MariaDB 10.11.16
  • DDEV: v1.25.2
  • Easy Breadcrumb: 2.x-dev (2.x, commit c68c5f0)

Prerequisites

  • Easy Breadcrumb checked out on the 2.x branch inside a Drupal 11.4.4 site.
  • PHPUnit runnable against the site, e.g.:
    ddev exec 'cd web/core && SIMPLETEST_BASE_URL=http://web SIMPLETEST_DB=mysql://db:db@db/db BROWSERTEST_OUTPUT_DIRECTORY=/tmp ../../vendor/bin/phpunit -c phpunit.xml.dist <test-path>'
  • Confirm the coverage gap before the fix: grep -rn EXCLUDED_PATHS web/modules/contrib/easy_breadcrumb/tests/ returns no matches.

Steps

  1. Apply the fix from MR !207: it adds tests/src/Functional/EasyBreadcrumbExcludedPathsTest.php, a functional test that creates a node with the path alias /test and asserts the breadcrumb shows the page title as second segment with Paths to be excluded while generating segments empty, and that the segment disappears once test is excluded.
  2. Rebuild caches: ddev drush cr
  3. Run the new test and confirm it passes.
  4. Mutation check: temporarily disable the excluded-paths branch in src/EasyBreadcrumbBuilder.php (around line 521) so exclusions are never applied, and run the test again.
  5. Revert the change to EasyBreadcrumbBuilder.php and run the test a final time.

Expected results

  • The new test passes on unmodified 2.x.
  • With the excluded-paths branch disabled, the test fails — proving it genuinely covers the setting rather than passing vacuously.
  • After reverting, the test passes again.

Actual results

Before the fix no test referenced EXCLUDED_PATHS, so the "Paths to be excluded while generating segments" setting was completely uncovered. After applying MR !207 the new test ran green (1 test, 7 assertions; only pre-existing unrelated deprecation notices). Disabling the excluded-paths branch made it fail with Behat\Mink\Exception\ExpectationException: An element matching css "#block-breadcrumb li:nth-child(2)" appears on this page, but it should not., confirming the assertions are meaningful. Reverting the builder restored a green run.


Testing produced with the assistance of an LLM.

  • loopduplicate committed 37f52c47 on 2.x
    Issue: #3615347 Create test for EXCLUDED_PATHS config
    
    By: loopduplicate...
loopduplicate’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @csakiistvan

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

csakiistvan’s picture

Welcome loopduplicate :)

Status: Fixed » Closed (fixed)

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