Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
After
Comment | File | Size | Author |
---|---|---|---|
#8 | 2226183.7.patch | 8.29 KB | alexpott |
#7 | 2-7-interdiff.txt | 3.89 KB | alexpott |
#2 | 2226183.2.patch | 4.31 KB | alexpott |
#2 | 1-2-interdiff.txt | 545 bytes | alexpott |
#1 | 2226183.1.patch | 4.29 KB | alexpott |
Comments
Comment #1
alexpottThis 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 inDrupal\Tests\Core\Plugin\ConfigurablePluginBagTest
. To fix this I movedTestConfigurablePlugin
to its own autoloadable class.Comment #2
alexpottThe array addition was wrong.
Comment #4
BerdirNice, this looks good and highlights bad usage of "private" test classes within another test class as a bonus ;)
Comment #5
BerdirSorry, need to set this back to needs work. Apparently this breaks the output, the missing class name comes from this patch.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentednice find.
berdir++
alexpott++
Comment #7
alexpottPatch 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.
Comment #8
alexpottAnd now for the patch.
Comment #9
BerdirThanks, I think this looks good now. Verified the output locally and on testbot.
Comment #10
catchCommitted/pushed to 8.x, thanks!