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