FU r100915: split out GlobalWithDBTest (tests which need the DB)
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 27 Oct 2011 20:54:27 +0000 (20:54 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 27 Oct 2011 20:54:27 +0000 (20:54 +0000)
tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php [new file with mode: 0644]

index 25581de..01da0a5 100644 (file)
@@ -934,29 +934,6 @@ class GlobalTest extends MediaWikiTestCase {
                                "Called eval.php --help --test with wrapper and php option" ),
                );
        }
-
-       /**
-        * @dataProvider provideWfIsBadImageList
-        */
-       function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
-               $this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
-       }
-
-       function provideWfIsBadImageList() {
-               $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
-               return array(
-                       array( 'Bad.jpg', false, $blacklist, true,
-                               'Called on a bad image' ),
-                       array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true,
-                               'Called on a bad image' ),
-                       array( 'NotBad.jpg', false, $blacklist, false,
-                               'Called on a non-bad image' ),
-                       array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false,
-                               'Called on a bad image but is on a whitelisted page' ),
-                       array( 'File:Bad.jpg', false, $blacklist, false,
-                               'Called on a bad image with File:' ),
-               );
-       }
        /* TODO: many more! */
 }
 
diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php
new file mode 100644 (file)
index 0000000..4879a38
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * @group Database
+ */
+class GlobalWithDBTest extends MediaWikiTestCase {
+       /**
+        * @dataProvider provideWfIsBadImageList
+        */
+       function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
+               $this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
+       }
+
+       function provideWfIsBadImageList() {
+               $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
+               return array(
+                       array( 'Bad.jpg', false, $blacklist, true,
+                               'Called on a bad image' ),
+                       array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true,
+                               'Called on a bad image' ),
+                       array( 'NotBad.jpg', false, $blacklist, false,
+                               'Called on a non-bad image' ),
+                       array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false,
+                               'Called on a bad image but is on a whitelisted page' ),
+                       array( 'File:Bad.jpg', false, $blacklist, false,
+                               'Called on a bad image with File:' ),
+               );
+       }
+}