From 75160bdd3b4ac3642d147cda46e47c809999937d Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 29 Dec 2017 15:22:37 -0800 Subject: [PATCH] Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCase Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13 --- tests/phpunit/includes/FauxRequestTest.php | 3 +++ tests/phpunit/includes/MediaWikiVersionFetcherTest.php | 2 ++ tests/phpunit/includes/SanitizerValidateEmailTest.php | 2 ++ tests/phpunit/includes/TitleArrayFromResultTest.php | 2 ++ tests/phpunit/includes/WikiReferenceTest.php | 2 ++ tests/phpunit/includes/XmlJsTest.php | 2 ++ .../includes/composer/ComposerVersionNormalizerTest.php | 2 ++ tests/phpunit/includes/config/EtcdConfigTest.php | 2 ++ tests/phpunit/includes/deferred/MWCallableUpdateTest.php | 2 ++ .../includes/deferred/TransactionRoundDefiningUpdateTest.php | 2 ++ .../includes/externalstore/ExternalStoreFactoryTest.php | 2 ++ tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php | 3 +++ tests/phpunit/includes/jobqueue/JobQueueMemoryTest.php | 2 ++ tests/phpunit/includes/libs/ArrayUtilsTest.php | 3 +++ tests/phpunit/includes/libs/DeferredStringifierTest.php | 2 ++ tests/phpunit/includes/libs/DnsSrvDiscovererTest.php | 3 +++ tests/phpunit/includes/libs/GenericArrayObjectTest.php | 2 ++ tests/phpunit/includes/libs/HashRingTest.php | 3 +++ tests/phpunit/includes/libs/HtmlArmorTest.php | 2 ++ tests/phpunit/includes/libs/IEUrlExtensionTest.php | 3 +++ tests/phpunit/includes/libs/IPTest.php | 3 +++ tests/phpunit/includes/libs/JavaScriptMinifierTest.php | 2 ++ tests/phpunit/includes/libs/MWMessagePackTest.php | 2 ++ tests/phpunit/includes/libs/MapCacheLRUTest.php | 3 +++ tests/phpunit/includes/libs/MemoizedCallableTest.php | 2 ++ tests/phpunit/includes/libs/ObjectFactoryTest.php | 2 ++ tests/phpunit/includes/libs/ProcessCacheLRUTest.php | 2 ++ tests/phpunit/includes/libs/SamplingStatsdClientTest.php | 3 +++ tests/phpunit/includes/libs/StringUtilsTest.php | 2 ++ tests/phpunit/includes/libs/TimingTest.php | 2 ++ tests/phpunit/includes/libs/XhprofDataTest.php | 2 ++ tests/phpunit/includes/libs/XhprofTest.php | 3 +++ tests/phpunit/includes/libs/XmlTypeCheckTest.php | 3 +++ tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php | 3 +++ .../phpunit/includes/libs/objectcache/CachedBagOStuffTest.php | 2 ++ tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php | 2 ++ tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php | 3 +++ tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php | 3 +++ .../includes/libs/rdbms/database/DatabaseDomainTest.php | 3 +++ .../includes/libs/rdbms/database/DatabaseMysqlBaseTest.php | 3 +++ tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php | 3 +++ tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php | 2 ++ tests/phpunit/includes/libs/xmp/XMPTest.php | 2 ++ tests/phpunit/includes/libs/xmp/XMPValidateTest.php | 2 ++ tests/phpunit/includes/objectcache/RedisBagOStuffTest.php | 3 +++ tests/phpunit/includes/parser/ParserIntegrationTest.php | 3 +++ tests/phpunit/includes/registration/VersionCheckerTest.php | 3 +++ .../resourceloader/DerivativeResourceLoaderContextTest.php | 2 ++ tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php | 2 ++ .../includes/resourceloader/ResourceLoaderClientHtmlTest.php | 2 ++ .../includes/resourceloader/ResourceLoaderContextTest.php | 3 +++ .../includes/resourceloader/ResourceLoaderSkinModuleTest.php | 2 ++ tests/phpunit/includes/services/ServiceContainerTest.php | 2 ++ tests/phpunit/includes/shell/CommandFactoryTest.php | 3 +++ tests/phpunit/includes/shell/CommandTest.php | 3 +++ tests/phpunit/includes/shell/FirejailCommandTest.php | 3 +++ tests/phpunit/includes/shell/ShellTest.php | 3 +++ tests/phpunit/includes/site/FileBasedSiteLookupTest.php | 2 ++ .../phpunit/includes/site/MediaWikiPageNameNormalizerTest.php | 2 ++ tests/phpunit/includes/site/SiteExporterTest.php | 2 ++ tests/phpunit/includes/site/SiteImporterTest.php | 2 ++ tests/phpunit/includes/site/SitesCacheFileBuilderTest.php | 2 ++ tests/phpunit/includes/utils/AvroValidatorTest.php | 3 +++ tests/phpunit/includes/utils/ClassCollectorTest.php | 2 ++ tests/phpunit/includes/utils/FileContentsHasherTest.php | 2 ++ tests/phpunit/includes/utils/MWCryptHashTest.php | 2 ++ tests/phpunit/includes/utils/MWRestrictionsTest.php | 2 ++ tests/phpunit/includes/utils/UIDGeneratorTest.php | 2 ++ tests/phpunit/includes/utils/ZipDirectoryReaderTest.php | 3 +++ .../includes/watcheditem/WatchedItemQueryServiceUnitTest.php | 2 ++ tests/phpunit/languages/LanguageCodeTest.php | 2 ++ tests/phpunit/maintenance/BenchmarkerTest.php | 3 +++ tests/phpunit/structure/AvailableRightsTest.php | 2 ++ tests/phpunit/structure/ExtensionJsonValidationTest.php | 2 ++ 74 files changed, 176 insertions(+) diff --git a/tests/phpunit/includes/FauxRequestTest.php b/tests/phpunit/includes/FauxRequestTest.php index 9fe694da03..e39dcdb3e7 100644 --- a/tests/phpunit/includes/FauxRequestTest.php +++ b/tests/phpunit/includes/FauxRequestTest.php @@ -3,6 +3,9 @@ use MediaWiki\Session\SessionManager; class FauxRequestTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** * @covers FauxRequest::__construct */ diff --git a/tests/phpunit/includes/MediaWikiVersionFetcherTest.php b/tests/phpunit/includes/MediaWikiVersionFetcherTest.php index fa59ef2901..6aa98490e7 100644 --- a/tests/phpunit/includes/MediaWikiVersionFetcherTest.php +++ b/tests/phpunit/includes/MediaWikiVersionFetcherTest.php @@ -12,6 +12,8 @@ */ class MediaWikiVersionFetcherTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function testReturnsResult() { $versionFetcher = new MediaWikiVersionFetcher(); $this->assertInternalType( 'string', $versionFetcher->fetchVersion() ); diff --git a/tests/phpunit/includes/SanitizerValidateEmailTest.php b/tests/phpunit/includes/SanitizerValidateEmailTest.php index 2448513345..c7e15ea5d1 100644 --- a/tests/phpunit/includes/SanitizerValidateEmailTest.php +++ b/tests/phpunit/includes/SanitizerValidateEmailTest.php @@ -7,6 +7,8 @@ */ class SanitizerValidateEmailTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + private function checkEmail( $addr, $expected = true, $msg = '' ) { if ( $msg == '' ) { $msg = "Testing $addr"; diff --git a/tests/phpunit/includes/TitleArrayFromResultTest.php b/tests/phpunit/includes/TitleArrayFromResultTest.php index 7c2973f93f..8882214048 100644 --- a/tests/phpunit/includes/TitleArrayFromResultTest.php +++ b/tests/phpunit/includes/TitleArrayFromResultTest.php @@ -6,6 +6,8 @@ */ class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + private function getMockResultWrapper( $row = null, $numRows = 1 ) { $resultWrapper = $this->getMockBuilder( 'ResultWrapper' ) ->disableOriginalConstructor(); diff --git a/tests/phpunit/includes/WikiReferenceTest.php b/tests/phpunit/includes/WikiReferenceTest.php index 724dd6056a..227dd87da5 100644 --- a/tests/phpunit/includes/WikiReferenceTest.php +++ b/tests/phpunit/includes/WikiReferenceTest.php @@ -6,6 +6,8 @@ class WikiReferenceTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function provideGetDisplayName() { return [ 'http' => [ 'foo.bar', 'http://foo.bar' ], diff --git a/tests/phpunit/includes/XmlJsTest.php b/tests/phpunit/includes/XmlJsTest.php index c2bc73ec4d..dec7bf3d2a 100644 --- a/tests/phpunit/includes/XmlJsTest.php +++ b/tests/phpunit/includes/XmlJsTest.php @@ -5,6 +5,8 @@ */ class XmlJsTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @covers XmlJsCode::__construct * @dataProvider provideConstruction diff --git a/tests/phpunit/includes/composer/ComposerVersionNormalizerTest.php b/tests/phpunit/includes/composer/ComposerVersionNormalizerTest.php index 8a2ebaff41..a4cc446342 100644 --- a/tests/phpunit/includes/composer/ComposerVersionNormalizerTest.php +++ b/tests/phpunit/includes/composer/ComposerVersionNormalizerTest.php @@ -9,6 +9,8 @@ */ class ComposerVersionNormalizerTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @dataProvider nonStringProvider */ diff --git a/tests/phpunit/includes/config/EtcdConfigTest.php b/tests/phpunit/includes/config/EtcdConfigTest.php index 3e70a07819..7a4d9d9f6f 100644 --- a/tests/phpunit/includes/config/EtcdConfigTest.php +++ b/tests/phpunit/includes/config/EtcdConfigTest.php @@ -4,6 +4,8 @@ use Wikimedia\TestingAccessWrapper; class EtcdConfigTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + private function createConfigMock( array $options = [] ) { return $this->getMockBuilder( EtcdConfig::class ) ->setConstructorArgs( [ $options + [ diff --git a/tests/phpunit/includes/deferred/MWCallableUpdateTest.php b/tests/phpunit/includes/deferred/MWCallableUpdateTest.php index 6995bf8b08..088ab4f544 100644 --- a/tests/phpunit/includes/deferred/MWCallableUpdateTest.php +++ b/tests/phpunit/includes/deferred/MWCallableUpdateTest.php @@ -5,6 +5,8 @@ */ class MWCallableUpdateTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function testDoUpdate() { $ran = 0; $update = new MWCallableUpdate( function () use ( &$ran ) { diff --git a/tests/phpunit/includes/deferred/TransactionRoundDefiningUpdateTest.php b/tests/phpunit/includes/deferred/TransactionRoundDefiningUpdateTest.php index e6ad072516..1261c24b26 100644 --- a/tests/phpunit/includes/deferred/TransactionRoundDefiningUpdateTest.php +++ b/tests/phpunit/includes/deferred/TransactionRoundDefiningUpdateTest.php @@ -5,6 +5,8 @@ */ class TransactionRoundDefiningUpdateTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function testDoUpdate() { $ran = 0; $update = new TransactionRoundDefiningUpdate( function () use ( &$ran ) { diff --git a/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php b/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php index a0bac63958..d43e04a4aa 100644 --- a/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php +++ b/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php @@ -5,6 +5,8 @@ */ class ExternalStoreFactoryTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function testExternalStoreFactory_noStores() { $factory = new ExternalStoreFactory( [] ); $this->assertFalse( $factory->getStoreObject( 'ForTesting' ) ); diff --git a/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php b/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php index 9ec4f97fd0..13c92e3642 100644 --- a/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php +++ b/tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php @@ -1,6 +1,9 @@ 'restrictions' ] ); $this->assertNotEmpty( $field->getLabel(), 'has a default label' ); diff --git a/tests/phpunit/includes/jobqueue/JobQueueMemoryTest.php b/tests/phpunit/includes/jobqueue/JobQueueMemoryTest.php index fe7c506978..edba75ce2e 100644 --- a/tests/phpunit/includes/jobqueue/JobQueueMemoryTest.php +++ b/tests/phpunit/includes/jobqueue/JobQueueMemoryTest.php @@ -10,6 +10,8 @@ */ class JobQueueMemoryTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @return JobQueueMemory */ diff --git a/tests/phpunit/includes/libs/ArrayUtilsTest.php b/tests/phpunit/includes/libs/ArrayUtilsTest.php index 21472d551b..76b4ee17be 100644 --- a/tests/phpunit/includes/libs/ArrayUtilsTest.php +++ b/tests/phpunit/includes/libs/ArrayUtilsTest.php @@ -6,6 +6,9 @@ */ class ArrayUtilsTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + private $search; /** diff --git a/tests/phpunit/includes/libs/DeferredStringifierTest.php b/tests/phpunit/includes/libs/DeferredStringifierTest.php index cba293926e..c3a1285e8e 100644 --- a/tests/phpunit/includes/libs/DeferredStringifierTest.php +++ b/tests/phpunit/includes/libs/DeferredStringifierTest.php @@ -2,6 +2,8 @@ class DeferredStringifierTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @covers DeferredStringifier * @dataProvider provideToString diff --git a/tests/phpunit/includes/libs/DnsSrvDiscovererTest.php b/tests/phpunit/includes/libs/DnsSrvDiscovererTest.php index cfc2d91b0d..bc20c4c429 100644 --- a/tests/phpunit/includes/libs/DnsSrvDiscovererTest.php +++ b/tests/phpunit/includes/libs/DnsSrvDiscovererTest.php @@ -1,6 +1,9 @@ "; const MAL_FORMED_XML = ""; // @codingStandardsIgnoreStart Generic.Files.LineLength diff --git a/tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php b/tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php index 742eb95dc4..47437103f6 100644 --- a/tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php +++ b/tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php @@ -4,6 +4,9 @@ * @covers MimeAnalyzer */ class MimeAnalyzerTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** @var MimeAnalyzer */ private $mimeAnalyzer; diff --git a/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php b/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php index 8b9abbc6c0..d71b16c682 100644 --- a/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php +++ b/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php @@ -7,6 +7,8 @@ use Wikimedia\TestingAccessWrapper; */ class CachedBagOStuffTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @covers CachedBagOStuff::__construct * @covers CachedBagOStuff::doGet diff --git a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php index 53d27c0afb..9eb34099e3 100644 --- a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php +++ b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php @@ -7,6 +7,8 @@ use Wikimedia\TestingAccessWrapper; */ class HashBagOStuffTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @covers HashBagOStuff::__construct */ diff --git a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php index e534f92513..7053fc18ba 100644 --- a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php +++ b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php @@ -17,6 +17,9 @@ use Wikimedia\TestingAccessWrapper; * @covers WANObjectCache::setInterimValue */ class WANObjectCacheTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** @var TimeAdjustableWANObjectCache */ private $cache; /** @var BagOStuff */ diff --git a/tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php b/tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php index b6ea4265ba..a0de408eea 100644 --- a/tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php +++ b/tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php @@ -4,6 +4,9 @@ use Wikimedia\Rdbms\TransactionProfiler; use Psr\Log\LoggerInterface; class TransactionProfilerTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + public function testAffected() { $logger = $this->getMockBuilder( LoggerInterface::class )->getMock(); $logger->expects( $this->exactly( 3 ) )->method( 'info' ); diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php index a8dbdd39f8..4e5f735b60 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php @@ -6,6 +6,9 @@ use Wikimedia\Rdbms\DatabaseDomain; * @covers Wikimedia\Rdbms\DatabaseDomain */ class DatabaseDomainTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + public static function provideConstruct() { return [ 'All strings' => diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php index 461ef09291..a9f18807e6 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php @@ -106,6 +106,9 @@ class FakeDatabaseMysqlBase extends DatabaseMysqlBase { } class DatabaseMysqlBaseTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** * @dataProvider provideDiapers * @covers Wikimedia\Rdbms\DatabaseMysqlBase::addIdentifierQuotes diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php index 7b8411729f..10dbcceb35 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php @@ -7,6 +7,9 @@ use Wikimedia\Rdbms\LikeMatch; * with creating SQL text. */ class DatabaseSQLTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** @var DatabaseTestHelper */ private $database; diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php index 7933f19f49..4a0a7e71df 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php @@ -7,6 +7,8 @@ use Wikimedia\TestingAccessWrapper; class DatabaseTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + protected function setUp() { $this->db = new DatabaseTestHelper( __CLASS__ . '::' . $this->getName() ); } diff --git a/tests/phpunit/includes/libs/xmp/XMPTest.php b/tests/phpunit/includes/libs/xmp/XMPTest.php index 514e6cdddc..7becad2bb8 100644 --- a/tests/phpunit/includes/libs/xmp/XMPTest.php +++ b/tests/phpunit/includes/libs/xmp/XMPTest.php @@ -6,6 +6,8 @@ */ class XMPTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + protected function setUp() { parent::setUp(); # Requires libxml to do XMP parsing diff --git a/tests/phpunit/includes/libs/xmp/XMPValidateTest.php b/tests/phpunit/includes/libs/xmp/XMPValidateTest.php index 7f7ea930e2..0785920d44 100644 --- a/tests/phpunit/includes/libs/xmp/XMPValidateTest.php +++ b/tests/phpunit/includes/libs/xmp/XMPValidateTest.php @@ -7,6 +7,8 @@ use Psr\Log\NullLogger; */ class XMPValidateTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @dataProvider provideDates * @covers XMPValidate::validateDate diff --git a/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php b/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php index 34a72cec5d..ea58e4a12d 100644 --- a/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php +++ b/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php @@ -6,6 +6,9 @@ use Wikimedia\TestingAccessWrapper; * @group BagOStuff */ class RedisBagOStuffTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** @var RedisBagOStuff */ private $cache; diff --git a/tests/phpunit/includes/parser/ParserIntegrationTest.php b/tests/phpunit/includes/parser/ParserIntegrationTest.php index c92098248c..8d17d21d72 100644 --- a/tests/phpunit/includes/parser/ParserIntegrationTest.php +++ b/tests/phpunit/includes/parser/ParserIntegrationTest.php @@ -15,6 +15,9 @@ use Wikimedia\ScopedCallback; * @todo covers tags */ class ParserIntegrationTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** @var array */ private $ptTest; diff --git a/tests/phpunit/includes/registration/VersionCheckerTest.php b/tests/phpunit/includes/registration/VersionCheckerTest.php index 9ee58816df..15d0c2b663 100644 --- a/tests/phpunit/includes/registration/VersionCheckerTest.php +++ b/tests/phpunit/includes/registration/VersionCheckerTest.php @@ -4,6 +4,9 @@ * @covers VersionChecker */ class VersionCheckerTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** * @dataProvider provideCheck */ diff --git a/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php b/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php index 0be04efdf3..db1fb6452f 100644 --- a/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php +++ b/tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php @@ -6,6 +6,8 @@ */ class DerivativeResourceLoaderContextTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + protected static function getContext() { $request = new FauxRequest( [ 'lang' => 'zh', diff --git a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php index 1f2c617e26..7521e880fb 100644 --- a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php +++ b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php @@ -8,6 +8,8 @@ use Wikimedia\TestingAccessWrapper; */ class MessageBlobStoreTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + protected function setUp() { parent::setUp(); // MediaWiki tests defaults $wgMainWANCache to CACHE_NONE. diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php index f75d67d801..49aeb3061d 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php @@ -7,6 +7,8 @@ use Wikimedia\TestingAccessWrapper; */ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + protected static function expandVariables( $text ) { return strtr( $text, [ '{blankVer}' => ResourceLoaderTestCase::BLANK_VERSION diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php index b658efba96..f848556a42 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php @@ -9,6 +9,9 @@ * @covers ResourceLoaderContext */ class ResourceLoaderContextTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + protected static function getResourceLoader() { return new EmptyResourceLoader( new HashConfig( [ 'ResourceLoaderDebug' => false, diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php index be17a6996b..6b0095c731 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php @@ -5,6 +5,8 @@ */ class ResourceLoaderSkinModuleTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong public static function provideGetStyles() { return [ diff --git a/tests/phpunit/includes/services/ServiceContainerTest.php b/tests/phpunit/includes/services/ServiceContainerTest.php index b68ee48b51..f4f56504e2 100644 --- a/tests/phpunit/includes/services/ServiceContainerTest.php +++ b/tests/phpunit/includes/services/ServiceContainerTest.php @@ -8,6 +8,8 @@ use MediaWiki\Services\ServiceContainer; */ class ServiceContainerTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + private function newServiceContainer( $extraArgs = [] ) { return new ServiceContainer( $extraArgs ); } diff --git a/tests/phpunit/includes/shell/CommandFactoryTest.php b/tests/phpunit/includes/shell/CommandFactoryTest.php index bf0f65b5e9..cb2669f8fc 100644 --- a/tests/phpunit/includes/shell/CommandFactoryTest.php +++ b/tests/phpunit/includes/shell/CommandFactoryTest.php @@ -10,6 +10,9 @@ use Wikimedia\TestingAccessWrapper; * @group Shell */ class CommandFactoryTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** * @covers MediaWiki\Shell\CommandFactory::create */ diff --git a/tests/phpunit/includes/shell/CommandTest.php b/tests/phpunit/includes/shell/CommandTest.php index 385dd500a6..2bafa03845 100644 --- a/tests/phpunit/includes/shell/CommandTest.php +++ b/tests/phpunit/includes/shell/CommandTest.php @@ -8,6 +8,9 @@ use Wikimedia\TestingAccessWrapper; * @group Shell */ class CommandTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + private function requirePosix() { if ( wfIsWindows() ) { $this->markTestSkipped( 'This test requires a POSIX environment.' ); diff --git a/tests/phpunit/includes/shell/FirejailCommandTest.php b/tests/phpunit/includes/shell/FirejailCommandTest.php index 7d6d7f817d..02e6e791b0 100644 --- a/tests/phpunit/includes/shell/FirejailCommandTest.php +++ b/tests/phpunit/includes/shell/FirejailCommandTest.php @@ -24,6 +24,9 @@ use MediaWiki\Shell\Shell; use Wikimedia\TestingAccessWrapper; class FirejailCommandTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + public function provideBuildFinalCommand() { global $IP; // @codingStandardsIgnoreStart diff --git a/tests/phpunit/includes/shell/ShellTest.php b/tests/phpunit/includes/shell/ShellTest.php index 2f68dbd2a6..986a66560e 100644 --- a/tests/phpunit/includes/shell/ShellTest.php +++ b/tests/phpunit/includes/shell/ShellTest.php @@ -7,6 +7,9 @@ use MediaWiki\Shell\Shell; * @group Shell */ class ShellTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + public function testIsDisabled() { $this->assertInternalType( 'bool', Shell::isDisabled() ); // sanity } diff --git a/tests/phpunit/includes/site/FileBasedSiteLookupTest.php b/tests/phpunit/includes/site/FileBasedSiteLookupTest.php index 7984795b99..ed6fbfeede 100644 --- a/tests/phpunit/includes/site/FileBasedSiteLookupTest.php +++ b/tests/phpunit/includes/site/FileBasedSiteLookupTest.php @@ -29,6 +29,8 @@ */ class FileBasedSiteLookupTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + protected function setUp() { $this->cacheFile = $this->getCacheFile(); } diff --git a/tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php b/tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php index 64cdbaa915..d2305508e5 100644 --- a/tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php +++ b/tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php @@ -29,6 +29,8 @@ use MediaWiki\Site\MediaWikiPageNameNormalizer; */ class MediaWikiPageNameNormalizerTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @dataProvider normalizePageTitleProvider */ diff --git a/tests/phpunit/includes/site/SiteExporterTest.php b/tests/phpunit/includes/site/SiteExporterTest.php index c0d8c00147..09cdea7a08 100644 --- a/tests/phpunit/includes/site/SiteExporterTest.php +++ b/tests/phpunit/includes/site/SiteExporterTest.php @@ -31,6 +31,8 @@ */ class SiteExporterTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function testConstructor_InvalidArgument() { $this->setExpectedException( 'InvalidArgumentException' ); diff --git a/tests/phpunit/includes/site/SiteImporterTest.php b/tests/phpunit/includes/site/SiteImporterTest.php index ea49429c3b..8a43bf8020 100644 --- a/tests/phpunit/includes/site/SiteImporterTest.php +++ b/tests/phpunit/includes/site/SiteImporterTest.php @@ -31,6 +31,8 @@ */ class SiteImporterTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + private function newSiteImporter( array $expectedSites, $errorCount ) { $store = $this->getMockBuilder( 'SiteStore' )->getMock(); diff --git a/tests/phpunit/includes/site/SitesCacheFileBuilderTest.php b/tests/phpunit/includes/site/SitesCacheFileBuilderTest.php index af94a9d2c2..6514beb01f 100644 --- a/tests/phpunit/includes/site/SitesCacheFileBuilderTest.php +++ b/tests/phpunit/includes/site/SitesCacheFileBuilderTest.php @@ -29,6 +29,8 @@ */ class SitesCacheFileBuilderTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + protected function setUp() { $this->cacheFile = $this->getCacheFile(); } diff --git a/tests/phpunit/includes/utils/AvroValidatorTest.php b/tests/phpunit/includes/utils/AvroValidatorTest.php index 7559e22499..902f6d96f3 100644 --- a/tests/phpunit/includes/utils/AvroValidatorTest.php +++ b/tests/phpunit/includes/utils/AvroValidatorTest.php @@ -10,6 +10,9 @@ */ class AvroValidatorTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + public function setUp() { if ( !class_exists( 'AvroSchema' ) ) { $this->markTestSkipped( 'Avro is required to run the AvroValidatorTest' ); diff --git a/tests/phpunit/includes/utils/ClassCollectorTest.php b/tests/phpunit/includes/utils/ClassCollectorTest.php index e8a228e314..8e07b5efde 100644 --- a/tests/phpunit/includes/utils/ClassCollectorTest.php +++ b/tests/phpunit/includes/utils/ClassCollectorTest.php @@ -5,6 +5,8 @@ */ class ClassCollectorTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public static function provideCases() { return [ [ diff --git a/tests/phpunit/includes/utils/FileContentsHasherTest.php b/tests/phpunit/includes/utils/FileContentsHasherTest.php index 0ee4c1342d..b3885bdd25 100644 --- a/tests/phpunit/includes/utils/FileContentsHasherTest.php +++ b/tests/phpunit/includes/utils/FileContentsHasherTest.php @@ -5,6 +5,8 @@ */ class FileContentsHasherTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function provideSingleFile() { return array_map( function ( $file ) { return [ $file, file_get_contents( $file ) ]; diff --git a/tests/phpunit/includes/utils/MWCryptHashTest.php b/tests/phpunit/includes/utils/MWCryptHashTest.php index 905d14ca09..13151abd6d 100644 --- a/tests/phpunit/includes/utils/MWCryptHashTest.php +++ b/tests/phpunit/includes/utils/MWCryptHashTest.php @@ -6,6 +6,8 @@ class MWCryptHashTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function testHashLength() { if ( MWCryptHash::hashAlgo() !== 'whirlpool' ) { $this->markTestSkipped( 'Hash algorithm isn\'t whirlpool' ); diff --git a/tests/phpunit/includes/utils/MWRestrictionsTest.php b/tests/phpunit/includes/utils/MWRestrictionsTest.php index f2ea489b9f..4c05326275 100644 --- a/tests/phpunit/includes/utils/MWRestrictionsTest.php +++ b/tests/phpunit/includes/utils/MWRestrictionsTest.php @@ -1,6 +1,8 @@ getMockBuilder( Benchmarker::class ) ->setMethods( [ 'execute', 'output' ] ) diff --git a/tests/phpunit/structure/AvailableRightsTest.php b/tests/phpunit/structure/AvailableRightsTest.php index 16a9a24d89..4ab0c2c9af 100644 --- a/tests/phpunit/structure/AvailableRightsTest.php +++ b/tests/phpunit/structure/AvailableRightsTest.php @@ -8,6 +8,8 @@ */ class AvailableRightsTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * Returns all rights that should be in $wgAvailableRights + all rights * registered via the 'UserGetAllRights' hook + all "core" rights. diff --git a/tests/phpunit/structure/ExtensionJsonValidationTest.php b/tests/phpunit/structure/ExtensionJsonValidationTest.php index b19376d388..0cf4659471 100644 --- a/tests/phpunit/structure/ExtensionJsonValidationTest.php +++ b/tests/phpunit/structure/ExtensionJsonValidationTest.php @@ -22,6 +22,8 @@ */ class ExtensionJsonValidationTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + /** * @var ExtensionJsonValidator */ -- 2.20.1