Skip to content

Commit

Permalink
Remove version_compare check
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Feb 7, 2025
1 parent 45e06c0 commit a62a8f5
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions tests/phpunit/DPLIntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ abstract class DPLIntegrationTestCase extends MediaWikiIntegrationTestCase {
/** @var Status */
private $importStreamSource;

/**
* Guard condition to ensure we only import seed data once per test suite run.
* Only used before 1.42 as it breaks on 1.42 if not running for each test
*
* @var bool
*/
private static $wasSeedDataImported = false;

protected function setUp(): void {
parent::setUp();

Expand All @@ -37,25 +29,14 @@ protected function setUp(): void {
}

private function doImport(): void {
$file = dirname( __DIR__ ) . '/seed-data.xml';
$this->seedTestUsers( $file );

$services = $this->getServiceContainer();
if ( version_compare( MW_VERSION, '1.42', '>=' ) ) {
$file = dirname( __DIR__ ) . '/seed-data.xml';
$this->seedTestUsers( $file );
$importer = $services->getWikiImporterFactory()->getWikiImporter(
$this->importStreamSource->value,
$this->getTestSysop()->getAuthority()
);
} else {
if ( self::$wasSeedDataImported ) {
return;
}
self::$wasSeedDataImported = true;
$file = dirname( __DIR__ ) . '/seed-data.xml';
$this->seedTestUsers( $file );
$importer = $services->getWikiImporterFactory()->getWikiImporter(
$this->importStreamSource->value
);
}
$importer = $services->getWikiImporterFactory()->getWikiImporter(
$this->importStreamSource->value,
$this->getTestSysop()->getAuthority()
);

$importer->disableStatisticsUpdate();

Expand Down

0 comments on commit a62a8f5

Please sign in to comment.