Problem/Motivation

Discovered as a side effect of #3291519: Fix remaining method.notFound PHPStan L0 errors

class ClaroMenuUiJavascriptTest extends MenuUiJavascriptTest {
...
  /**
   * Intentionally empty method.
   *
   * Contextual links do not work in admin themes, so this is empty to prevent
   * this test running in the parent class.
   */
  public function testBlockContextualLinks(): void {
  }

MenuUiJavascriptTest has only testBlockContextualLinks() as a test method, so this test is testing nothing at all.

Steps to reproduce

Proposed resolution

Delete the test?

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3568285

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

longwave created an issue. See original summary.

longwave’s picture

Confirmed locally

PHPUnit 11.5.44 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.1
Configuration: /var/www/html/drupal/core/phpunit.xml.dist

.                                                                   1 / 1 (100%)

Time: 00:04.726, Memory: 6.00 MB

OK (1 test, 1 assertion)

The one assertion is asserting that the test modules were installed correctly. If I comment that out in FunctionalTestSetupTrait:

PHPUnit 11.5.44 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.1
Configuration: /var/www/html/drupal/core/phpunit.xml.dist

R                                                                   1 / 1 (100%)

Time: 00:04.874, Memory: 6.00 MB

There was 1 risky test:

1) Drupal\FunctionalJavascriptTests\Theme\ClaroMenuUiJavascriptTest::testBlockContextualLinks
This test did not perform any assertions

/var/www/html/drupal/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php:42

OK, but there were issues!
Tests: 1, Assertions: 0, Risky: 1.
longwave’s picture

Status: Active » Needs review

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Pretty straight forward.

  • catch committed 5a7deec5 on 11.x
    task: #3568285 ClaroMenuUiJavascriptTest does nothing
    
    By: longwave
    (...

  • catch committed b65925cc on main
    task: #3568285 ClaroMenuUiJavascriptTest does nothing
    
    By: longwave
    
catch’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

I looked into the git history.

MenuUiJavascriptTest was added in 2018 with the one test method and a couple of helper methods.

ClaroMenuUiJavascriptTest was added with the initial commit of Claro in 2019.

My guess is someone subclassed a load of tests into Claro, realised this method was irrelevant, no-one realised the entire test was irrelevant until now.

Committed/pushed to main and 11.x, thanks!

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.

Status: Fixed » Closed (fixed)

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