X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiIntegrationTestCase.php;h=b738312725904604248633bde1378587b68cbf2b;hb=1dcf5b66d33ebade1c5cc8d3b2803aa70c8bb958;hp=b1eb9effa73fb04036e5d03a6c80ff9ab51de5f0;hpb=bd7f24e8f86d1fe1db570edae50baf9f0557427f;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/MediaWikiIntegrationTestCase.php b/tests/phpunit/MediaWikiIntegrationTestCase.php index b1eb9effa7..b738312725 100644 --- a/tests/phpunit/MediaWikiIntegrationTestCase.php +++ b/tests/phpunit/MediaWikiIntegrationTestCase.php @@ -10,6 +10,7 @@ use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\IMaintainableDatabase; use Wikimedia\Rdbms\Database; use Wikimedia\TestingAccessWrapper; +use Wikimedia\Timestamp\ConvertibleTimestamp; /** * @since 1.18 @@ -182,8 +183,10 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { global $IP; parent::setUpBeforeClass(); if ( !file_exists( "$IP/LocalSettings.php" ) ) { - echo 'A working MediaWiki installation with a configured LocalSettings.php file is' - . ' required for tests that extend ' . self::class; + echo "File \"$IP/LocalSettings.php\" could not be found. " + . "Test case " . static::class . " extends " . self::class . " " + . "which requires a working MediaWiki installation.\n" + . ( new RuntimeException() )->getTraceAsString(); die(); } self::initializeForStandardPhpunitEntrypointIfNeeded(); @@ -584,6 +587,17 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { $this->tmpFiles = array_merge( $this->tmpFiles, (array)$files ); } + private static function formatErrorLevel( $errorLevel ) { + switch ( gettype( $errorLevel ) ) { + case 'integer': + return '0x' . strtoupper( dechex( $errorLevel ) ); + case 'NULL': + return 'null'; + default: + throw new MWException( 'Unexpected error level type ' . gettype( $errorLevel ) ); + } + } + protected function tearDown() { global $wgRequest, $wgSQLMode; @@ -649,14 +663,17 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { if ( $phpErrorLevel !== $this->phpErrorLevel ) { ini_set( 'error_reporting', $this->phpErrorLevel ); - $oldHex = strtoupper( dechex( $this->phpErrorLevel ) ); - $newHex = strtoupper( dechex( $phpErrorLevel ) ); + $oldVal = self::formatErrorLevel( $this->phpErrorLevel ); + $newVal = self::formatErrorLevel( $phpErrorLevel ); $message = "PHP error_reporting setting was left dirty: " - . "was 0x$oldHex before test, 0x$newHex after test!"; + . "was $oldVal before test, $newVal after test!"; $this->fail( $message ); } + // If anything faked the time, reset it + ConvertibleTimestamp::setFakeTime( false ); + parent::tearDown(); } @@ -1813,6 +1830,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { $pageTables = [ 'page', 'revision', 'ip_changes', 'revision_comment_temp', 'comment', 'archive', 'revision_actor_temp', 'slots', 'content', 'content_models', 'slot_roles', + 'change_tag', ]; $coreDBDataTables = array_merge( $userTables, $pageTables );