Problem/Motivation

In #3611750: Move toolbar integration tests to toolbar module, part 1 I made incorrect namespaces in 5 test files and PhpUnitApiFindAllClassFilesTest.php failed on 11.x but not main.

The problem was discovered when creating an 11.x version for #3611749: Remove toolbar from tests where it is not needed.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3612498

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

quietone created an issue. See original summary.

quietone’s picture

longwave-bot made their first commit to this issue’s fork.

longwave’s picture

Status: Active » Needs review

Locally this finds two tests that aren't discovered.

godotislate’s picture

Status: Needs review » Needs work

Per #3619402-9: Fix olivero AjaxTest directory, let's fix NodeSearchTest here.

Namespace in the file is Drupal\Tests\search_node\Kernel\node.
Path to file is core/modules/search/modules/search_node/tests/src/node/Kernel/NodeSearchTest.php

I think we should change both and remove "node"?
namespace Drupal\Tests\search_node\Kernel
Path to file core/modules/search/modules/search_node/tests/src/Kernel/NodeSearchTest.php

This is probably soft-blocked on #3619402: Fix olivero AjaxTest directory.

longwave’s picture

Status: Needs work » Needs review

Rebased since the Olivero fix went in, fixed the node search test here on top, so this is green now.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Nice test addition. The entire test class is now taking very long to execute, maybe it could be split. But not necessarily here.

catch’s picture

Status: Reviewed & tested by the community » Needs review

Is the other method in this test doing anything at all given it's letting broken test classes slip through?

longwave’s picture

Status: Needs review » Reviewed & tested by the community

The other method is a smoke test that proves that different arguments to test discovery all return at least something. The new test doesn't check any arguments, it only requests "all tests" but then ensures that this matches what's found on the filesystem.

I think they are both worth keeping, the smoke test could be expanded to be more specific but perhaps in a followup.

mondrake’s picture

The other test is a remainder of when we were comparing results of the PHPUnit discovery vs Drupal own test discovery, which is now gone. Now it’s probably overkill as it is testing PHPUnit features, and PHPUnit has its own tests.

catch’s picture

Status: Reviewed & tested by the community » Needs review

@mondrake is that why it's failing in 11.x and passing in main? If so I think we should remove that here.

mondrake’s picture

What’s failing in 11.x? Is there a job to look at?

catch’s picture

@mondrake in 11.x it finds classes that don't match the namespace, like #3619402: Fix olivero AjaxTest directory, in main it doesn't. What this means is that several times we've committed MRs that move tests around and end up with a mis-matched namespace to main, then only found out when they were backported to 11.x

So 'failing' in the sense of working, in main it only ever seems to pass.

mondrake’s picture

Status: Needs review » Needs work

#14 yes. Since there’s no longer anything to compare against in main where the legacy discovery was removed, the old test is rather irrelevant. The new one readds a list of files to compare against, so it’s more effective. +1 to gut the old test at this point, it’s just confusing.

longwave’s picture

Status: Needs work » Needs review

I combined the tests so we cover both the "all tests" case and also a small subset (system module kernel tests in the Menu group).

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

👍

  • catch committed 07782db8 on main
    task: #3612498 PhpUnitApiFindAllClassFilesTest not finding namespace...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to main, 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.