phpunit: Avoid get_class() in MediaWikiCoversValidator
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 25 Jul 2019 22:38:50 +0000 (23:38 +0100)
committerKrinkle <krinklemail@gmail.com>
Thu, 25 Jul 2019 22:40:58 +0000 (22:40 +0000)
I notice that in CI, the inherited "testValidCovers" often shows
multiple times for test classes as being slow (50ms+).

E.g. from a quibble/php72 job:

> …
> 85ms to run ResourceLoaderWikiModuleTest:testValidCovers
> …

Bug: T225730
Change-Id: I524df134c52173c49ebb2b263a90bb5732255865

tests/phpunit/MediaWikiCoversValidator.php

index a79a139..ce3f2e2 100644 (file)
@@ -33,7 +33,7 @@ trait MediaWikiCoversValidator {
         */
        public function testValidCovers() {
                $methods = get_class_methods( $this );
-               $class = get_class( $this );
+               $class = static::class;
                $bad = '';
                foreach ( $methods as $method ) {
                        if ( strpos( $method, 'test' ) === 0 ) {