From: Max Semenik Date: Sat, 17 Mar 2018 07:49:07 +0000 (-0700) Subject: tests: Remove some unused stuff in phpunit tests X-Git-Tag: 1.31.0-rc.0~272^2 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=aa9bbe6051ef76aaa594c05ebd29235d867d1a4c;p=lhc%2Fweb%2Fwiklou.git tests: Remove some unused stuff in phpunit tests Change-Id: Ica20e4f4ac0887b7cac12700ffcd15f587b3ba01 --- diff --git a/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php b/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php index 3976995574..09f5675ec5 100644 --- a/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php +++ b/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php @@ -679,10 +679,6 @@ class RevisionStoreRecordTest extends MediaWikiTestCase { ); } - private function getSlotRecord( $role, $contentString ) { - return SlotRecord::newUnsaved( $role, new TextContent( $contentString ) ); - } - public function provideHasSameContent() { /** * @param SlotRecord[] $slots diff --git a/tests/phpunit/includes/libs/ArrayUtilsTest.php b/tests/phpunit/includes/libs/ArrayUtilsTest.php index 4fbbc99b6a..d5ac77bbf7 100644 --- a/tests/phpunit/includes/libs/ArrayUtilsTest.php +++ b/tests/phpunit/includes/libs/ArrayUtilsTest.php @@ -8,8 +8,6 @@ class ArrayUtilsTest extends PHPUnit\Framework\TestCase { use MediaWikiCoversValidator; - private $search; - /** * @covers ArrayUtils::findLowerBound * @dataProvider provideFindLowerBound diff --git a/tests/phpunit/maintenance/backup_PageTest.php b/tests/phpunit/maintenance/backup_PageTest.php index 34ae538a10..51a1ed6951 100644 --- a/tests/phpunit/maintenance/backup_PageTest.php +++ b/tests/phpunit/maintenance/backup_PageTest.php @@ -19,8 +19,8 @@ class BackupDumperPageTest extends DumpTestCase { // We'll add several pages, revision and texts. The following variables hold the // corresponding ids. - private $pageId1, $pageId2, $pageId3, $pageId4, $pageId5; - private $pageTitle1, $pageTitle2, $pageTitle3, $pageTitle4, $pageTitle5; + private $pageId1, $pageId2, $pageId3, $pageId4; + private $pageTitle1, $pageTitle2, $pageTitle3, $pageTitle4; private $revId1_1, $textId1_1; private $revId2_1, $textId2_1, $revId2_2, $textId2_2; private $revId2_3, $textId2_3, $revId2_4, $textId2_4; diff --git a/tests/phpunit/suites/UploadFromUrlTestSuite.php b/tests/phpunit/suites/UploadFromUrlTestSuite.php index 6fb428bb8e..556c75412a 100644 --- a/tests/phpunit/suites/UploadFromUrlTestSuite.php +++ b/tests/phpunit/suites/UploadFromUrlTestSuite.php @@ -18,8 +18,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { protected function setUp() { global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, - $wgParserCacheType, $wgNamespaceAliases, $wgNamespaceProtection, - $parserMemc; + $wgParserCacheType, $wgNamespaceAliases, $wgNamespaceProtection; $tmpDir = $this->getNewTempDirectory(); $tmpGlobals = []; @@ -89,54 +88,6 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { parent::tearDown(); } - /** - * Delete the specified files, if they exist. - * - * @param array $files Full paths to files to delete. - */ - private static function deleteFiles( $files ) { - foreach ( $files as $file ) { - if ( file_exists( $file ) ) { - unlink( $file ); - } - } - } - - /** - * Delete the specified directories, if they exist. Must be empty. - * - * @param array $dirs Full paths to directories to delete. - */ - private static function deleteDirs( $dirs ) { - foreach ( $dirs as $dir ) { - if ( is_dir( $dir ) ) { - rmdir( $dir ); - } - } - } - - /** - * Create a dummy uploads directory which will contain a couple - * of files in order to pass existence tests. - * - * @return string The directory - */ - private function setupUploadDir() { - global $IP; - - $dir = $this->getNewTempDirectory(); - - wfDebug( "Creating upload directory $dir\n" ); - - wfMkdirParents( $dir . '/3/3a', null, __METHOD__ ); - copy( "$IP/tests/phpunit/data/upload/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); - - wfMkdirParents( $dir . '/0/09', null, __METHOD__ ); - copy( "$IP/tests/phpunit/data/upload/headbg.jpg", "$dir/0/09/Bad.jpg" ); - - return $dir; - } - public static function suite() { // Hack to invoke the autoloader required to get phpunit to recognize // the UploadFromUrlTest class