gallery: Fix phan annotation for ImageGalleryBase::getImages
[mediawiki.git] / tests / phpunit / includes / installer / DatabaseUpdaterWhenUpdateLogMissingTest.php
blob8c027a16089a048ca1f6e5f7b54f8319a0c2c4e8
1 <?php
3 namespace MediaWiki\Tests\Installer;
5 use MediaWiki\Installer\DatabaseUpdater;
6 use MediaWikiIntegrationTestCase;
7 use Wikimedia\Rdbms\IMaintainableDatabase;
9 /**
10 * @covers \MediaWiki\Installer\DatabaseUpdater
11 * @group Database
13 class DatabaseUpdaterWhenUpdateLogMissingTest extends MediaWikiIntegrationTestCase {
14 public function testUpdateRowExistsWhenUpdateLogTableMissing() {
15 // Check that updatelog is actually dropped, otherwise the test will still pass but not test what we want
16 // it to test.
17 $dbw = $this->getServiceContainer()->getDBLoadBalancer()->getMaintenanceConnectionRef( DB_PRIMARY );
18 $this->assertFalse( $dbw->tableExists( 'updatelog' ) );
19 // Call the method under test.
20 $objectUnderTest = DatabaseUpdater::newForDB( $dbw );
21 $this->assertSame( false, $objectUnderTest->updateRowExists( 'test' ) );
24 public function testInsertUpdateRowWhenUpdateLogTableMissing() {
25 // Call the method under test
26 $dbw = $this->getServiceContainer()->getDBLoadBalancer()->getMaintenanceConnectionRef( DB_PRIMARY );
27 $objectUnderTest = DatabaseUpdater::newForDB( $dbw );
28 $objectUnderTest->insertUpdateRow( 'test' );
29 // Check that updatelog still does not exist after calling the method under test
30 $this->assertFalse( $dbw->tableExists( 'updatelog' ) );
33 protected function getSchemaOverrides( IMaintainableDatabase $db ) {
34 return [
35 'drop' => [ 'updatelog' ],
36 'scripts' => [ __DIR__ . '/patches/drop-table-updatelog.sql' ]