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.
Currently takes ~400ms on the test overview page, 27% of the whole page request.
We have to cache this.
Should be quite simple if you know a bit about caching, just check the cache first with $cache = Drupal::cache()->get('simpletest_phpunit') or something like that, return $cache-data if you get something, write the $test_classes result into the cache at the end.
Comment | File | Size | Author |
---|---|---|---|
#9 | cache_available_tests-2059313-9.patch | 2.71 KB | StephaneQ |
#9 | cache_available_tests-2059313-9.interdiff.txt | 1.21 KB | StephaneQ |
#5 | cache_available_tests-2059313-5.patch | 2.5 KB | giammi |
#5 | cache_available_tests-2059313-5.interdiff.txt | 711 bytes | giammi |
#2 | cache_available_tests-2059313-2.patch | 2.5 KB | StephaneQ |
Comments
Comment #1
BerdirShould be possible to handle for Novice core contributors that know a tiny bit about the caching API :)
Comment #2
StephaneQLet's try with this patch.
Comment #3
StephaneQComment #4
BerdirNot related, but that uppercase AS is weird, let's fix that while we touch this.
Code changes look good.
Comment #5
giammi CreditAttribution: giammi commentedtrying
Comment #6
BerdirGreat, makes the test overview page quite a bit faster!
Comment #7
catchThis doesn't match core code style, see http://drupal.org/coding-standards
Also wondering whether this is desirable - what if I add a new PHPUnit test, do I need to flush caches then?
Comment #8
BerdirOuch.
That you have to clear caches if you add a new tests is already the case for Simpletest. However, we probably need to add a specific cache delete to the clear environment button at the bottom.
Comment #9
StephaneQFixed the coding style errors and added the cache delete
Comment #10
BerdirOk, manually verified that the clean environment button works, a newly added unit tests doesn't show up immediately (again, only in the UI, directly using phpunit works just fine and the UI for phpunit tests is broken anway) but they do after you click in Clean environment, same as with Simpletest tests.
Comment #11
catchCommitted/pushed to 8.x, thanks!
Comment #12
msonnabaum CreditAttribution: msonnabaum commentedIt seems a little crazy to me to cache this, but hopefully it just encourages people to use use phpunit on the cli instead of simpletest as the test runner.
Comment #13
BerdirThe UI integration is already pretty much broken, you can't re-test something for example and there are no useful results. That's the bigger incentive to use the CLI runner.
I'd almost go as far as to suggest to remove the UI integration completely, replace it with a link to @dawehner's tutorial on how to integrate it with PhpStorm. (The last part is a joke, the first not ;))