There currently is no test for the "Include the front page as a segment in the breadcrumb" (INCLUDE_HOME_SEGMENT) 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 (c68c5f0, MR !198)
  • Browser: Chrome

Prerequisites

  • Enable the module:
    ddev drush en easy_breadcrumb -y
  • Use an admin theme that renders the breadcrumb block, for example Claro:
    ddev drush config:set system.theme admin claro -y
  • This is a test-only issue, so there is no user-facing behaviour change. The behaviour asserted by the new test was verified manually in the browser as well.

Steps

  1. Apply the fix from MR !198: it adds the functional test tests/src/Functional/EasyBreadcrumbIncludeHomeSegmentTest.php, which places the breadcrumb block, toggles the Include the front page as a segment in the breadcrumb setting on and off, and asserts the first breadcrumb segment on /admin.
  2. Rebuild caches:
    ddev drush cr
  3. Run the new test:
    ddev exec 'cd /var/www/html/web && ../vendor/bin/phpunit -c core/phpunit.xml.dist modules/contrib/easy_breadcrumb/tests/src/Functional/EasyBreadcrumbIncludeHomeSegmentTest.php'
  4. Check the coding standards of the new file:
    ddev exec 'cd /var/www/html && vendor/bin/phpcs --standard=Drupal,DrupalPractice web/modules/contrib/easy_breadcrumb/tests/src/Functional/EasyBreadcrumbIncludeHomeSegmentTest.php'
  5. Verify the same behaviour manually: enable the Include the front page as a segment in the breadcrumb setting at /admin/config/user-interface/easy-breadcrumb, then visit /admin and observe the breadcrumb.
  6. Disable the setting, revisit /admin and observe the breadcrumb again.
  7. Confirm the test really covers the configuration: temporarily invert the home-segment condition in src/EasyBreadcrumbBuilder.php and re-run the test, then restore the file.

Expected results

  • The new test passes on the current 2.x branch.
  • The new file has no coding standards violations.
  • With the setting enabled, the breadcrumb on /admin starts with the Home segment; with it disabled, the first segment is Administration.
  • The test fails when the home-segment logic in the breadcrumb builder is broken, proving it is not a vacuous test.

Actual results

The test does what it says. On the unmodified 2.x branch it passes: 1 test, 6 assertions. The four reported deprecations are unrelated to this issue — they come from other contrib modules installed on the test site (paragraphs_module_implements_alter without the #[LegacyModuleImplementsAlter] attribute, Drupal\quick_node_clone\EventSubscriber\AddressEventSubscriber::getSubscribedEvents()) and from core/Twig itself. phpcs with the Drupal and DrupalPractice standards reports no violations on the new file. In the browser the asserted behaviour matches: with Include the front page as a segment in the breadcrumb enabled the breadcrumb on /admin renders as Home › Administration, and with it disabled only the unlinked Administration segment remains. The test is also genuinely sensitive to the configuration: inverting the INCLUDE_HOME_SEGMENT condition in src/EasyBreadcrumbBuilder.php (line 701) makes it fail on the first assertion (1 failure, 5 assertions), and it passes again once the file is restored. The new test covers only the /admin path with default values for the related settings (HOME_SEGMENT_TITLE, USE_SITE_TITLE, HIDE_SINGLE_HOME_ITEM), which is consistent with the scope stated in the issue.

Note that the breadcrumb block is not visible in the Gin admin theme when core's Navigation module is enabled, so the manual verification was done with Claro as the admin theme. This does not affect the test, which runs on Stark.


Testing produced with the assistance of an LLM.

  • loopduplicate committed 9ded0c37 on 2.x
    Issue: #3614760 Create test for INCLUDE_HOME_SEGMENT configuration.
    
    By...
loopduplicate’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @csakiistvan :3

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

@loopduplicate Welcome :)

Status: Fixed » Closed (fixed)

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