test: coverage for wfWikiID()
authorAntoine Musso <hashar@free.fr>
Tue, 29 Jul 2014 09:43:54 +0000 (11:43 +0200)
committerAntoine Musso <hashar@free.fr>
Tue, 29 Jul 2014 09:44:18 +0000 (11:44 +0200)
Basic coverage test, note that $wgDBprefix is used as a suffix!

Bug: 68231
Change-Id: Ic454ce38672b1f18db2a7f2f46c50bcfc5ee83d0

tests/phpunit/includes/GlobalFunctions/wfWikiIDTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/includes/GlobalFunctions/wfWikiIDTest.php b/tests/phpunit/includes/GlobalFunctions/wfWikiIDTest.php
new file mode 100644 (file)
index 0000000..d3cba0d
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+/**
+ * @group GlobalFunctions
+ * @covers ::wfWikiID
+ */
+class WfWikiId extends MediaWikiTestCase {
+
+       public function testReturnsProperDbName() {
+               $this->setMwGlobals( 'wgDBname', 'known_db_name' );
+               $this->assertEquals('known_db_name',  wfWikiID() );
+       }
+
+       public function testHonorsDatabasePrefix() {
+               $this->setMwGlobals( array(
+                       'wgDBname'   => 'known_db_name',
+                       'wgDBprefix' => 'prefix',
+               ));
+               # Note: prefix is actually a suffix in wfWikiID()
+               $this->assertEquals('known_db_name-prefix',  wfWikiID() );
+       }
+
+}