Follow-up to #2306407: Remove breadcrumb from page template.

The change there causes contrib tests using FieldUiTestTrait to fail.

Two things are needed I think:

- a separate change record to state that tests using FieldUiTestTrait need to be updated to enable the breadcrumb block
- documentation needs to be added to FieldUiTestTrait stating this too.

Eg, CommentNonNodeTest uses the trait, and does this:

  protected function setUp() {
    parent::setUp();
    $this->drupalPlaceBlock('system_breadcrumb_block');
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Status: Active » Needs review
FileSize
608 bytes
joachim’s picture

"ack -g TestTrait | ack -x breadcrumb" shows that only this trait looks at breadcrumbs.

joachim’s picture

As for the change record, can this be added to the CR for the issue that changed this, https://www.drupal.org/node/2410773 ?

joachim’s picture

Yup, added that to the CR for the other issue.

joachim’s picture

Not quite the whole story -- I forgot block module is no longer a core requirement.

Manuel Garcia’s picture

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

The docs seem clear to me, thanks!

webchick’s picture

The docs seem fine, but is it better to remove the dependency? It's certainly non-obvious that you would need that from the name.

joachim’s picture

Testing that the breadcrumb works is a part of testing Field UI is working correctly.

I guess one way to lessen the possibility of WTF further is to make the assertion for the breadcrumb optional by wrapping it in a check for block module & the breadcrumb block, and tweak the documentation in this patch slightly to say it's recommended to have the breadcrumb block enabled. Then core tests that use this trait can have the breadcrumb block, and contrib modules that use this trait can do so without having to worry about having the breadcrumb.

But it does mean they won't be fully testing their use of Field UI. I suppose it probably doesn't matter though -- if the breadcrumb works for core entities, it probably works for anything contrib can throw at it?

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Let's do #9. It seems sensible to check this before making an assertion on it.

kfitz’s picture

I've adjusted the wording in the documentation in the top of the file, and added a conditional to see if the block module and bread crumb block modules are enabled. However, I don't believe the strings I used to identify the modules are necessarily accurate, as I was not sure where to find them. Let me know how I can improve on this one (pardon the lack of interdiff, but the changes are quite minimal).

kfitz’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Component: documentation » field_ui.module
Status: Needs review » Needs work

Thanks for the patch!

With the code change, this is no longer just documentation, so I'm moving this to the Field UI component.

Also, a couple of things to fix in the patch:

  1. +++ b/core/modules/field_ui/src/Tests/FieldUiTestTrait.php
    @@ -9,6 +9,14 @@
    + *
    + * It's recommended that Test classes using this trait ensure the
    + * breadcrumb block is displayed (and thus will also need to
    + * enable block module).
    + * This can be done as follows in setUp():
    + * @code
    + * $this->drupalPlaceBlock('system_breadcrumb_block');
    + * @endcode
      */
    

    This is fairly clear, but:
    - It doesn't tell me why it's recommended. Maybe instead of saying it's recommended, it should tell me that if the breadcrumb block has been placed then breadcrumbs will be tested?
    - The formatting needs to be updated. The text should all wrap to just under 80 character lines.

  2. +++ b/core/modules/field_ui/src/Tests/FieldUiTestTrait.php
    @@ -48,8 +56,11 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi
    +    if(moduleExists('block_module') && moduleExists('system_breadcrumb_block')) {
    

    This is not right. system_breadcrumb_block is not a module, so the if() here will always fail and the link will never be tested.

The last submitted patch, 11: 2417517-11-FieldUiTestTrait-breadcrumb-requirement.patch, failed testing.

kfitz’s picture

Status: Needs work » Needs review
FileSize
1.32 KB
1.31 KB

Made changes to documentation note and updated string in the conditional.

Status: Needs review » Needs work

The last submitted patch, 15: 2417517-15-test-only.patch, failed testing.

kfitz’s picture

FileSize
1.36 KB
1.36 KB

Test was failing due to visibility of 'moduleExists' in FieldUiTestTrait. Switched to '\Drupal:;moduleHandler()->moduleExists', but I think there may be a bit of performance hit using this. Additionally, I've still not confirmed that 'breadcrumb' is in-fact the identifier for the Breadcrumb module, and I was not able to find the module for D8.

kfitz’s picture

Status: Needs work » Needs review
joachim’s picture

Status: Needs review » Needs work
+++ b/core/modules/field_ui/src/Tests/FieldUiTestTrait.php
@@ -48,8 +52,11 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi
+    if(\Drupal::moduleHandler()->moduleExists('block_module') && \Drupal::moduleHandler()->moduleExists('breadcrumb')) {

That's just checking the modules exist rather than that the breadcrumb block is there, no? We should be checking the block is present in the theme rather than modules.

Also, AFAICT there are no modules with either of those names. The breadcrumb block is probably provided by the system module.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joachim’s picture

Fixed the check for the breadcrumb test to check a) the block module is enabled and b) a breadcrumb block is present.

Also, spotted another place in the trait where breadcrumbs are tested.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

amateescu’s picture

Priority: Major » Normal
Status: Needs review » Reviewed & tested by the community

This was discussed during a major issue triage call and we think that it is not really major because contrib and custom tests have had more than a year to fix their tests.

However, the patch looks ready to go :)

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Should we have a test that uses the fielduitesttrait without the block module installed in core? Then we can be sure that we don't break this in the future and know that the dependency is truly removed?

joachim’s picture

I don't think this needs tests. It just needs documentation: 'this test trait requires X Y Z in order to function correctly'.

> know that the dependency is truly removed?

That's a separate problem from this issue, surely.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.