summaryrefslogtreecommitdiff
path: root/www/wiki/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php')
-rw-r--r--www/wiki/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php b/www/wiki/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php
new file mode 100644
index 00000000..d794d131
--- /dev/null
+++ b/www/wiki/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php
@@ -0,0 +1,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' ) );
+ }
+
+}