There currently is no test for the "Limit breadcrumb trail segments" (LIMIT_SEGMENT_DISPLAY) 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 LIMIT_SEGMENT_DISPLAY web/modules/contrib/easy_breadcrumb/tests/ returns no matches.

Steps

  1. Apply the fix from MR !208: it adds tests/src/Functional/EasyBreadcrumbLimitSegmentDisplayTest.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 Limit breadcrumb trail segments disabled, and that the segment disappears once the setting is enabled.
  2. Rebuild caches: ddev drush cr
  3. Run the new test and confirm it passes.
  4. Mutation check: temporarily disable the segment-trimming branch in src/EasyBreadcrumbBuilder.php (around line 729) so the limit is 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 segment-trimming 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 LIMIT_SEGMENT_DISPLAY, so the "Limit breadcrumb trail segments" setting was completely uncovered. After applying MR !208 the new test ran green (1 test, 7 assertions; only pre-existing unrelated deprecation notices). Disabling the trimming 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 7b6d8146 on 2.x
    Issue: #3615350 Create test for LIMIT_SEGMENT_DISPLAY config
    
    By:...
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.