Problem/Motivation

If a test class specifies a requirement that is not fulfilled, PHPUnit just returns with success and 'No tests executed!'.

For example, core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php specifies #[RequiresPhpExtension('apcu')] which is not installed on my locale.

Steps to reproduce

Run

php -d memory_limit=1G core/scripts/run-tests.sh  --verbose --sqlite :memory: --color --types PHPUnit-Kernel Cache

on a machine that has no apcu extension installed.

Proposed resolution

For the purpose of run-tests.sh, this is something that need attention, so fail the test as we do for example for deprecations or warnings.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3579253

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

mondrake created an issue. See original summary.

mondrake changed the visibility of the branch 3579253-run-tests.sh-does-not to hidden.

mondrake’s picture

Status: Active » Needs review
mondrake’s picture

Title: run-tests.sh does not process properly outcome of PHPUnit when no test are executed for a class » run-tests.sh does not properly process PHPUnit output when no test are executed for a class
jonathan1055’s picture

Adding to meta parent issue #2626986: [meta] Improvements to run-tests.sh

I've not looked at the MR changes, but is there going to be any conflict with #3536964: run-tests.sh - segregate command line parsing and use Symfony Console classes ? and if so, are we still working primarily on that one? I can try to test here, but won't do that just yet if this is going to be postponed.

mondrake’s picture

Unfortunately run-tests.sh related patches drag on for months, so individually sometimes they tend to overlap one on another.

I have not checked on this one specifically - what I can say is that this one is a bug, whereas the command line refactoring is a feature request.

mondrake’s picture

rebased

smustgrave’s picture

Dumb question what's a good way to test?

php -d memory_limit=1G core/scripts/run-tests.sh --verbose --sqlite :memory: --color --types PHPUnit-Kernel Cache

I get ERROR: Test group not found: Cache with and without the MR.

mondrake’s picture

Probably now it should be

Run

php -d memory_limit=1G core/scripts/run-tests.sh  --verbose --sqlite :memory: --color --types kernel Cache

on a machine that has no apcu extension installed.

The important part is a machine that has no apcu extension installed: that's the situation that happened to me.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

okay did some googling and believe I correctly got apcu out using apc.enabled=0and see the issue you reported.

I believe this does address it. Going to go on a limb at least.

alexpott’s picture

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

Committed f9b616d and pushed to main and 11.x. Thanks!

I resolved the conflicts on 11.x to backport and ran the test locally.

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.

  • alexpott committed 89337e25 on 11.x
    fix: #3579253 run-tests.sh does not properly process PHPUnit output when...

  • alexpott committed f9b616d5 on main
    fix: #3579253 run-tests.sh does not properly process PHPUnit output when...

Status: Fixed » Closed (fixed)

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