diff options
Diffstat (limited to 'tests/phpunit/suites')
-rw-r--r-- | tests/phpunit/suites/ExtensionsParserTestSuite.php | 8 | ||||
-rw-r--r-- | tests/phpunit/suites/ExtensionsTestSuite.php | 2 | ||||
-rw-r--r-- | tests/phpunit/suites/UploadFromUrlTestSuite.php | 43 |
3 files changed, 32 insertions, 21 deletions
diff --git a/tests/phpunit/suites/ExtensionsParserTestSuite.php b/tests/phpunit/suites/ExtensionsParserTestSuite.php new file mode 100644 index 00000000..3d68b241 --- /dev/null +++ b/tests/phpunit/suites/ExtensionsParserTestSuite.php @@ -0,0 +1,8 @@ +<?php +class ExtensionsParserTestSuite extends PHPUnit_Framework_TestSuite { + + public static function suite() { + return MediaWikiParserTest::suite( MediaWikiParserTest::NO_CORE ); + } + +} diff --git a/tests/phpunit/suites/ExtensionsTestSuite.php b/tests/phpunit/suites/ExtensionsTestSuite.php index d728807f..eec773db 100644 --- a/tests/phpunit/suites/ExtensionsTestSuite.php +++ b/tests/phpunit/suites/ExtensionsTestSuite.php @@ -1,4 +1,4 @@ -<?php +<?php /** * This test suite runs unit tests registered by extensions. * See http://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList for details of how to register your tests. diff --git a/tests/phpunit/suites/UploadFromUrlTestSuite.php b/tests/phpunit/suites/UploadFromUrlTestSuite.php index f2638111..7eb599e3 100644 --- a/tests/phpunit/suites/UploadFromUrlTestSuite.php +++ b/tests/phpunit/suites/UploadFromUrlTestSuite.php @@ -1,6 +1,6 @@ <?php -require_once( dirname( __DIR__ ) . '/includes/upload/UploadFromUrlTest.php' ); +require_once dirname( __DIR__ ) . '/includes/upload/UploadFromUrlTest.php'; class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { public $savedGlobals = array(); @@ -15,32 +15,32 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { return true; } - function setUp() { - global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, - $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache, - $wgNamespaceAliases, $wgNamespaceProtection, $parserMemc; + protected function setUp() { + global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgUser, + $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, + $wgEnableParserCache, $wgNamespaceAliases, $wgNamespaceProtection, + $parserMemc; $tmpGlobals = array(); $tmpGlobals['wgScript'] = '/index.php'; $tmpGlobals['wgScriptPath'] = '/'; $tmpGlobals['wgArticlePath'] = '/wiki/$1'; - $tmpGlobals['wgStyleSheetPath'] = '/skins'; $tmpGlobals['wgStylePath'] = '/skins'; $tmpGlobals['wgThumbnailScriptPath'] = false; $tmpGlobals['wgLocalFileRepo'] = array( - 'class' => 'LocalRepo', - 'name' => 'local', - 'url' => 'http://example.com/images', - 'hashLevels' => 2, + 'class' => 'LocalRepo', + 'name' => 'local', + 'url' => 'http://example.com/images', + 'hashLevels' => 2, 'transformVia404' => false, - 'backend' => new FSFileBackend( array( - 'name' => 'local-backend', + 'backend' => new FSFileBackend( array( + 'name' => 'local-backend', 'lockManager' => 'fsLockManager', 'containerPaths' => array( - 'local-public' => wfTempDir() . '/test-repo/public', - 'local-thumb' => wfTempDir() . '/test-repo/thumb', - 'local-temp' => wfTempDir() . '/test-repo/temp', + 'local-public' => wfTempDir() . '/test-repo/public', + 'local-thumb' => wfTempDir() . '/test-repo/thumb', + 'local-temp' => wfTempDir() . '/test-repo/temp', 'local-deleted' => wfTempDir() . '/test-repo/delete', ) ) ), @@ -56,7 +56,6 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { $wgNamespaceAliases['Image'] = NS_FILE; $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK; - $wgEnableParserCache = false; DeferredUpdates::clearPendingUpdates(); $wgMemc = wfGetMainCache(); @@ -72,14 +71,14 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { $wgRequest = $context->getRequest(); if ( $wgStyleDirectory === false ) { - $wgStyleDirectory = "$IP/skins"; + $wgStyleDirectory = "$IP/skins"; } RepoGroup::destroySingleton(); FileBackendGroup::destroySingleton(); } - public function tearDown() { + protected function tearDown() { foreach ( $this->savedGlobals as $var => $val ) { $GLOBALS[$var] = $val; } @@ -88,6 +87,8 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { FileBackendGroup::destroySingleton(); $this->teardownUploadDir( $this->uploadDir ); + + parent::tearDown(); } private $uploadDir; @@ -103,7 +104,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { // delete the files first, then the dirs. self::deleteFiles( - array ( + array( "$dir/3/3a/Foobar.jpg", "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg", "$dir/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg", @@ -115,7 +116,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { ); self::deleteDirs( - array ( + array( "$dir/3/3a", "$dir/3", "$dir/thumb/6/65", @@ -182,6 +183,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { if ( file_exists( $dir ) ) { wfDebug( "Already exists!\n" ); + return $dir; } @@ -199,6 +201,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { // the UploadFromUrlTest class class_exists( 'UploadFromUrlTest' ); $suite = new UploadFromUrlTestSuite( 'UploadFromUrlTest' ); + return $suite; } } |