3 use Wikimedia\Rdbms\IMaintainableDatabase
;
6 * @covers MediaWikiTestCase
9 * @group MediaWikiTestCaseTest
11 class MediaWikiTestCaseSchema1Test
extends MediaWikiTestCase
{
13 public static $hasRun = false;
15 public function setUp() {
17 // FIXME: fails under postgres
18 $this->markTestSkippedIfDbType( 'postgres' );
21 public function getSchemaOverrides( IMaintainableDatabase
$db ) {
23 'create' => [ 'MediaWikiTestCaseTestTable', 'imagelinks' ],
24 'drop' => [ 'oldimage' ],
25 'alter' => [ 'pagelinks' ],
26 'scripts' => [ __DIR__
. '/MediaWikiTestCaseSchemaTest.sql' ]
30 public function testMediaWikiTestCaseSchemaTestOrder() {
31 // The test must be run before the second test
33 $this->assertTrue( self
::$hasRun );
36 public function testTableWasCreated() {
37 // Make sure MediaWikiTestCaseTestTable was created.
38 $this->assertTrue( $this->db
->tableExists( 'MediaWikiTestCaseTestTable' ) );
41 public function testTableWasDropped() {
42 // Make sure oldimage was dropped
43 $this->assertFalse( $this->db
->tableExists( 'oldimage' ) );
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' ) );
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' ) );