Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / tests / phpunit / tests / MediaWikiTestCaseSchema1Test.php
1 <?php
2
3 use Wikimedia\Rdbms\IMaintainableDatabase;
4
5 /**
6 * @covers MediaWikiTestCase
7 *
8 * @group Database
9 * @group MediaWikiTestCaseTest
10 */
11 class MediaWikiTestCaseSchema1Test extends MediaWikiTestCase {
12
13 public static $hasRun = false;
14
15 public function setUp() {
16 parent::setUp();
17 // FIXME: fails under postgres
18 $this->markTestSkippedIfDbType( 'postgres' );
19 }
20
21 public function getSchemaOverrides( IMaintainableDatabase $db ) {
22 return [
23 'create' => [ 'MediaWikiTestCaseTestTable', 'imagelinks' ],
24 'drop' => [ 'oldimage' ],
25 'alter' => [ 'pagelinks' ],
26 'scripts' => [ __DIR__ . '/MediaWikiTestCaseSchemaTest.sql' ]
27 ];
28 }
29
30 public function testMediaWikiTestCaseSchemaTestOrder() {
31 // The test must be run before the second test
32 self::$hasRun = true;
33 $this->assertTrue( self::$hasRun );
34 }
35
36 public function testTableWasCreated() {
37 // Make sure MediaWikiTestCaseTestTable was created.
38 $this->assertTrue( $this->db->tableExists( 'MediaWikiTestCaseTestTable' ) );
39 }
40
41 public function testTableWasDropped() {
42 // Make sure oldimage was dropped
43 $this->assertFalse( $this->db->tableExists( 'oldimage' ) );
44 }
45
46 public function testTableWasOverriden() {
47 // Make sure imagelinks was overwritten
48 $this->assertTrue( $this->db->tableExists( 'imagelinks' ) );
49 $this->assertTrue( $this->db->fieldExists( 'imagelinks', 'il_frobnitz' ) );
50 }
51
52 public function testTableWasAltered() {
53 // Make sure pagelinks was altered
54 $this->assertTrue( $this->db->tableExists( 'pagelinks' ) );
55 $this->assertTrue( $this->db->fieldExists( 'pagelinks', 'pl_frobnitz' ) );
56 }
57
58 }