Problem/Motivation

/**
 * Tests access to user autocompletion and verify the correct results.
 */
function testUserAutocomplete() {
  $this->drupalLogin($this->account);
  $this->drupalGet('user/autocomplete', array('query' => array('q' => $this->account->getUsername())));
  $this->assertRaw($this->account->getUsername());
  $this->assertNoText('registry initialized', 'The registry was not initialized');
}

The path user/autocomplete does not exist in Drupal 8 for a long time. The test still passes because user/autocomplete is found in drupalSettings.path.currentQuery.

Steps to reproduce

Proposed resolution

Search for all remaining usages of the route or string and decide what to do with each one.

Remaining tasks

Patch
Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-2787273

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

Chi created an issue. See original summary.

chi’s picture

Status: Active » Needs review
StatusFileSize
new663 bytes

The test will fail now.

chi’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: system_fast_test-2787273-2.patch, failed testing.

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.

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.

smustgrave’s picture

Issue tags: +Bug Smash Initiative

Still valid in 9.5

Would the proposed solution be to remove the test completely?

ameymudras’s picture

Version: 9.4.x-dev » 9.5.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.36 KB

I think it makes sense to delete the test altogether in this case. Ive included a very basic patch for the same

smustgrave’s picture

Can I ask though why we wouldn't replace it though?

What was this originally testing? Should we still test that?

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

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now 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.

smustgrave’s picture

Status: Needs review » Needs work

Needs a reroll but appears to be dead code maybe?

_utsavsharma’s picture

StatusFileSize
new1.43 KB
new1.43 KB

Rerolled for 10.1.x.

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Pretty convinced this is deadcode but will see what the committers say.

quietone’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

The route 'user.autocomplete' was removed in Drupal 8.0.x #2434697: Remove UserAutocompleteController.

There is another instance of the string 'user/autocomplete'. That should be investigated here as well.

$ git grep 'user.autocomplete' | grep -v drupal[6-7].php
core/modules/node/tests/src/Functional/NodeCreationTest.php:    $this->assertSession()->elementNotExists('xpath', '//input[@id="edit-uid-0-value" and contains(@data-autocomplete-path, "user/autocomplete")]');
core/modules/system/tests/src/Functional/Theme/FastTest.php:    $this->drupalGet('user/autocomplete', ['query' => ['q' => $this->account->getAccountName()]]);

Version: 10.1.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, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mstrelan made their first commit to this issue’s fork.

mstrelan’s picture

#22 - The other reference to user/autocomplete was removed in #3511071: NodeCreationtest::testAuthorAutocomplete has incorrect selector for falsey check

I've created an MR to remove the test. But kind of agree with #17:

What was this originally testing? Should we still test that?

Good question. The test was meant to ensure that the theme registry was not initialized when making a request to the autocomplete route. The theme_test module has an event subscriber that throws a "registry initialized" exception if the theme registry is initialized. This currently only applies to the 'system.entity_autocomplete' route but previously applied to 'user.autocomplete' and 'user.autocomplete_anonymous', before #2434697: Remove UserAutocompleteController. I'm not sure if there is any test that's checking for that exception, so perhaps that should be removed too? Or we refactor FastTest to use the 'system.entity_autocomplete' route instead.

mstrelan’s picture

Status: Needs work » Needs review

I did some more digging. We can use 'system.entity_autocomplete' in the test like so:

$this->drupalLogin($this->account);
$selection_settings_key = Crypt::hmacBase64(serialize([]) . 'userdefault', Settings::getHashSalt());;
\Drupal::keyValue('entity_autocomplete')->set($selection_settings_key, []);
$this->drupalGet('/entity_reference_autocomplete/user/default/' . $selection_settings_key, [
  'query' => [
    'q' => $this->account->getAccountName(),
  ],
]);

However we never enter ThemeTestSubscriber::onView so the exception is never thrown anyway.

I think we can just remove the test.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @mstrelan for digging into that! Agree with your findings.

catch’s picture

Status: Reviewed & tested by the community » Needs review

The theme_test module has an event subscriber that throws a "registry initialized" exception if the theme registry is initialized.

Does that event subscriber also need to be removed from theme_test module then?

mstrelan’s picture

Removed the onView part of the event subscriber. Adding a related issue too.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Feedback from @catch appears to be addressed.

oily made their first commit to this issue’s fork.

  • catch committed 1481d991 on 11.x
    Issue #2787273 by mstrelan, _utsavsharma, chi, ameymudras, smustgrave,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

I think the overall assessment that this test never worked, can't test what it's trying to and should just go makes sense. Maybe we theoretically might have some test coverage missing, but that's already been the case for several years and we'd need to start writing the test again from scratch, in which case the current test does not help with that. Committed/pushed to 11.x, thanks!

Status: Fixed » Closed (fixed)

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