There currently is no test for the "Use absolute path for Breadcrumb links" (ABSOLUTE_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

✅ Tested and works — MR !216, with one suggestion below.

Environment
  • Drupal: 11.4.4
  • PHP: 8.5.5
  • Database: MariaDB 10.11.16
  • DDEV: v1.25.2
  • Easy Breadcrumb: 2.x (commit 5bfef4e)
Prerequisites
  • Easy Breadcrumb checked out on a clean 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 ABSOLUTE_PATHS web/modules/contrib/easy_breadcrumb/tests/ returns no matches.
Steps
  1. Apply the fix from MR !216: it adds tests/src/Functional/EasyBreadcrumbAbsolutePathsTest.php, which enables Use absolute path for Breadcrumb links, visits /admin/structure and asserts the second breadcrumb link points at the absolute URL of /admin.
  2. Rebuild caches: ddev drush cr
  3. Run the new test and confirm it passes.
  4. Mutation check: temporarily replace the ABSOLUTE_PATHS condition in src/EasyBreadcrumbBuilder.php (line 668) with FALSE so links are never made absolute, and run the test again.
  5. Revert src/EasyBreadcrumbBuilder.php and run the test a final time.
Expected results
  • The new test passes on unmodified 2.x.
  • With the absolute-path 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 ABSOLUTE_PATHS, so the setting was completely uncovered. After applying MR !216 the new test ran green (1 test, 5 assertions; only pre-existing unrelated deprecation notices). With the condition forced to FALSE it failed with Behat\Mink\Exception\ElementNotFoundException: Element matching css "#block-breadcrumb li:nth-child(2) a[href="http://web/admin"]" not found., confirming the assertion is meaningful. Reverting the builder restored a green run. phpcs --standard=Drupal,DrupalPractice reports no issues on the test file.

Suggestion: the test only covers the enabled state. Adding the negative half — setting ABSOLUTE_PATHS to FALSE, reloading and asserting the same link renders as /admin rather than the absolute URL — would pin both directions and match the style of the other config tests in this series.


Testing produced with the assistance of an LLM.

greg boggs’s picture

csakiistvan,

I think, based on the "Suggestion:" part of your test, we should add that test and keep this needs work. What do you think?

csakiistvan’s picture

Status: Reviewed & tested by the community » Needs review

Good point Greg, i do this change and move the issue to Needs review

loopduplicate’s picture

Status: Needs review » Reviewed & tested by the community

  • loopduplicate committed 35c9426f on 2.x
    Issue: #3615999 Create test for ABSOLUTE_PATHS config
    
    By: loopduplicate...
loopduplicate’s picture

Thanks @csakiistvan and @greg-boggs :3

loopduplicate’s picture

Status: Reviewed & tested by the community » Fixed

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 :)