Page MenuHomeWickedGov Phorge

MediaWikiIntegrationTestCaseSchema2Test.php
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

MediaWikiIntegrationTestCaseSchema2Test.php

<?php
/**
* This test is intended to be executed AFTER MediaWikiIntegrationTestCaseSchema1Test to ensure
* that any schema modifications have been cleaned up between test cases.
* As there seems to be no way to force execution order, we currently rely on
* test classes getting run in alpha-numerical order.
* Order is checked by the testMediaWikiIntegrationTestCaseSchemaTestOrder test in both classes.
*
* @covers \MediaWikiIntegrationTestCase
* @group Database
*/
class MediaWikiIntegrationTestCaseSchema2Test extends MediaWikiIntegrationTestCase {
protected function setUp(): void {
parent::setUp();
// FIXME: fails under postgres - T198222
$this->markTestSkippedIfDbType( 'postgres' );
}
public function testMediaWikiIntegrationTestCaseSchemaTestOrder() {
// The first test must have run before this one
$this->assertTrue( MediaWikiIntegrationTestCaseSchema1Test::$hasRun );
}
public function testCreatedTableWasRemoved() {
// Make sure MediaWikiIntegrationTestCaseTestTable created by MediaWikiIntegrationTestCaseSchema1Test
// was dropped before executing MediaWikiIntegrationTestCaseSchema2Test.
$this->assertFalse( $this->db->tableExists( 'MediaWikiIntegrationTestCaseTestTable' ) );
}
public function testDroppedTableWasRestored() {
// Make sure oldimage that was dropped by MediaWikiIntegrationTestCaseSchema1Test
// was restored before executing MediaWikiIntegrationTestCaseSchema2Test.
$this->assertTrue( $this->db->tableExists( 'oldimage' ) );
}
public function testOverridenTableWasRestored() {
// Make sure imagelinks overwritten by MediaWikiIntegrationTestCaseSchema1Test
// was restored to the original schema before executing MediaWikiIntegrationTestCaseSchema2Test.
$this->assertTrue( $this->db->tableExists( 'imagelinks' ) );
$this->assertFalse( $this->db->fieldExists( 'imagelinks', 'il_frobnitz' ) );
}
public function testAlteredTableWasRestored() {
// The sql file does ALTER which doesn't exist in sqlite
$this->markTestSkippedIfDbType( 'sqlite' );
// Make sure pagelinks altered by MediaWikiIntegrationTestCaseSchema1Test
// was restored to the original schema before executing MediaWikiIntegrationTestCaseSchema2Test.
$this->assertTrue( $this->db->tableExists( 'pagelinks' ) );
$this->assertFalse( $this->db->fieldExists( 'pagelinks', 'pl_frobnitz' ) );
}
}

File Metadata

Mime Type
text/x-php
Expires
Tue, Aug 18, 16:07 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ac/44/6cbea6a425a94ec1b3b854c9fb31
Default Alt Text
MediaWikiIntegrationTestCaseSchema2Test.php (2 KB)

Event Timeline