2 use Wikimedia\Rdbms\IMaintainableDatabase
;
5 * @covers MediaWikiTestCase
8 * @group MediaWikiTestCaseTest
10 class MediaWikiTestCaseSchema1Test
extends MediaWikiTestCase
{
12 public static $hasRun = false;
14 public function setUp() {
16 // FIXME: fails under postgres
17 $this->markTestSkippedIfDbType( 'postgres' );
20 public function getSchemaOverrides( IMaintainableDatabase
$db ) {
22 'create' => [ 'MediaWikiTestCaseTestTable', 'imagelinks' ],
23 'drop' => [ 'oldimage' ],
24 'alter' => [ 'pagelinks' ],
25 'scripts' => [ __DIR__
. '/MediaWikiTestCaseSchemaTest.sql' ]
29 public function testMediaWikiTestCaseSchemaTestOrder() {
30 // The test must be run before the second test
32 $this->assertTrue( self
::$hasRun );
35 public function testTableWasCreated() {
36 // Make sure MediaWikiTestCaseTestTable was created.
37 $this->assertTrue( $this->db
->tableExists( 'MediaWikiTestCaseTestTable' ) );
40 public function testTableWasDropped() {
41 // Make sure oldimage was dropped
42 $this->assertFalse( $this->db
->tableExists( 'oldimage' ) );
45 public function testTableWasOverriden() {
46 // Make sure imagelinks was overwritten
47 $this->assertTrue( $this->db
->tableExists( 'imagelinks' ) );
48 $this->assertTrue( $this->db
->fieldExists( 'imagelinks', 'il_frobnitz' ) );
51 public function testTableWasAltered() {
52 // Make sure pagelinks was altered
53 $this->assertTrue( $this->db
->tableExists( 'pagelinks' ) );
54 $this->assertTrue( $this->db
->fieldExists( 'pagelinks', 'pl_frobnitz' ) );