PHPUnit tests are run using the --filter option which means PHPUnit has to scan all the tests for each test run. We can just use the test class filename.

Running the Drupal\Tests\Core\Access\AccessManagerTest with run-tests.sh using --class

Before

After

Comments

alexpott’s picture

Status: Active » Needs review
StatusFileSize
new4.29 KB

This patch also exposed the fact that BlockConfigEntityUnitTest was incorrectly using Drupal\Tests\Core\Plugin\TestConfigurablePlugin which was only working because the --filter option includes all tests. This class was contained in Drupal\Tests\Core\Plugin\ConfigurablePluginBagTest. To fix this I moved TestConfigurablePlugin to its own autoloadable class.

alexpott’s picture

StatusFileSize
new545 bytes
new4.31 KB

The array addition was wrong.

The last submitted patch, 1: 2226183.1.patch, failed testing.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Nice, this looks good and highlights bad usage of "private" test classes within another test class as a bonus ;)

berdir’s picture

Status: Reviewed & tested by the community » Needs work

Sorry, need to set this back to needs work. Apparently this breaks the output, the missing class name comes from this patch.

Anonymous’s picture

nice find.

berdir++
alexpott++

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new3.89 KB

Patch attached fixes the output to match the current state of HEAD - it refactors the XML parsing to be able to deal with XML output from phpunit that runs a single test or uses --filter to run multiple tests since this is how the simpletest UI allows selection of PHPUnit tests. This patch also reduces the amount of XML parsed during each test run since the XML output is just for the single test each time instead of the full test suite.

alexpott’s picture

StatusFileSize
new8.29 KB

And now for the patch.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, I think this looks good now. Verified the output locally and on testbot.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

  • Commit bc7f7f3 on 8.x by catch:
    Issue #2226183 by alexpott: Running PHPUnit tests through run-tests.sh...

Status: Fixed » Closed (fixed)

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