| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Installer; |
| 4 |
|
| 5 |
use MediaWiki\Installer\DatabaseUpdater; |
| 6 |
use MediaWikiIntegrationTestCase; |
| 7 |
use Wikimedia\Rdbms\IMaintainableDatabase; |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
class DatabaseUpdaterWhenUpdateLogMissingTest extends MediaWikiIntegrationTestCase { |
| 14 |
public function testUpdateRowExistsWhenUpdateLogTableMissing() { |
| 15 |
|
| 16 |
|
| 17 |
$dbw = $this->getServiceContainer()->getDBLoadBalancer()->getMaintenanceConnectionRef( DB_PRIMARY ); |
| 18 |
$this->assertFalse( $dbw->tableExists( 'updatelog' ) ); |
| 19 |
|
| 20 |
$objectUnderTest = DatabaseUpdater::newForDB( $dbw ); |
| 21 |
$this->assertSame( false, $objectUnderTest->updateRowExists( 'test' ) ); |
| 22 |
} |
| 23 |
|
| 24 |
public function testInsertUpdateRowWhenUpdateLogTableMissing() { |
| 25 |
|
| 26 |
$dbw = $this->getServiceContainer()->getDBLoadBalancer()->getMaintenanceConnectionRef( DB_PRIMARY ); |
| 27 |
$objectUnderTest = DatabaseUpdater::newForDB( $dbw ); |
| 28 |
$objectUnderTest->insertUpdateRow( 'test' ); |
| 29 |
|
| 30 |
$this->assertFalse( $dbw->tableExists( 'updatelog' ) ); |
| 31 |
} |
| 32 |
|
| 33 |
protected function getSchemaOverrides( IMaintainableDatabase $db ) { |
| 34 |
return [ |
| 35 |
'drop' => [ 'updatelog' ], |
| 36 |
'scripts' => [ __DIR__ . '/patches/drop-table-updatelog.sql' ] |
| 37 |
]; |
| 38 |
} |
| 39 |
} |