4 * @covers MediaWikiTestCase
7 * @group MediaWikiTestCaseTest
9 * This test is intended to be executed AFTER MediaWikiTestCaseSchema1Test to ensure
10 * that any schema modifications have been cleaned up between test cases.
11 * As there seems to be no way to force execution order, we currently rely on
12 * test classes getting run in anpha-numerical order.
13 * Order is checked by the testMediaWikiTestCaseSchemaTestOrder test in both classes.
15 class MediaWikiTestCaseSchema2Test
extends MediaWikiTestCase
{
17 public function setUp() {
19 if ( $this->db
->getType() == 'postgres' ) {
20 $this->markTestSkipped( __CLASS__
. ' does not support postgres' );
24 public function testMediaWikiTestCaseSchemaTestOrder() {
25 // The first test must have run before this one
26 $this->assertTrue( MediaWikiTestCaseSchema1Test
::$hasRun );
29 public function testCreatedTableWasRemoved() {
30 // Make sure MediaWikiTestCaseTestTable created by MediaWikiTestCaseSchema1Test
31 // was dropped before executing MediaWikiTestCaseSchema2Test.
32 $this->assertFalse( $this->db
->tableExists( 'MediaWikiTestCaseTestTable' ) );
35 public function testDroppedTableWasRestored() {
36 // Make sure oldimage that was dropped by MediaWikiTestCaseSchema1Test
37 // was restored before executing MediaWikiTestCaseSchema2Test.
38 $this->assertTrue( $this->db
->tableExists( 'oldimage' ) );
41 public function testOverridenTableWasRestored() {
42 // Make sure imagelinks overwritten by MediaWikiTestCaseSchema1Test
43 // was restored to the original schema before executing MediaWikiTestCaseSchema2Test.
44 $this->assertTrue( $this->db
->tableExists( 'imagelinks' ) );
45 $this->assertFalse( $this->db
->fieldExists( 'imagelinks', 'il_frobnitz' ) );
48 public function testAlteredTableWasRestored() {
49 // Make sure pagelinks altered by MediaWikiTestCaseSchema1Test
50 // was restored to the original schema before executing MediaWikiTestCaseSchema2Test.
51 $this->assertTrue( $this->db
->tableExists( 'pagelinks' ) );
52 $this->assertFalse( $this->db
->fieldExists( 'pagelinks', 'pl_frobnitz' ) );