There currently is no test for the "Use site title as the front page segment" (USE_SITE_TITLE) 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 USE_SITE_TITLE web/modules/contrib/easy_breadcrumb/tests/ returns no matches.

Steps

  1. Apply the fix from MR !204: it adds tests/src/Functional/EasyBreadcrumbUseSiteTitleTest.php, a functional test that sets a custom site name and asserts the first breadcrumb segment is Home with Use site title as the front page segment disabled, and the site name once the setting is enabled.
  2. Rebuild caches: ddev drush cr
  3. Run the new test and confirm it passes.
  4. Mutation check: temporarily force the home-segment branch in src/EasyBreadcrumbBuilder.php (around line 708) to always use the configured home segment title, 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 site-title branch bypassed, 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 USE_SITE_TITLE, so the "Use site title as the front page segment" setting was completely uncovered. After applying MR !204 the new test ran green (1 test, 5 assertions; only pre-existing unrelated deprecation notices). Bypassing the site-title branch made it fail with Behat\Mink\Exception\ElementHtmlException: The string "Test Site Name" was not found in the HTML of the element matching css "#block-breadcrumb li:first-child"., confirming the assertions are meaningful. Reverting the builder restored a green run.


Testing produced with the assistance of an LLM.

  • loopduplicate committed 72498e90 on 2.x
    Issue: #3615280 Create test for USE_SITE_TITLE 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.