Gergő Tisza has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349163 )

Change subject: Switch to librarized version of TestingAccessWrapper
......................................................................

Switch to librarized version of TestingAccessWrapper

See https://gerrit.wikimedia.org/r/#/q/topic:librarize-testing-access-wrapper
for downstream patches.

Change-Id: I52cc257e593da3d6c3b01a909e554a950225aec8
---
M composer.json
M tests/common/TestsAutoLoader.php
M tests/integration/includes/http/MWHttpRequestTestCase.php
M tests/phpunit/MediaWikiTestCase.php
D tests/phpunit/data/helpers/WellProtectedClass.php
M tests/phpunit/includes/MessageTest.php
M tests/phpunit/includes/OutputPageTest.php
M tests/phpunit/includes/PrefixSearchTest.php
D tests/phpunit/includes/TestingAccessWrapper.php
D tests/phpunit/includes/TestingAccessWrapperTest.php
M tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
M tests/phpunit/includes/api/ApiBaseTest.php
M tests/phpunit/includes/api/ApiErrorFormatterTest.php
M tests/phpunit/includes/api/ApiLoginTest.php
M tests/phpunit/includes/api/ApiMainTest.php
M tests/phpunit/includes/api/ApiMessageTest.php
M tests/phpunit/includes/auth/AbstractAuthenticationProviderTest.php
M 
tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php
M tests/phpunit/includes/auth/AuthManagerTest.php
M tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php
M tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php
M 
tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php
M tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
M tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php
M 
tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php
M 
tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
M tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php
M tests/phpunit/includes/auth/ThrottlerTest.php
M tests/phpunit/includes/changes/ChangesListBooleanFilterGroupTest.php
M tests/phpunit/includes/changes/ChangesListFilterTest.php
M tests/phpunit/includes/changes/ChangesListStringOptionsFilterGroupTest.php
M tests/phpunit/includes/debug/logger/MonologSpiTest.php
M tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php
M tests/phpunit/includes/debug/logger/monolog/LineFormatterTest.php
M tests/phpunit/includes/deferred/CdnCacheUpdateTest.php
M tests/phpunit/includes/filebackend/FileBackendTest.php
M tests/phpunit/includes/filebackend/SwiftFileBackendTest.php
M tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php
M tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php
M tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
M tests/phpunit/includes/objectcache/RedisBagOStuffTest.php
M tests/phpunit/includes/registration/ExtensionProcessorTest.php
M tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
M tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
M tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
M tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
M tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
M tests/phpunit/includes/search/SearchEnginePrefixTest.php
M tests/phpunit/includes/session/BotPasswordSessionProviderTest.php
M tests/phpunit/includes/session/CookieSessionProviderTest.php
M tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php
M tests/phpunit/includes/session/PHPSessionHandlerTest.php
M tests/phpunit/includes/session/SessionBackendTest.php
M tests/phpunit/includes/session/SessionManagerTest.php
M tests/phpunit/includes/session/SessionProviderTest.php
M tests/phpunit/includes/session/SessionTest.php
M tests/phpunit/includes/session/TestUtils.php
M tests/phpunit/includes/session/TokenTest.php
M tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
M tests/phpunit/includes/specials/SpecialRecentchangesTest.php
M tests/phpunit/includes/specials/SpecialWatchlistTest.php
M tests/phpunit/includes/user/BotPasswordTest.php
M tests/phpunit/includes/user/CentralIdLookupTest.php
M tests/phpunit/includes/user/UserTest.php
M tests/phpunit/structure/ApiDocumentationTest.php
M tests/phpunit/structure/ContentHandlerSanityTest.php
66 files changed, 287 insertions(+), 492 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/63/349163/1

diff --git a/composer.json b/composer.json
index 36fd0ee..be8ce15 100644
--- a/composer.json
+++ b/composer.json
@@ -49,18 +49,19 @@
        },
        "require-dev": {
                "composer/spdx-licenses": "1.1.4",
+               "hamcrest/hamcrest-php": "^2.0",
                "jakub-onderka/php-parallel-lint": "0.9.2",
+               "jetbrains/phpstorm-stubs": 
"dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
                "justinrainbow/json-schema": "~3.0",
                "mediawiki/mediawiki-codesniffer": "0.7.2",
-               "jetbrains/phpstorm-stubs": 
"dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
                "monolog/monolog": "~1.22.1",
                "nikic/php-parser": "2.1.0",
                "nmred/kafka-php": "0.1.5",
                "phpunit/phpunit": "4.8.35",
+               "psy/psysh": "0.8.3",
                "wikimedia/avro": "1.7.7",
-               "hamcrest/hamcrest-php": "^2.0",
-               "wmde/hamcrest-html-matchers": "^0.1.0",
-               "psy/psysh": "0.8.3"
+               "wikimedia/testing-access-wrapper": "~1.0",
+               "wmde/hamcrest-html-matchers": "^0.1.0"
        },
        "suggest": {
                "ext-apc": "Local data and opcode cache",
diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php
index 2a4c43ff..3de3ba7 100644
--- a/tests/common/TestsAutoLoader.php
+++ b/tests/common/TestsAutoLoader.php
@@ -64,7 +64,6 @@
 
        # tests/phpunit/includes
        'RevisionStorageTest' => 
"$testDir/phpunit/includes/RevisionStorageTest.php",
-       'TestingAccessWrapper' => 
"$testDir/phpunit/includes/TestingAccessWrapper.php",
        'TestLogger' => "$testDir/phpunit/includes/TestLogger.php",
 
        # tests/phpunit/includes/api
@@ -171,4 +170,4 @@
        'ParserTestFileSuite' => 
"$testDir/phpunit/suites/ParserTestFileSuite.php",
        'ParserTestTopLevelSuite' => 
"$testDir/phpunit/suites/ParserTestTopLevelSuite.php",
 ];
-// @codingStandardsIgnoreEnd
\ No newline at end of file
+// @codingStandardsIgnoreEnd
diff --git a/tests/integration/includes/http/MWHttpRequestTestCase.php 
b/tests/integration/includes/http/MWHttpRequestTestCase.php
index 6d1fdf5..5457696 100644
--- a/tests/integration/includes/http/MWHttpRequestTestCase.php
+++ b/tests/integration/includes/http/MWHttpRequestTestCase.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 class MWHttpRequestTestCase extends PHPUnit_Framework_TestCase {
        protected static $httpEngine;
        protected $oldHttpEngine;
diff --git a/tests/phpunit/MediaWikiTestCase.php 
b/tests/phpunit/MediaWikiTestCase.php
index 29da00d..bc9f97c 100644
--- a/tests/phpunit/MediaWikiTestCase.php
+++ b/tests/phpunit/MediaWikiTestCase.php
@@ -1,9 +1,11 @@
 <?php
+
 use MediaWiki\Logger\LegacySpi;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\Logger\MonologSpi;
 use MediaWiki\MediaWikiServices;
 use Psr\Log\LoggerInterface;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @since 1.18
diff --git a/tests/phpunit/data/helpers/WellProtectedClass.php 
b/tests/phpunit/data/helpers/WellProtectedClass.php
deleted file mode 100644
index f2b5a14..0000000
--- a/tests/phpunit/data/helpers/WellProtectedClass.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-class WellProtectedParentClass {
-       private $privateParentProperty;
-
-       public function __construct() {
-               $this->privateParentProperty = 9000;
-       }
-
-       private function incrementPrivateParentPropertyValue() {
-               $this->privateParentProperty++;
-       }
-
-       public function getPrivateParentProperty() {
-               return $this->privateParentProperty;
-       }
-}
-
-class WellProtectedClass extends WellProtectedParentClass {
-       protected static $staticProperty = 'sp';
-       private static $staticPrivateProperty = 'spp';
-
-       protected $property;
-       private $privateProperty;
-
-       protected static function staticMethod() {
-               return 'sm';
-       }
-
-       private static function staticPrivateMethod() {
-               return 'spm';
-       }
-
-       public function __construct() {
-               parent::__construct();
-               $this->property = 1;
-               $this->privateProperty = 42;
-       }
-
-       protected function incrementPropertyValue() {
-               $this->property++;
-       }
-
-       private function incrementPrivatePropertyValue() {
-               $this->privateProperty++;
-       }
-
-       public function getProperty() {
-               return $this->property;
-       }
-
-       public function getPrivateProperty() {
-               return $this->privateProperty;
-       }
-
-       protected function whatSecondArg( $a, $b = false ) {
-               return $b;
-       }
-}
diff --git a/tests/phpunit/includes/MessageTest.php 
b/tests/phpunit/includes/MessageTest.php
index 58087c1..912bffe 100644
--- a/tests/phpunit/includes/MessageTest.php
+++ b/tests/phpunit/includes/MessageTest.php
@@ -1,5 +1,6 @@
 <?php
-use MediaWiki\MediaWikiServices;
+
+use Wikimedia\TestingAccessWrapper;
 
 class MessageTest extends MediaWikiLangTestCase {
 
diff --git a/tests/phpunit/includes/OutputPageTest.php 
b/tests/phpunit/includes/OutputPageTest.php
index 9893f8c..97df585 100644
--- a/tests/phpunit/includes/OutputPageTest.php
+++ b/tests/phpunit/includes/OutputPageTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  *
  * @author Matthew Flaschen
diff --git a/tests/phpunit/includes/PrefixSearchTest.php 
b/tests/phpunit/includes/PrefixSearchTest.php
index cf2e120..31ee75b 100644
--- a/tests/phpunit/includes/PrefixSearchTest.php
+++ b/tests/phpunit/includes/PrefixSearchTest.php
@@ -1,4 +1,7 @@
 <?php
+
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group Search
  * @group Database
diff --git a/tests/phpunit/includes/TestingAccessWrapper.php 
b/tests/phpunit/includes/TestingAccessWrapper.php
deleted file mode 100644
index 7332e15..0000000
--- a/tests/phpunit/includes/TestingAccessWrapper.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-/**
- * Circumvent access restrictions on object internals
- *
- * This can be helpful for writing tests that can probe object internals,
- * without having to modify the class under test to accomodate.
- *
- * Wrap an object with private methods as follows:
- *    $title = TestingAccessWrapper::newFromObject( Title::newFromDBkey( $key 
) );
- *
- * You can access private and protected instance methods and variables:
- *    $formatter = $title->getTitleFormatter();
- *
- * TODO:
- * - Organize other helper classes in tests/testHelpers.inc into a directory.
- */
-class TestingAccessWrapper {
-       /** @var mixed The object, or the class name for static-only access */
-       public $object;
-
-       /**
-        * Return the same object, without access restrictions.
-        */
-       public static function newFromObject( $object ) {
-               if ( !is_object( $object ) ) {
-                       throw new InvalidArgumentException( __METHOD__ . ' must 
be called with an object' );
-               }
-               $wrapper = new TestingAccessWrapper();
-               $wrapper->object = $object;
-               return $wrapper;
-       }
-
-       /**
-        * Allow access to non-public static methods and properties of the 
class.
-        * Use non-static access,
-        */
-       public static function newFromClass( $className ) {
-               if ( !is_string( $className ) ) {
-                       throw new InvalidArgumentException( __METHOD__ . ' must 
be called with a class name' );
-               }
-               $wrapper = new TestingAccessWrapper();
-               $wrapper->object = $className;
-               return $wrapper;
-       }
-
-       public function __call( $method, $args ) {
-               $methodReflection = $this->getMethod( $method );
-
-               if ( $this->isStatic() && !$methodReflection->isStatic() ) {
-                       throw new DomainException( __METHOD__ . ': Cannot call 
non-static when wrapping static class' );
-               }
-
-               return $methodReflection->invokeArgs( 
$methodReflection->isStatic() ? null : $this->object,
-                       $args );
-       }
-
-       public function __set( $name, $value ) {
-               $propertyReflection = $this->getProperty( $name );
-
-               if ( $this->isStatic() && !$propertyReflection->isStatic() ) {
-                       throw new DomainException( __METHOD__ . ': Cannot set 
property when wrapping static class' );
-               }
-
-               $propertyReflection->setValue( $this->object, $value );
-       }
-
-       public function __get( $name ) {
-               $propertyReflection = $this->getProperty( $name );
-
-               if ( $this->isStatic() && !$propertyReflection->isStatic() ) {
-                       throw new DomainException( __METHOD__ . ': Cannot get 
property when wrapping static class' );
-               }
-
-               return $propertyReflection->getValue( $this->object );
-       }
-
-       private function isStatic() {
-               return is_string( $this->object );
-       }
-
-       /**
-        * Return a property and make it accessible.
-        * @param string $name
-        * @return ReflectionMethod
-        */
-       private function getMethod( $name ) {
-               $classReflection = new ReflectionClass( $this->object );
-               $methodReflection = $classReflection->getMethod( $name );
-               $methodReflection->setAccessible( true );
-               return $methodReflection;
-       }
-
-       /**
-        * Return a property and make it accessible.
-        *
-        * ReflectionClass::getProperty() fails if the private property is 
defined
-        * in a parent class. This works more like ReflectionClass::getMethod().
-        *
-        * @param string $name
-        * @return ReflectionProperty
-        * @throws ReflectionException
-        */
-       private function getProperty( $name ) {
-               $classReflection = new ReflectionClass( $this->object );
-               try {
-                       $propertyReflection = $classReflection->getProperty( 
$name );
-               } catch ( ReflectionException $ex ) {
-                       while ( true ) {
-                               $classReflection = 
$classReflection->getParentClass();
-                               if ( !$classReflection ) {
-                                       throw $ex;
-                               }
-                               try {
-                                       $propertyReflection = 
$classReflection->getProperty( $name );
-                               } catch ( ReflectionException $ex2 ) {
-                                       continue;
-                               }
-                               if ( $propertyReflection->isPrivate() ) {
-                                       break;
-                               } else {
-                                       throw $ex;
-                               }
-                       }
-               }
-               $propertyReflection->setAccessible( true );
-               return $propertyReflection;
-       }
-}
diff --git a/tests/phpunit/includes/TestingAccessWrapperTest.php 
b/tests/phpunit/includes/TestingAccessWrapperTest.php
deleted file mode 100644
index 23eb023..0000000
--- a/tests/phpunit/includes/TestingAccessWrapperTest.php
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-
-class TestingAccessWrapperTest extends MediaWikiTestCase {
-       protected $raw;
-       protected $wrapped;
-       protected $wrappedStatic;
-
-       function setUp() {
-               parent::setUp();
-
-               require_once __DIR__ . 
'/../data/helpers/WellProtectedClass.php';
-               $this->raw = new WellProtectedClass();
-               $this->wrapped = TestingAccessWrapper::newFromObject( 
$this->raw );
-               $this->wrappedStatic = TestingAccessWrapper::newFromClass( 
'WellProtectedClass' );
-       }
-
-       /**
-        * @expectedException InvalidArgumentException
-        */
-       function testConstructorException() {
-               TestingAccessWrapper::newFromObject( 'WellProtectedClass' );
-       }
-
-       /**
-        * @expectedException InvalidArgumentException
-        */
-       function testStaticConstructorException() {
-               TestingAccessWrapper::newFromClass( new WellProtectedClass() );
-       }
-
-       function testGetProperty() {
-               $this->assertSame( 1, $this->wrapped->property );
-               $this->assertSame( 42, $this->wrapped->privateProperty );
-               $this->assertSame( 9000, $this->wrapped->privateParentProperty 
);
-               $this->assertSame( 'sp', $this->wrapped->staticProperty );
-               $this->assertSame( 'spp', $this->wrapped->staticPrivateProperty 
);
-               $this->assertSame( 'sp', $this->wrappedStatic->staticProperty );
-               $this->assertSame( 'spp', 
$this->wrappedStatic->staticPrivateProperty );
-       }
-
-       /**
-        * @expectedException DomainException
-        */
-       function testGetException() {
-               $this->wrappedStatic->property;
-       }
-
-       function testSetProperty() {
-               $this->wrapped->property = 10;
-               $this->assertSame( 10, $this->wrapped->property );
-               $this->assertSame( 10, $this->raw->getProperty() );
-
-               $this->wrapped->privateProperty = 11;
-               $this->assertSame( 11, $this->wrapped->privateProperty );
-               $this->assertSame( 11, $this->raw->getPrivateProperty() );
-
-               $this->wrapped->privateParentProperty = 12;
-               $this->assertSame( 12, $this->wrapped->privateParentProperty );
-               $this->assertSame( 12, $this->raw->getPrivateParentProperty() );
-
-               $this->wrapped->staticProperty = 'x';
-               $this->assertSame( 'x', $this->wrapped->staticProperty );
-               $this->assertSame( 'x', $this->wrappedStatic->staticProperty );
-
-               $this->wrapped->staticPrivateProperty = 'y';
-               $this->assertSame( 'y', $this->wrapped->staticPrivateProperty );
-               $this->assertSame( 'y', 
$this->wrappedStatic->staticPrivateProperty );
-
-               $this->wrappedStatic->staticProperty = 'X';
-               $this->assertSame( 'X', $this->wrapped->staticProperty );
-               $this->assertSame( 'X', $this->wrappedStatic->staticProperty );
-
-               $this->wrappedStatic->staticPrivateProperty = 'Y';
-               $this->assertSame( 'Y', $this->wrapped->staticPrivateProperty );
-               $this->assertSame( 'Y', 
$this->wrappedStatic->staticPrivateProperty );
-
-               // don't rely on PHPUnit to restore static properties
-               $this->wrapped->staticProperty = 'sp';
-               $this->wrapped->staticPrivateProperty = 'spp';
-       }
-
-       /**
-        * @expectedException DomainException
-        */
-       function testSetException() {
-               $this->wrappedStatic->property = 1;
-       }
-
-       function testCallMethod() {
-               $this->wrapped->incrementPropertyValue();
-               $this->assertSame( 2, $this->wrapped->property );
-               $this->assertSame( 2, $this->raw->getProperty() );
-
-               $this->wrapped->incrementPrivatePropertyValue();
-               $this->assertSame( 43, $this->wrapped->privateProperty );
-               $this->assertSame( 43, $this->raw->getPrivateProperty() );
-
-               $this->wrapped->incrementPrivateParentPropertyValue();
-               $this->assertSame( 9001, $this->wrapped->privateParentProperty 
);
-               $this->assertSame( 9001, $this->raw->getPrivateParentProperty() 
);
-
-               $this->assertSame( 'sm', $this->wrapped->staticMethod() );
-               $this->assertSame( 'spm', $this->wrapped->staticPrivateMethod() 
);
-               $this->assertSame( 'sm', $this->wrappedStatic->staticMethod() );
-               $this->assertSame( 'spm', 
$this->wrappedStatic->staticPrivateMethod() );
-       }
-
-       function testCallMethodTwoArgs() {
-               $this->assertSame( 'two', $this->wrapped->whatSecondArg( 'one', 
'two' ) );
-       }
-
-       /**
-        * @expectedException DomainException
-        */
-       function testCallMethodException() {
-               $this->wrappedStatic->incrementPropertyValue();
-       }
-
-}
diff --git a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php 
b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
index 76d1cb9..872c580 100644
--- a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
+++ b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @covers WatchedItemQueryService
  */
diff --git a/tests/phpunit/includes/api/ApiBaseTest.php 
b/tests/phpunit/includes/api/ApiBaseTest.php
index 7327e85..253ac95 100644
--- a/tests/phpunit/includes/api/ApiBaseTest.php
+++ b/tests/phpunit/includes/api/ApiBaseTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group API
  * @group Database
diff --git a/tests/phpunit/includes/api/ApiErrorFormatterTest.php 
b/tests/phpunit/includes/api/ApiErrorFormatterTest.php
index eaa4d17..a2c0d39 100644
--- a/tests/phpunit/includes/api/ApiErrorFormatterTest.php
+++ b/tests/phpunit/includes/api/ApiErrorFormatterTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group API
  */
diff --git a/tests/phpunit/includes/api/ApiLoginTest.php 
b/tests/phpunit/includes/api/ApiLoginTest.php
index ea8c9ca..3cf1fde 100644
--- a/tests/phpunit/includes/api/ApiLoginTest.php
+++ b/tests/phpunit/includes/api/ApiLoginTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group API
  * @group Database
diff --git a/tests/phpunit/includes/api/ApiMainTest.php 
b/tests/phpunit/includes/api/ApiMainTest.php
index a1b7a87..3e6ceb7 100644
--- a/tests/phpunit/includes/api/ApiMainTest.php
+++ b/tests/phpunit/includes/api/ApiMainTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group API
  * @group Database
diff --git a/tests/phpunit/includes/api/ApiMessageTest.php 
b/tests/phpunit/includes/api/ApiMessageTest.php
index e405b3b..c6f5a8e 100644
--- a/tests/phpunit/includes/api/ApiMessageTest.php
+++ b/tests/phpunit/includes/api/ApiMessageTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group API
  */
diff --git a/tests/phpunit/includes/auth/AbstractAuthenticationProviderTest.php 
b/tests/phpunit/includes/auth/AbstractAuthenticationProviderTest.php
index 89e48f7..a3b0df5 100644
--- a/tests/phpunit/includes/auth/AbstractAuthenticationProviderTest.php
+++ b/tests/phpunit/includes/auth/AbstractAuthenticationProviderTest.php
@@ -2,6 +2,8 @@
 
 namespace MediaWiki\Auth;
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group AuthManager
  * @covers MediaWiki\Auth\AbstractAuthenticationProvider
@@ -9,7 +11,7 @@
 class AbstractAuthenticationProviderTest extends \MediaWikiTestCase {
        public function testAbstractAuthenticationProvider() {
                $provider = $this->getMockForAbstractClass( 
AbstractAuthenticationProvider::class );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $obj = $this->getMockForAbstractClass( 
'Psr\Log\LoggerInterface' );
                $provider->setLogger( $obj );
diff --git 
a/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php
 
b/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php
index a57682b..76d8ee9 100644
--- 
a/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php
+++ 
b/tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php
@@ -3,6 +3,7 @@
 namespace MediaWiki\Auth;
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group AuthManager
@@ -13,14 +14,14 @@
                $provider = $this->getMockForAbstractClass(
                        AbstractPasswordPrimaryAuthenticationProvider::class
                );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $this->assertTrue( $providerPriv->authoritative );
 
                $provider = $this->getMockForAbstractClass(
                        AbstractPasswordPrimaryAuthenticationProvider::class,
                        [ [ 'authoritative' => false ] ]
                );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $this->assertFalse( $providerPriv->authoritative );
        }
 
@@ -29,7 +30,7 @@
                        AbstractPasswordPrimaryAuthenticationProvider::class
                );
                $provider->setConfig( 
MediaWikiServices::getInstance()->getMainConfig() );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $obj = $providerPriv->getPasswordFactory();
                $this->assertInstanceOf( 'PasswordFactory', $obj );
@@ -42,7 +43,7 @@
                );
                $provider->setConfig( 
MediaWikiServices::getInstance()->getMainConfig() );
                $provider->setLogger( new \Psr\Log\NullLogger() );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $obj = $providerPriv->getPassword( null );
                $this->assertInstanceOf( 'Password', $obj );
@@ -61,7 +62,7 @@
                        MediaWikiServices::getInstance()->getMainConfig()
                ] ) );
                $provider->setLogger( new \Psr\Log\NullLogger() );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $this->mergeMwGlobalArrayValue( 'wgHooks', [ 
'ResetPasswordExpiration' => [] ] );
 
@@ -109,7 +110,7 @@
                );
                $provider->setConfig( 
MediaWikiServices::getInstance()->getMainConfig() );
                $provider->setLogger( new \Psr\Log\NullLogger() );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $this->assertEquals( $uppStatus, 
$providerPriv->checkPasswordValidity( 'foo', 'bar' ) );
 
@@ -133,7 +134,7 @@
                $provider->setConfig( $config );
                $provider->setLogger( new \Psr\Log\NullLogger() );
                $provider->setManager( $manager );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $manager->removeAuthenticationSessionData( null );
                $status = \Status::newGood();
@@ -161,7 +162,7 @@
                        AbstractPasswordPrimaryAuthenticationProvider::class,
                        [ [ 'authoritative' => false ] ]
                );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $req = new PasswordAuthenticationRequest;
 
@@ -172,7 +173,7 @@
                        AbstractPasswordPrimaryAuthenticationProvider::class,
                        [ [ 'authoritative' => true ] ]
                );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $req->password = '';
                $ret = $providerPriv->failResponse( $req );
diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php 
b/tests/phpunit/includes/auth/AuthManagerTest.php
index 5c268f8..e8ef3ae 100644
--- a/tests/phpunit/includes/auth/AuthManagerTest.php
+++ b/tests/phpunit/includes/auth/AuthManagerTest.php
@@ -7,6 +7,7 @@
 use Psr\Log\LogLevel;
 use StatusValue;
 use Wikimedia\ScopedCallback;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group AuthManager
@@ -127,7 +128,7 @@
                }
                $this->manager = new AuthManager( $this->request, $this->config 
);
                $this->manager->setLogger( $this->logger );
-               $this->managerPriv = \TestingAccessWrapper::newFromObject( 
$this->manager );
+               $this->managerPriv = TestingAccessWrapper::newFromObject( 
$this->manager );
        }
 
        /**
@@ -170,7 +171,7 @@
                        'logger' => new \Psr\Log\NullLogger(),
                        'store' => new \HashBagOStuff(),
                ] );
-               \TestingAccessWrapper::newFromObject( $manager )->getProvider( 
(string)$provider );
+               TestingAccessWrapper::newFromObject( $manager )->getProvider( 
(string)$provider );
 
                $reset = 
\MediaWiki\Session\TestUtils::setSessionManagerSingleton( $manager );
 
@@ -196,7 +197,7 @@
                $this->assertSame( \RequestContext::getMain()->getRequest(), 
$singleton->getRequest() );
                $this->assertSame(
                        \RequestContext::getMain()->getConfig(),
-                       \TestingAccessWrapper::newFromObject( $singleton 
)->config
+                       TestingAccessWrapper::newFromObject( $singleton 
)->config
                );
        }
 
diff --git 
a/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php
 
b/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php
index 68f574b..111c855 100644
--- 
a/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php
+++ 
b/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php
@@ -2,6 +2,8 @@
 
 namespace MediaWiki\Auth;
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group AuthManager
  * @group Database
@@ -10,7 +12,7 @@
 class CheckBlocksSecondaryAuthenticationProviderTest extends 
\MediaWikiTestCase {
        public function testConstructor() {
                $provider = new CheckBlocksSecondaryAuthenticationProvider();
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $config = new \HashConfig( [
                        'BlockDisablesLogin' => false
                ] );
@@ -20,7 +22,7 @@
                $provider = new CheckBlocksSecondaryAuthenticationProvider(
                        [ 'blockDisablesLogin' => true ]
                );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $config = new \HashConfig( [
                        'BlockDisablesLogin' => false
                ] );
diff --git 
a/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php
 
b/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php
index 3fc45a4..9222843 100644
--- 
a/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php
+++ 
b/tests/phpunit/includes/auth/ConfirmLinkSecondaryAuthenticationProviderTest.php
@@ -2,6 +2,8 @@
 
 namespace MediaWiki\Auth;
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group AuthManager
  * @covers MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider
@@ -126,7 +128,7 @@
                        ->will( $this->returnValue( "BadReq" ) );
 
                $user = \User::newFromName( 'UTSysop' );
-               $provider = \TestingAccessWrapper::newFromObject(
+               $provider = TestingAccessWrapper::newFromObject(
                        new ConfirmLinkSecondaryAuthenticationProvider
                );
                $request = new \FauxRequest();
@@ -171,7 +173,7 @@
                        $r->action = AuthManager::ACTION_CHANGE;
                        $r->username = $user->getName();
                }
-               $this->assertEquals( $expectReqs, 
\TestingAccessWrapper::newFromObject( $req )->linkRequests );
+               $this->assertEquals( $expectReqs, 
TestingAccessWrapper::newFromObject( $req )->linkRequests );
        }
 
        public function testContinueLinkAttempt() {
@@ -190,7 +192,7 @@
                        ->will( $this->returnValue( $obj ) );
                $this->assertSame(
                        $obj,
-                       \TestingAccessWrapper::newFromObject( $mock 
)->continueLinkAttempt( $user, 'state', $reqs )
+                       TestingAccessWrapper::newFromObject( $mock 
)->continueLinkAttempt( $user, 'state', $reqs )
                );
 
                // Now test the actual functioning
@@ -224,7 +226,7 @@
                $request = new \FauxRequest();
                $manager = new AuthManager( $request, $config );
                $provider->setManager( $manager );
-               $provider = \TestingAccessWrapper::newFromObject( $provider );
+               $provider = TestingAccessWrapper::newFromObject( $provider );
 
                $req = new ConfirmLinkAuthenticationRequest( $reqs );
 
diff --git 
a/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php
 
b/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php
index ca6689a..3757069 100644
--- 
a/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php
+++ 
b/tests/phpunit/includes/auth/EmailNotificationSecondaryAuthenticationProviderTest.php
@@ -3,6 +3,7 @@
 namespace MediaWiki\Auth;
 
 use Psr\Log\LoggerInterface;
+use Wikimedia\TestingAccessWrapper;
 
 class EmailNotificationSecondaryAuthenticationProviderTest extends 
\PHPUnit_Framework_TestCase {
        public function testConstructor() {
@@ -13,14 +14,14 @@
 
                $provider = new 
EmailNotificationSecondaryAuthenticationProvider();
                $provider->setConfig( $config );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $this->assertTrue( $providerPriv->sendConfirmationEmail );
 
                $provider = new 
EmailNotificationSecondaryAuthenticationProvider( [
                        'sendConfirmationEmail' => false,
                ] );
                $provider->setConfig( $config );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $this->assertFalse( $providerPriv->sendConfirmationEmail );
        }
 
diff --git 
a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
 
b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
index 6e2058c..b89f1e0 100644
--- 
a/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
+++ 
b/tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
@@ -3,6 +3,7 @@
 namespace MediaWiki\Auth;
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group AuthManager
@@ -131,7 +132,7 @@
                $provider->setConfig( $this->config );
                $provider->setLogger( new \Psr\Log\NullLogger() );
                $provider->setManager( $this->manager );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $user = $this->getMutableTestUser()->getUser();
                $userName = $user->getName();
diff --git 
a/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php 
b/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php
index 3f90169..9bcab77 100644
--- a/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php
+++ b/tests/phpunit/includes/auth/RememberMeAuthenticationRequestTest.php
@@ -2,6 +2,8 @@
 
 namespace MediaWiki\Auth;
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group AuthManager
  * @covers MediaWiki\Auth\RememberMeAuthenticationRequest
@@ -17,7 +19,7 @@
 
        public function testGetFieldInfo_2() {
                $req = new RememberMeAuthenticationRequest();
-               $reqWrapper = \TestingAccessWrapper::newFromObject( $req );
+               $reqWrapper = TestingAccessWrapper::newFromObject( $req );
 
                $reqWrapper->expiration = 30 * 24 * 3600;
                $this->assertNotEmpty( $req->getFieldInfo() );
@@ -28,7 +30,7 @@
 
        protected function getInstance( array $args = [] ) {
                $req = new RememberMeAuthenticationRequest();
-               $reqWrapper = \TestingAccessWrapper::newFromObject( $req );
+               $reqWrapper = TestingAccessWrapper::newFromObject( $req );
                $reqWrapper->expiration = $args[0];
                return $req;
        }
diff --git 
a/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php
 
b/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php
index 90ed542..f454a96 100644
--- 
a/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php
+++ 
b/tests/phpunit/includes/auth/ResetPasswordSecondaryAuthenticationProviderTest.php
@@ -2,6 +2,8 @@
 
 namespace MediaWiki\Auth;
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group AuthManager
  * @covers MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider
@@ -85,7 +87,7 @@
                ] );
                $manager = new AuthManager( new \FauxRequest, $config );
                $provider->setManager( $manager );
-               $provider = \TestingAccessWrapper::newFromObject( $provider );
+               $provider = TestingAccessWrapper::newFromObject( $provider );
 
                $msg = wfMessage( 'foo' );
                $skipReq = new ButtonAuthenticationRequest(
diff --git 
a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
 
b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
index 8d9509e..6f45fa4 100644
--- 
a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
+++ 
b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
@@ -4,6 +4,7 @@
 
 use MediaWiki\MediaWikiServices;
 use Wikimedia\ScopedCallback;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group AuthManager
@@ -106,13 +107,13 @@
                        'PasswordReminderResendTime' => 101,
                ] );
 
-               $p = \TestingAccessWrapper::newFromObject( new 
TemporaryPasswordPrimaryAuthenticationProvider() );
+               $p = TestingAccessWrapper::newFromObject( new 
TemporaryPasswordPrimaryAuthenticationProvider() );
                $p->setConfig( $config );
                $this->assertSame( false, $p->emailEnabled );
                $this->assertSame( 100, $p->newPasswordExpiry );
                $this->assertSame( 101, $p->passwordReminderResendTime );
 
-               $p = \TestingAccessWrapper::newFromObject( new 
TemporaryPasswordPrimaryAuthenticationProvider( [
+               $p = TestingAccessWrapper::newFromObject( new 
TemporaryPasswordPrimaryAuthenticationProvider( [
                        'emailEnabled' => true,
                        'newPasswordExpiry' => 42,
                        'passwordReminderResendTime' => 43,
@@ -135,7 +136,7 @@
                $pwhash = $passwordFactory->newFromPlaintext( 'password' 
)->toString();
 
                $provider = $this->getProvider();
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $this->assertFalse( $provider->testUserCanAuthenticate( 
'<invalid>' ) );
                $this->assertFalse( $provider->testUserCanAuthenticate( 
'DoesNotExist' ) );
@@ -249,7 +250,7 @@
                $reqs = [ PasswordAuthenticationRequest::class => $req ];
 
                $provider = $this->getProvider();
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
 
                $providerPriv->newPasswordExpiry = 100;
 
@@ -573,7 +574,7 @@
                ScopedCallback::consume( $resetMailer );
                $this->assertTrue( $mailed );
 
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
                $req->username = '<invalid>';
                $status = $priv->sendPasswordResetEmail( $req );
                $this->assertEquals( \Status::newFatal( 'noname' ), $status );
diff --git 
a/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php 
b/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php
index ee82832..58982de 100644
--- a/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php
+++ b/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php
@@ -2,6 +2,8 @@
 
 namespace MediaWiki\Auth;
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group AuthManager
  * @group Database
@@ -10,7 +12,7 @@
 class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase {
        public function testConstructor() {
                $provider = new ThrottlePreAuthenticationProvider();
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $config = new \HashConfig( [
                        'AccountCreationThrottle' => [ [
                                'count' => 123,
@@ -26,11 +28,11 @@
                        'accountCreationThrottle' => [ [ 'count' => 123, 
'seconds' => 86400 ] ],
                        'passwordAttemptThrottle' => [ [ 'count' => 5, 
'seconds' => 300 ] ]
                ], $providerPriv->throttleSettings );
-               $accountCreationThrottle = \TestingAccessWrapper::newFromObject(
+               $accountCreationThrottle = TestingAccessWrapper::newFromObject(
                        $providerPriv->accountCreationThrottle );
                $this->assertSame( [ [ 'count' => 123, 'seconds' => 86400 ] ],
                        $accountCreationThrottle->conditions );
-               $passwordAttemptThrottle = \TestingAccessWrapper::newFromObject(
+               $passwordAttemptThrottle = TestingAccessWrapper::newFromObject(
                        $providerPriv->passwordAttemptThrottle );
                $this->assertSame( [ [ 'count' => 5, 'seconds' => 300 ] ],
                        $passwordAttemptThrottle->conditions );
@@ -39,7 +41,7 @@
                        'accountCreationThrottle' => [ [ 'count' => 43, 
'seconds' => 10000 ] ],
                        'passwordAttemptThrottle' => [ [ 'count' => 11, 
'seconds' => 100 ] ],
                ] );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $config = new \HashConfig( [
                        'AccountCreationThrottle' => [ [
                                'count' => 123,
@@ -58,15 +60,15 @@
 
                $cache = new \HashBagOStuff();
                $provider = new ThrottlePreAuthenticationProvider( [ 'cache' => 
$cache ] );
-               $providerPriv = \TestingAccessWrapper::newFromObject( $provider 
);
+               $providerPriv = TestingAccessWrapper::newFromObject( $provider 
);
                $provider->setConfig( new \HashConfig( [
                        'AccountCreationThrottle' => [ [ 'count' => 1, 
'seconds' => 1 ] ],
                        'PasswordAttemptThrottle' => [ [ 'count' => 1, 
'seconds' => 1 ] ],
                ] ) );
-               $accountCreationThrottle = \TestingAccessWrapper::newFromObject(
+               $accountCreationThrottle = TestingAccessWrapper::newFromObject(
                        $providerPriv->accountCreationThrottle );
                $this->assertSame( $cache, $accountCreationThrottle->cache );
-               $passwordAttemptThrottle = \TestingAccessWrapper::newFromObject(
+               $passwordAttemptThrottle = TestingAccessWrapper::newFromObject(
                        $providerPriv->passwordAttemptThrottle );
                $this->assertSame( $cache, $passwordAttemptThrottle->cache );
        }
diff --git a/tests/phpunit/includes/auth/ThrottlerTest.php 
b/tests/phpunit/includes/auth/ThrottlerTest.php
index 33c8ce6..f52048a 100644
--- a/tests/phpunit/includes/auth/ThrottlerTest.php
+++ b/tests/phpunit/includes/auth/ThrottlerTest.php
@@ -8,6 +8,7 @@
 use Psr\Log\AbstractLogger;
 use Psr\Log\LoggerInterface;
 use Psr\Log\NullLogger;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group AuthManager
@@ -25,7 +26,7 @@
                        [ 'type' => 'foo', 'cache' => $cache ]
                );
                $throttler->setLogger( $logger );
-               $throttlerPriv = \TestingAccessWrapper::newFromObject( 
$throttler );
+               $throttlerPriv = TestingAccessWrapper::newFromObject( 
$throttler );
                $this->assertSame( [ [ 'count' => 123, 'seconds' => 456 ] ], 
$throttlerPriv->conditions );
                $this->assertSame( 'foo', $throttlerPriv->type );
                $this->assertSame( $cache, $throttlerPriv->cache );
@@ -33,7 +34,7 @@
 
                $throttler = new Throttler( [ [ 'count' => 123, 'seconds' => 
456 ] ] );
                $throttler->setLogger( new NullLogger() );
-               $throttlerPriv = \TestingAccessWrapper::newFromObject( 
$throttler );
+               $throttlerPriv = TestingAccessWrapper::newFromObject( 
$throttler );
                $this->assertSame( [ [ 'count' => 123, 'seconds' => 456 ] ], 
$throttlerPriv->conditions );
                $this->assertSame( 'custom', $throttlerPriv->type );
                $this->assertInstanceOf( BagOStuff::class, 
$throttlerPriv->cache );
@@ -43,7 +44,7 @@
                        'seconds' => 654 ] ] ] );
                $throttler = new Throttler();
                $throttler->setLogger( new NullLogger() );
-               $throttlerPriv = \TestingAccessWrapper::newFromObject( 
$throttler );
+               $throttlerPriv = TestingAccessWrapper::newFromObject( 
$throttler );
                $this->assertSame( [ [ 'count' => 321, 'seconds' => 654 ] ], 
$throttlerPriv->conditions );
                $this->assertSame( 'password', $throttlerPriv->type );
                $this->assertInstanceOf( BagOStuff::class, 
$throttlerPriv->cache );
@@ -63,7 +64,7 @@
        public function testNormalizeThrottleConditions( $condition, 
$normalized ) {
                $throttler = new Throttler( $condition );
                $throttler->setLogger( new NullLogger() );
-               $throttlerPriv = \TestingAccessWrapper::newFromObject( 
$throttler );
+               $throttlerPriv = TestingAccessWrapper::newFromObject( 
$throttler );
                $this->assertSame( $normalized, $throttlerPriv->conditions );
        }
 
@@ -85,7 +86,7 @@
        }
 
        public function testNormalizeThrottleConditions2() {
-               $priv = \TestingAccessWrapper::newFromClass( Throttler::class );
+               $priv = TestingAccessWrapper::newFromClass( Throttler::class );
                $this->assertSame( [], $priv->normalizeThrottleConditions( null 
) );
                $this->assertSame( [], $priv->normalizeThrottleConditions( 
'bad' ) );
        }
diff --git 
a/tests/phpunit/includes/changes/ChangesListBooleanFilterGroupTest.php 
b/tests/phpunit/includes/changes/ChangesListBooleanFilterGroupTest.php
index a30702f..07dec05 100644
--- a/tests/phpunit/includes/changes/ChangesListBooleanFilterGroupTest.php
+++ b/tests/phpunit/includes/changes/ChangesListBooleanFilterGroupTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @covers ChangesListBooleanFilterGroup
  */
diff --git a/tests/phpunit/includes/changes/ChangesListFilterTest.php 
b/tests/phpunit/includes/changes/ChangesListFilterTest.php
index 1d87aeb..5546de8 100644
--- a/tests/phpunit/includes/changes/ChangesListFilterTest.php
+++ b/tests/phpunit/includes/changes/ChangesListFilterTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @covers ChangesListFilter
  */
diff --git 
a/tests/phpunit/includes/changes/ChangesListStringOptionsFilterGroupTest.php 
b/tests/phpunit/includes/changes/ChangesListStringOptionsFilterGroupTest.php
index 0f556b8..04b7ee0 100644
--- a/tests/phpunit/includes/changes/ChangesListStringOptionsFilterGroupTest.php
+++ b/tests/phpunit/includes/changes/ChangesListStringOptionsFilterGroupTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @covers ChangesListStringOptionsFilterGroup
  */
diff --git a/tests/phpunit/includes/debug/logger/MonologSpiTest.php 
b/tests/phpunit/includes/debug/logger/MonologSpiTest.php
index 0ee7d26..fda3ac6 100644
--- a/tests/phpunit/includes/debug/logger/MonologSpiTest.php
+++ b/tests/phpunit/includes/debug/logger/MonologSpiTest.php
@@ -21,7 +21,7 @@
 namespace MediaWiki\Logger;
 
 use MediaWikiTestCase;
-use TestingAccessWrapper;
+use Wikimedia\TestingAccessWrapper;
 
 class MonologSpiTest extends MediaWikiTestCase {
 
diff --git a/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php 
b/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php
index ce21412..88cd2dd 100644
--- a/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php
+++ b/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php
@@ -22,6 +22,7 @@
 
 use MediaWikiTestCase;
 use Monolog\Logger;
+use Wikimedia\TestingAccessWrapper;
 
 class KafkaHandlerTest extends MediaWikiTestCase {
 
@@ -154,7 +155,7 @@
                        ->method( 'send' )
                        ->will( $this->returnValue( true ) );
                // evil hax
-               \TestingAccessWrapper::newFromObject( $mockMethod 
)->matcher->parametersMatcher =
+               TestingAccessWrapper::newFromObject( $mockMethod 
)->matcher->parametersMatcher =
                        new 
\PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters( [
                                [ $this->anything(), $this->anything(), [ 
'words' ] ],
                                [ $this->anything(), $this->anything(), [ 
'lines' ] ]
diff --git a/tests/phpunit/includes/debug/logger/monolog/LineFormatterTest.php 
b/tests/phpunit/includes/debug/logger/monolog/LineFormatterTest.php
index f33cf7e..2768d32 100644
--- a/tests/phpunit/includes/debug/logger/monolog/LineFormatterTest.php
+++ b/tests/phpunit/includes/debug/logger/monolog/LineFormatterTest.php
@@ -24,7 +24,7 @@
 use LengthException;
 use LogicException;
 use MediaWikiTestCase;
-use TestingAccessWrapper;
+use Wikimedia\TestingAccessWrapper;
 
 class LineFormatterTest extends MediaWikiTestCase {
 
diff --git a/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php 
b/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php
index b96ec08..11b869a 100644
--- a/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php
+++ b/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 class CdnCacheUpdateTest extends MediaWikiTestCase {
        public function testPurgeMergeWeb() {
                $this->setMwGlobals( 'wgCommandLineMode', false );
diff --git a/tests/phpunit/includes/filebackend/FileBackendTest.php 
b/tests/phpunit/includes/filebackend/FileBackendTest.php
index f777206..ddcf19b 100644
--- a/tests/phpunit/includes/filebackend/FileBackendTest.php
+++ b/tests/phpunit/includes/filebackend/FileBackendTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group FileRepo
  * @group FileBackend
diff --git a/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php 
b/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php
index 6acc943..9cd2b10 100644
--- a/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php
+++ b/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group FileRepo
  * @group FileBackend
diff --git a/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php 
b/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php
index 5fbbdec..8b9abbc 100644
--- a/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php
+++ b/tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group BagOStuff
  */
diff --git a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php 
b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php
index f44baeb..b2278c3 100644
--- a/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php
+++ b/tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group BagOStuff
  */
diff --git a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php 
b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
index 18729f0..72effd7 100644
--- a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
+++ b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 class WANObjectCacheTest extends PHPUnit_Framework_TestCase  {
        /** @var WANObjectCache */
        private $cache;
diff --git a/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php 
b/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php
index 705a34a..34a72ce 100644
--- a/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php
+++ b/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php
@@ -1,4 +1,7 @@
 <?php
+
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group BagOStuff
  */
diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php 
b/tests/phpunit/includes/registration/ExtensionProcessorTest.php
index 71f760d..d15725d 100644
--- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php
+++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 class ExtensionProcessorTest extends MediaWikiTestCase {
 
        private $dir, $dirname;
diff --git a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php 
b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
index 29e1863..1f2c617 100644
--- a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
+++ b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group Cache
  * @covers MessageBlobStore
diff --git 
a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php 
b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
index 2db3c16..cef4a29 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group ResourceLoader
  */
diff --git 
a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php 
b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
index 3877288..0015486 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group ResourceLoader
  */
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php 
b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
index 2618e78..af3212a 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 class ResourceLoaderTest extends ResourceLoaderTestCase {
 
        protected function setUp() {
diff --git 
a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php 
b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
index 2d0d958..4cf4071 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
@@ -2,6 +2,7 @@
 
 use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\TestingAccessWrapper;
 
 class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase {
 
diff --git a/tests/phpunit/includes/search/SearchEnginePrefixTest.php 
b/tests/phpunit/includes/search/SearchEnginePrefixTest.php
index 6833893..63ed93e 100644
--- a/tests/phpunit/includes/search/SearchEnginePrefixTest.php
+++ b/tests/phpunit/includes/search/SearchEnginePrefixTest.php
@@ -1,5 +1,7 @@
 <?php
+
 use MediaWiki\MediaWikiServices;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Search
diff --git a/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php 
b/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php
index 1ea27f3..90550d2 100644
--- a/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php
+++ b/tests/phpunit/includes/session/BotPasswordSessionProviderTest.php
@@ -4,6 +4,7 @@
 
 use Psr\Log\LogLevel;
 use MediaWikiTestCase;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -127,7 +128,7 @@
                $provider = new BotPasswordSessionProvider( [
                        'priority' => 40
                ] );
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
                $this->assertSame( 40, $priv->priority );
                $this->assertSame( '_BPsession', $priv->sessionCookieName );
                $this->assertSame( [], $priv->sessionCookieOptions );
@@ -136,7 +137,7 @@
                        'priority' => 40,
                        'sessionCookieName' => null,
                ] );
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
                $this->assertSame( '_BPsession', $priv->sessionCookieName );
 
                $provider = new BotPasswordSessionProvider( [
@@ -144,7 +145,7 @@
                        'sessionCookieName' => 'Foo',
                        'sessionCookieOptions' => [ 'Bar' ],
                ] );
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
                $this->assertSame( 'Foo', $priv->sessionCookieName );
                $this->assertSame( [ 'Bar' ], $priv->sessionCookieOptions );
        }
@@ -289,7 +290,7 @@
                $provider->setLogger( $logger );
 
                $backend = TestUtils::getDummySessionBackend();
-               $backendPriv = \TestingAccessWrapper::newFromObject( $backend );
+               $backendPriv = TestingAccessWrapper::newFromObject( $backend );
 
                try {
                        $provider->getAllowedUserRights( $backend );
diff --git a/tests/phpunit/includes/session/CookieSessionProviderTest.php 
b/tests/phpunit/includes/session/CookieSessionProviderTest.php
index 73485c8..a47fd9a 100644
--- a/tests/phpunit/includes/session/CookieSessionProviderTest.php
+++ b/tests/phpunit/includes/session/CookieSessionProviderTest.php
@@ -5,6 +5,7 @@
 use MediaWikiTestCase;
 use User;
 use Psr\Log\LogLevel;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -76,7 +77,7 @@
                }
 
                $config = $this->getConfig();
-               $p = \TestingAccessWrapper::newFromObject(
+               $p = TestingAccessWrapper::newFromObject(
                        new CookieSessionProvider( [ 'priority' => 1 ] )
                );
                $p->setLogger( new \TestLogger() );
@@ -95,7 +96,7 @@
                ], $p->cookieOptions );
 
                $config->set( 'SessionName', 'SessionName' );
-               $p = \TestingAccessWrapper::newFromObject(
+               $p = TestingAccessWrapper::newFromObject(
                        new CookieSessionProvider( [ 'priority' => 3 ] )
                );
                $p->setLogger( new \TestLogger() );
@@ -113,7 +114,7 @@
                        'httpOnly' => true,
                ], $p->cookieOptions );
 
-               $p = \TestingAccessWrapper::newFromObject( new 
CookieSessionProvider( [
+               $p = TestingAccessWrapper::newFromObject( new 
CookieSessionProvider( [
                        'priority' => 10,
                        'callUserSetCookiesHook' => true,
                        'cookieOptions' => [
@@ -151,7 +152,7 @@
 
                $this->assertEquals(
                        $extendedCookies,
-                       \TestingAccessWrapper::newFromObject( $provider 
)->getExtendedLoginCookies(),
+                       TestingAccessWrapper::newFromObject( $provider 
)->getExtendedLoginCookies(),
                        'List of extended cookies (subclasses can add values, 
but we\'re calling the core one here)'
                );
 
@@ -412,7 +413,7 @@
                        new \Psr\Log\NullLogger(),
                        10
                );
-               \TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
+               TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
 
                $mock = $this->getMockBuilder( 'stdClass' )
                        ->setMethods( [ 'onUserSetCookies' ] )
@@ -499,7 +500,7 @@
                        new \Psr\Log\NullLogger(),
                        10
                );
-               \TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
+               TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
                $backend->setUser( $user );
                $backend->setRememberUser( $remember );
                $backend->setForceHTTPS( $secure );
@@ -604,7 +605,7 @@
                        new \Psr\Log\NullLogger(),
                        10
                );
-               \TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
+               TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
 
                // Anonymous user
                $mock = $this->getMockBuilder( 'stdClass' )
@@ -736,7 +737,7 @@
        }
 
        public function testSetLoggedOutCookie() {
-               $provider = \TestingAccessWrapper::newFromObject( new 
CookieSessionProvider( [
+               $provider = TestingAccessWrapper::newFromObject( new 
CookieSessionProvider( [
                        'priority' => 1,
                        'sessionName' => 'MySessionName',
                        'cookieOptions' => [ 'prefix' => 'x' ],
@@ -783,7 +784,7 @@
                $provider->setLogger( new \Psr\Log\NullLogger() );
                $provider->setConfig( $this->getConfig() );
                $provider->setManager( SessionManager::singleton() );
-               $provider = \TestingAccessWrapper::newFromObject( $provider );
+               $provider = TestingAccessWrapper::newFromObject( $provider );
 
                $request = new \FauxRequest();
                $request->setCookies( [
@@ -815,7 +816,7 @@
 
        public function testGetLoginCookieExpiration() {
                $config = $this->getConfig();
-               $provider = \TestingAccessWrapper::newFromObject( new 
CookieSessionProvider( [
+               $provider = TestingAccessWrapper::newFromObject( new 
CookieSessionProvider( [
                        'priority' => 10
                ] ) );
                $provider->setLogger( new \Psr\Log\NullLogger() );
diff --git 
a/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php 
b/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php
index 7ef230e..086fa28 100644
--- a/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php
+++ b/tests/phpunit/includes/session/ImmutableSessionProviderWithCookieTest.php
@@ -4,6 +4,7 @@
 
 use MediaWikiTestCase;
 use User;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -37,7 +38,7 @@
        public function testConstructor() {
                $provider = $this->getMockBuilder( 
ImmutableSessionProviderWithCookie::class )
                        ->getMockForAbstractClass();
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
                $this->assertNull( $priv->sessionCookieName );
                $this->assertSame( [], $priv->sessionCookieOptions );
 
@@ -47,7 +48,7 @@
                                'sessionCookieOptions' => [ 'Bar' ],
                        ] ] )
                        ->getMockForAbstractClass();
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
                $this->assertSame( 'Foo', $priv->sessionCookieName );
                $this->assertSame( [ 'Bar' ], $priv->sessionCookieOptions );
 
@@ -119,7 +120,7 @@
                        'bad' => 'bad',
                ], '' );
 
-               $provider = \TestingAccessWrapper::newFromObject( 
$this->getProvider( null ) );
+               $provider = TestingAccessWrapper::newFromObject( 
$this->getProvider( null ) );
                try {
                        $provider->getSessionIdFromCookie( $request );
                        $this->fail( 'Expected exception not thrown' );
@@ -131,28 +132,28 @@
                        );
                }
 
-               $provider = \TestingAccessWrapper::newFromObject( 
$this->getProvider( 'Foo' ) );
+               $provider = TestingAccessWrapper::newFromObject( 
$this->getProvider( 'Foo' ) );
                $this->assertSame(
                        'wgfoo---------------------------',
                        $provider->getSessionIdFromCookie( $request )
                );
 
-               $provider = \TestingAccessWrapper::newFromObject( 
$this->getProvider( 'Foo', 'Bar' ) );
+               $provider = TestingAccessWrapper::newFromObject( 
$this->getProvider( 'Foo', 'Bar' ) );
                $this->assertSame(
                        'foobar--------------------------',
                        $provider->getSessionIdFromCookie( $request )
                );
 
-               $provider = \TestingAccessWrapper::newFromObject( 
$this->getProvider( 'Foo', '' ) );
+               $provider = TestingAccessWrapper::newFromObject( 
$this->getProvider( 'Foo', '' ) );
                $this->assertSame(
                        'foo-----------------------------',
                        $provider->getSessionIdFromCookie( $request )
                );
 
-               $provider = \TestingAccessWrapper::newFromObject( 
$this->getProvider( 'bad', '' ) );
+               $provider = TestingAccessWrapper::newFromObject( 
$this->getProvider( 'bad', '' ) );
                $this->assertSame( null, $provider->getSessionIdFromCookie( 
$request ) );
 
-               $provider = \TestingAccessWrapper::newFromObject( 
$this->getProvider( 'none', '' ) );
+               $provider = TestingAccessWrapper::newFromObject( 
$this->getProvider( 'none', '' ) );
                $this->assertSame( null, $provider->getSessionIdFromCookie( 
$request ) );
        }
 
@@ -185,7 +186,7 @@
 
                $provider = $this->getProvider( 'session' );
                $provider->setLogger( new \Psr\Log\NullLogger() );
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
                $priv->sessionCookieOptions = [
                        'prefix' => 'x',
                        'path' => 'CookiePath',
@@ -211,7 +212,7 @@
                        new \Psr\Log\NullLogger(),
                        10
                );
-               \TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
+               TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = false;
                $backend->setRememberUser( $remember );
                $backend->setForceHTTPS( $secure );
 
@@ -281,7 +282,7 @@
        public function testUnpersistSession() {
                $provider = $this->getProvider( 'session', '' );
                $provider->setLogger( new \Psr\Log\NullLogger() );
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
 
                // No cookie
                $priv->sessionCookieName = null;
diff --git a/tests/phpunit/includes/session/PHPSessionHandlerTest.php 
b/tests/phpunit/includes/session/PHPSessionHandlerTest.php
index 34e5e44..0a2e84e 100644
--- a/tests/phpunit/includes/session/PHPSessionHandlerTest.php
+++ b/tests/phpunit/includes/session/PHPSessionHandlerTest.php
@@ -4,6 +4,7 @@
 
 use Psr\Log\LogLevel;
 use MediaWikiTestCase;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -26,7 +27,7 @@
                $rProp = new \ReflectionProperty( PHPSessionHandler::class, 
'instance' );
                $rProp->setAccessible( true );
                if ( $rProp->getValue() ) {
-                       $old = \TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
+                       $old = TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
                        $oldManager = $old->manager;
                        $oldStore = $old->store;
                        $oldLogger = $old->logger;
@@ -40,7 +41,7 @@
        }
 
        public function testEnableFlags() {
-               $handler = \TestingAccessWrapper::newFromObject(
+               $handler = TestingAccessWrapper::newFromObject(
                        $this->getMockBuilder( PHPSessionHandler::class )
                                ->setMethods( null )
                                ->disableOriginalConstructor()
@@ -93,7 +94,7 @@
                $this->assertFalse( wfIniGetBool( 'session.use_trans_sid' ) );
 
                $this->assertNotNull( $rProp->getValue() );
-               $priv = \TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
+               $priv = TestingAccessWrapper::newFromObject( $rProp->getValue() 
);
                $this->assertSame( $manager, $priv->manager );
                $this->assertSame( $store, $priv->store );
                $this->assertSame( $logger, $priv->logger );
@@ -122,7 +123,7 @@
                        'logger' => $logger,
                ] );
                PHPSessionHandler::install( $manager );
-               $wrap = \TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
+               $wrap = TestingAccessWrapper::newFromObject( $rProp->getValue() 
);
                $reset[] = new \Wikimedia\ScopedCallback(
                        [ $wrap, 'setEnableFlags' ],
                        [ $wrap->enable ? $wrap->warn ? 'warn' : 'enable' : 
'disable' ]
@@ -323,7 +324,7 @@
                        ->setMethods( null )
                        ->disableOriginalConstructor()
                        ->getMock();
-               \TestingAccessWrapper::newFromObject( $handler 
)->setEnableFlags( 'disable' );
+               TestingAccessWrapper::newFromObject( $handler 
)->setEnableFlags( 'disable' );
                $oldValue = $rProp->getValue();
                $rProp->setValue( $handler );
                $reset = new \Wikimedia\ScopedCallback( [ $rProp, 'setValue' ], 
[ $oldValue ] );
@@ -350,7 +351,7 @@
                        ->setMethods( null )
                        ->disableOriginalConstructor()
                        ->getMock();
-               \TestingAccessWrapper::newFromObject( $handler 
)->setEnableFlags( 'enable' );
+               TestingAccessWrapper::newFromObject( $handler 
)->setEnableFlags( 'enable' );
 
                call_user_func_array( [ $handler, $method ], $args );
        }
diff --git a/tests/phpunit/includes/session/SessionBackendTest.php 
b/tests/phpunit/includes/session/SessionBackendTest.php
index 4a28f7a..0d345db 100644
--- a/tests/phpunit/includes/session/SessionBackendTest.php
+++ b/tests/phpunit/includes/session/SessionBackendTest.php
@@ -4,6 +4,7 @@
 
 use MediaWikiTestCase;
 use User;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -61,13 +62,13 @@
                $id = new SessionId( $info->getId() );
 
                $backend = new SessionBackend( $id, $info, $this->store, 
$logger, 10 );
-               $priv = \TestingAccessWrapper::newFromObject( $backend );
+               $priv = TestingAccessWrapper::newFromObject( $backend );
                $priv->persist = false;
                $priv->requests = [ 100 => new \FauxRequest() ];
                $priv->requests[100]->setSessionId( $id );
                $priv->usePhpSessionHandling = false;
 
-               $manager = \TestingAccessWrapper::newFromObject( $this->manager 
);
+               $manager = TestingAccessWrapper::newFromObject( $this->manager 
);
                $manager->allSessionBackends = [ $backend->getId() => $backend 
] + $manager->allSessionBackends;
                $manager->allSessionIds = [ $backend->getId() => $id ] + 
$manager->allSessionIds;
                $manager->sessionProviders = [ (string)$this->provider => 
$this->provider ];
@@ -168,16 +169,16 @@
                $this->assertSame( $info->wasPersisted(), 
$backend->isPersistent() );
                $this->assertSame( $info->wasRemembered(), 
$backend->shouldRememberUser() );
                $this->assertSame( $info->forceHTTPS(), 
$backend->shouldForceHTTPS() );
-               $this->assertSame( $expire, 
\TestingAccessWrapper::newFromObject( $backend )->expires );
+               $this->assertSame( $expire, 
TestingAccessWrapper::newFromObject( $backend )->expires );
                $this->assertSame( [ 'foo' ], $backend->getProviderMetadata() );
        }
 
        public function testSessionStuff() {
                $backend = $this->getBackend();
-               $priv = \TestingAccessWrapper::newFromObject( $backend );
+               $priv = TestingAccessWrapper::newFromObject( $backend );
                $priv->requests = []; // Remove dummy session
 
-               $manager = \TestingAccessWrapper::newFromObject( $this->manager 
);
+               $manager = TestingAccessWrapper::newFromObject( $this->manager 
);
 
                $request1 = new \FauxRequest();
                $session1 = $backend->getSession( $request1 );
@@ -188,7 +189,7 @@
                $this->assertInstanceOf( Session::class, $session2 );
                $this->assertSame( 2, count( $priv->requests ) );
 
-               $index = \TestingAccessWrapper::newFromObject( $session1 
)->index;
+               $index = TestingAccessWrapper::newFromObject( $session1 
)->index;
 
                $this->assertSame( $request1, $backend->getRequest( $index ) );
                $this->assertSame( null, $backend->suggestLoginUsername( $index 
) );
@@ -220,7 +221,7 @@
 
        public function testSetProviderMetadata() {
                $backend = $this->getBackend();
-               $priv = \TestingAccessWrapper::newFromObject( $backend );
+               $priv = TestingAccessWrapper::newFromObject( $backend );
                $priv->providerMetadata = [ 'dummy' ];
 
                try {
@@ -265,7 +266,7 @@
                        ->will( $this->returnValue( false ) );
                $this->provider->expects( $this->never() )->method( 
'sessionIdWasReset' );
                $backend = $this->getBackend( User::newFromName( 'UTSysop' ) );
-               $manager = \TestingAccessWrapper::newFromObject( $this->manager 
);
+               $manager = TestingAccessWrapper::newFromObject( $this->manager 
);
                $sessionId = $backend->getSessionId();
                $backend->resetId();
                $this->assertSame( self::SESSIONID, $backend->getId() );
@@ -279,7 +280,7 @@
                $backend = $this->getBackend();
                $this->provider->expects( $this->once() )->method( 
'sessionIdWasReset' )
                        ->with( $this->identicalTo( $backend ), 
$this->identicalTo( self::SESSIONID ) );
-               $manager = \TestingAccessWrapper::newFromObject( $this->manager 
);
+               $manager = TestingAccessWrapper::newFromObject( $this->manager 
);
                $sessionId = $backend->getSessionId();
                $backend->resetId();
                $this->assertNotEquals( self::SESSIONID, $backend->getId() );
@@ -305,7 +306,7 @@
 
                $this->provider = null;
                $backend = $this->getBackend();
-               $wrap = \TestingAccessWrapper::newFromObject( $backend );
+               $wrap = TestingAccessWrapper::newFromObject( $backend );
                $wrap->persist = true;
                $wrap->expires = 0;
                $backend->persist();
@@ -317,7 +318,7 @@
                        ->setMethods( [ 'unpersistSession' ] )->getMock();
                $this->provider->expects( $this->once() )->method( 
'unpersistSession' );
                $backend = $this->getBackend();
-               $wrap = \TestingAccessWrapper::newFromObject( $backend );
+               $wrap = TestingAccessWrapper::newFromObject( $backend );
                $wrap->store = new \CachedBagOStuff( $this->store );
                $wrap->persist = true;
                $wrap->dataDirty = true;
@@ -391,7 +392,7 @@
 
        public function testDirty() {
                $backend = $this->getBackend();
-               $priv = \TestingAccessWrapper::newFromObject( $backend );
+               $priv = TestingAccessWrapper::newFromObject( $backend );
                $priv->dataDirty = false;
                $backend->dirty();
                $this->assertTrue( $priv->dataDirty );
@@ -401,7 +402,7 @@
                $backend = $this->getBackend();
                $data = $backend->getData();
                $this->assertSame( [], $data );
-               $this->assertTrue( \TestingAccessWrapper::newFromObject( 
$backend )->dataDirty );
+               $this->assertTrue( TestingAccessWrapper::newFromObject( 
$backend )->dataDirty );
                $data['???'] = '!!!';
                $this->assertSame( [ '???' => '!!!' ], $data );
 
@@ -409,12 +410,12 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend();
                $this->assertSame( $testData, $backend->getData() );
-               $this->assertFalse( \TestingAccessWrapper::newFromObject( 
$backend )->dataDirty );
+               $this->assertFalse( TestingAccessWrapper::newFromObject( 
$backend )->dataDirty );
        }
 
        public function testAddData() {
                $backend = $this->getBackend();
-               $priv = \TestingAccessWrapper::newFromObject( $backend );
+               $priv = TestingAccessWrapper::newFromObject( $backend );
 
                $priv->data = [ 'foo' => 1 ];
                $priv->dataDirty = false;
@@ -438,7 +439,7 @@
        public function testDelaySave() {
                $this->mergeMwGlobalArrayValue( 'wgHooks', [ 'SessionMetadata' 
=> [ $this ] ] );
                $backend = $this->getBackend();
-               $priv = \TestingAccessWrapper::newFromObject( $backend );
+               $priv = TestingAccessWrapper::newFromObject( $backend );
                $priv->persist = true;
 
                // Saves happen normally when no delay is in effect
@@ -509,8 +510,8 @@
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
                $this->assertFalse( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
                $backend->save();
                $this->assertFalse( $this->store->getSession( self::SESSIONID 
), 'making sure it didn\'t save' );
 
@@ -522,11 +523,11 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->forcePersist 
= true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->forcePersist = 
true;
                $this->assertFalse( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
                $backend->save();
                $this->assertFalse( $this->store->getSession( self::SESSIONID 
), 'making sure it didn\'t save' );
 
@@ -535,14 +536,14 @@
                $this->mergeMwGlobalArrayValue( 'wgHooks', [ 'SessionMetadata' 
=> [ $neverHook ] ] );
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
-               \TestingAccessWrapper::newFromObject( $backend )->requests[100]
+               TestingAccessWrapper::newFromObject( $backend )->requests[100]
                        ->setSessionId( new SessionId( 'x' ) );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->forcePersist 
= true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->forcePersist = 
true;
                $this->assertFalse( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
                $backend->save();
                $this->assertFalse( $this->store->getSession( self::SESSIONID 
), 'making sure it didn\'t save' );
 
@@ -554,8 +555,8 @@
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
                $this->assertFalse( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
                $backend->save();
                $this->assertTrue( $this->onSessionMetadataCalled );
                $blob = $this->store->getSession( self::SESSIONID );
@@ -574,10 +575,10 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
                $backend->save();
                $this->assertFalse( $this->store->getSession( self::SESSIONID 
), 'making sure it didn\'t save' );
 
@@ -589,11 +590,11 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
true;
-               \TestingAccessWrapper::newFromObject( $backend )->forcePersist 
= true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = true;
+               TestingAccessWrapper::newFromObject( $backend )->forcePersist = 
true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
                $backend->save();
                $this->assertFalse( $this->store->getSession( self::SESSIONID 
), 'making sure it didn\'t save' );
 
@@ -604,10 +605,10 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
                $backend->save();
                $this->assertTrue( $this->onSessionMetadataCalled );
                $blob = $this->store->getSession( self::SESSIONID );
@@ -629,11 +630,11 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
true;
-               \TestingAccessWrapper::newFromObject( $backend )->forcePersist 
= true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = true;
+               TestingAccessWrapper::newFromObject( $backend )->forcePersist = 
true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
                $backend->save();
                $this->assertTrue( $this->onSessionMetadataCalled );
                $blob = $this->store->getSession( self::SESSIONID );
@@ -655,10 +656,10 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
true;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
                $backend->save();
                $this->assertTrue( $this->onSessionMetadataCalled );
                $blob = $this->store->getSession( self::SESSIONID );
@@ -679,11 +680,11 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
-               \TestingAccessWrapper::newFromObject( $backend )->dataHash = 
'Doesn\'t match';
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
false;
+               TestingAccessWrapper::newFromObject( $backend )->dataHash = 
'Doesn\'t match';
                $backend->save();
                $this->assertTrue( $this->onSessionMetadataCalled );
                $blob = $this->store->getSession( self::SESSIONID );
@@ -721,7 +722,7 @@
                }
 
                // SessionManager::preventSessionsForUser
-               \TestingAccessWrapper::newFromObject( $this->manager 
)->preventUsers = [
+               TestingAccessWrapper::newFromObject( $this->manager 
)->preventUsers = [
                        $user->getName() => true,
                ];
                $this->provider = $neverProvider;
@@ -729,10 +730,10 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               \TestingAccessWrapper::newFromObject( $backend )->persist = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->persist = true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
-               \TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
true;
-               \TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->metaDirty = 
true;
+               TestingAccessWrapper::newFromObject( $backend )->dataDirty = 
true;
                $backend->save();
                $this->assertFalse( $this->store->getSession( self::SESSIONID 
), 'making sure it didn\'t save' );
        }
@@ -751,7 +752,7 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               $wrap = \TestingAccessWrapper::newFromObject( $backend );
+               $wrap = TestingAccessWrapper::newFromObject( $backend );
                $this->assertFalse( $backend->isPersistent(), 'sanity check' );
                $wrap->metaDirty = false;
                $wrap->dataDirty = false;
@@ -777,7 +778,7 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               $wrap = \TestingAccessWrapper::newFromObject( $backend );
+               $wrap = TestingAccessWrapper::newFromObject( $backend );
                $wrap->persist = true;
                $this->assertTrue( $backend->isPersistent(), 'sanity check' );
                $wrap->metaDirty = false;
@@ -804,7 +805,7 @@
                $this->store->setSessionData( self::SESSIONID, $testData );
                $backend = $this->getBackend( $user );
                $this->store->deleteSession( self::SESSIONID );
-               $wrap = \TestingAccessWrapper::newFromObject( $backend );
+               $wrap = TestingAccessWrapper::newFromObject( $backend );
                $this->assertFalse( $backend->isPersistent(), 'sanity check' );
                $wrap->metaDirty = false;
                $wrap->dataDirty = false;
@@ -829,7 +830,7 @@
                if ( !PHPSessionHandler::isEnabled() ) {
                        $rProp = new \ReflectionProperty( 
PHPSessionHandler::class, 'instance' );
                        $rProp->setAccessible( true );
-                       $handler = \TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
+                       $handler = TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
                        $resetHandler = new \Wikimedia\ScopedCallback( function 
() use ( $handler ) {
                                session_write_close();
                                $handler->enable = false;
@@ -838,27 +839,27 @@
                }
 
                $backend = $this->getBackend( static::getTestSysop()->getUser() 
);
-               \TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = true;
+               TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = true;
 
                $resetSingleton = TestUtils::setSessionManagerSingleton( 
$this->manager );
 
-               $manager = \TestingAccessWrapper::newFromObject( $this->manager 
);
+               $manager = TestingAccessWrapper::newFromObject( $this->manager 
);
                $request = \RequestContext::getMain()->getRequest();
                $manager->globalSession = $backend->getSession( $request );
                $manager->globalSessionRequest = $request;
 
                session_id( '' );
-               \TestingAccessWrapper::newFromObject( $backend 
)->checkPHPSession();
+               TestingAccessWrapper::newFromObject( $backend 
)->checkPHPSession();
                $this->assertSame( $backend->getId(), session_id() );
                session_write_close();
 
                $backend2 = $this->getBackend(
                        User::newFromName( 'UTSysop' ), 
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
                );
-               \TestingAccessWrapper::newFromObject( $backend2 
)->usePhpSessionHandling = true;
+               TestingAccessWrapper::newFromObject( $backend2 
)->usePhpSessionHandling = true;
 
                session_id( '' );
-               \TestingAccessWrapper::newFromObject( $backend2 
)->checkPHPSession();
+               TestingAccessWrapper::newFromObject( $backend2 
)->checkPHPSession();
                $this->assertSame( '', session_id() );
        }
 
@@ -869,7 +870,7 @@
                if ( !PHPSessionHandler::isEnabled() ) {
                        $rProp = new \ReflectionProperty( 
PHPSessionHandler::class, 'instance' );
                        $rProp->setAccessible( true );
-                       $handler = \TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
+                       $handler = TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
                        $resetHandler = new \Wikimedia\ScopedCallback( function 
() use ( $handler ) {
                                session_write_close();
                                $handler->enable = false;
@@ -878,11 +879,11 @@
                }
 
                $backend = $this->getBackend( User::newFromName( 'UTSysop' ) );
-               \TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = true;
+               TestingAccessWrapper::newFromObject( $backend 
)->usePhpSessionHandling = true;
 
                $resetSingleton = TestUtils::setSessionManagerSingleton( 
$this->manager );
 
-               $manager = \TestingAccessWrapper::newFromObject( $this->manager 
);
+               $manager = TestingAccessWrapper::newFromObject( $this->manager 
);
                $request = \RequestContext::getMain()->getRequest();
                $manager->globalSession = $backend->getSession( $request );
                $manager->globalSessionRequest = $request;
@@ -905,7 +906,7 @@
                if ( !PHPSessionHandler::isEnabled() ) {
                        $rProp = new \ReflectionProperty( 
PHPSessionHandler::class, 'instance' );
                        $rProp->setAccessible( true );
-                       $handler = \TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
+                       $handler = TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
                        $resetHandler = new \Wikimedia\ScopedCallback( function 
() use ( $handler ) {
                                session_write_close();
                                $handler->enable = false;
@@ -914,13 +915,13 @@
                }
 
                $backend = $this->getBackend( User::newFromName( 'UTSysop' ) );
-               $wrap = \TestingAccessWrapper::newFromObject( $backend );
+               $wrap = TestingAccessWrapper::newFromObject( $backend );
                $wrap->usePhpSessionHandling = true;
                $wrap->persist = true;
 
                $resetSingleton = TestUtils::setSessionManagerSingleton( 
$this->manager );
 
-               $manager = \TestingAccessWrapper::newFromObject( $this->manager 
);
+               $manager = TestingAccessWrapper::newFromObject( $this->manager 
);
                $request = \RequestContext::getMain()->getRequest();
                $manager->globalSession = $backend->getSession( $request );
                $manager->globalSessionRequest = $request;
diff --git a/tests/phpunit/includes/session/SessionManagerTest.php 
b/tests/phpunit/includes/session/SessionManagerTest.php
index c4b1072..9eb46bc 100644
--- a/tests/phpunit/includes/session/SessionManagerTest.php
+++ b/tests/phpunit/includes/session/SessionManagerTest.php
@@ -5,6 +5,7 @@
 use MediaWikiTestCase;
 use Psr\Log\LogLevel;
 use User;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -59,7 +60,7 @@
                }
                $rProp = new \ReflectionProperty( PHPSessionHandler::class, 
'instance' );
                $rProp->setAccessible( true );
-               $handler = \TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
+               $handler = TestingAccessWrapper::newFromObject( 
$rProp->getValue() );
                $oldEnable = $handler->enable;
                $reset[] = new \Wikimedia\ScopedCallback( function () use ( 
$handler, $oldEnable ) {
                        if ( $handler->enable ) {
@@ -100,15 +101,15 @@
        }
 
        public function testConstructor() {
-               $manager = \TestingAccessWrapper::newFromObject( 
$this->getManager() );
+               $manager = TestingAccessWrapper::newFromObject( 
$this->getManager() );
                $this->assertSame( $this->config, $manager->config );
                $this->assertSame( $this->logger, $manager->logger );
                $this->assertSame( $this->store, $manager->store );
 
-               $manager = \TestingAccessWrapper::newFromObject( new 
SessionManager() );
+               $manager = TestingAccessWrapper::newFromObject( new 
SessionManager() );
                $this->assertSame( \RequestContext::getMain()->getConfig(), 
$manager->config );
 
-               $manager = \TestingAccessWrapper::newFromObject( new 
SessionManager( [
+               $manager = TestingAccessWrapper::newFromObject( new 
SessionManager( [
                        'config' => $this->config,
                ] ) );
                $this->assertSame( 
\ObjectCache::$instances['testSessionStore'], $manager->store );
@@ -418,7 +419,7 @@
 
        public function testGetEmptySession() {
                $manager = $this->getManager();
-               $pmanager = \TestingAccessWrapper::newFromObject( $manager );
+               $pmanager = TestingAccessWrapper::newFromObject( $manager );
                $request = new \FauxRequest();
 
                $providerBuilder = $this->getMockBuilder( 
'DummySessionProvider' )
@@ -747,14 +748,14 @@
 
        public function testGetProviders() {
                $realManager = $this->getManager();
-               $manager = \TestingAccessWrapper::newFromObject( $realManager );
+               $manager = TestingAccessWrapper::newFromObject( $realManager );
 
                $this->config->set( 'SessionProviders', [
                        [ 'class' => 'DummySessionProvider' ],
                ] );
                $providers = $manager->getProviders();
                $this->assertArrayHasKey( 'DummySessionProvider', $providers );
-               $provider = \TestingAccessWrapper::newFromObject( 
$providers['DummySessionProvider'] );
+               $provider = TestingAccessWrapper::newFromObject( 
$providers['DummySessionProvider'] );
                $this->assertSame( $manager->logger, $provider->logger );
                $this->assertSame( $manager->config, $provider->config );
                $this->assertSame( $realManager, $provider->getManager() );
@@ -776,7 +777,7 @@
        }
 
        public function testShutdown() {
-               $manager = \TestingAccessWrapper::newFromObject( 
$this->getManager() );
+               $manager = TestingAccessWrapper::newFromObject( 
$this->getManager() );
                $manager->setLogger( new \Psr\Log\NullLogger() );
 
                $mock = $this->getMockBuilder( 'stdClass' )
@@ -788,7 +789,7 @@
        }
 
        public function testGetSessionFromInfo() {
-               $manager = \TestingAccessWrapper::newFromObject( 
$this->getManager() );
+               $manager = TestingAccessWrapper::newFromObject( 
$this->getManager() );
                $request = new \FauxRequest();
 
                $id = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
@@ -800,11 +801,11 @@
                        'userInfo' => UserInfo::newFromName( 'UTSysop', true ),
                        'idIsSafe' => true,
                ] );
-               \TestingAccessWrapper::newFromObject( $info )->idIsSafe = true;
-               $session1 = \TestingAccessWrapper::newFromObject(
+               TestingAccessWrapper::newFromObject( $info )->idIsSafe = true;
+               $session1 = TestingAccessWrapper::newFromObject(
                        $manager->getSessionFromInfo( $info, $request )
                );
-               $session2 = \TestingAccessWrapper::newFromObject(
+               $session2 = TestingAccessWrapper::newFromObject(
                        $manager->getSessionFromInfo( $info, $request )
                );
 
@@ -813,7 +814,7 @@
                $this->assertSame( $session1->getSessionId(), 
$session2->getSessionId() );
                $this->assertSame( $id, $session1->getId() );
 
-               \TestingAccessWrapper::newFromObject( $info )->idIsSafe = false;
+               TestingAccessWrapper::newFromObject( $info )->idIsSafe = false;
                $session3 = $manager->getSessionFromInfo( $info, $request );
                $this->assertNotSame( $id, $session3->getId() );
        }
@@ -822,7 +823,7 @@
                $manager = $this->getManager();
 
                $session = $manager->getSessionForRequest( new \FauxRequest );
-               $backend = \TestingAccessWrapper::newFromObject( $session 
)->backend;
+               $backend = TestingAccessWrapper::newFromObject( $session 
)->backend;
                $sessionId = $session->getSessionId();
                $id = (string)$sessionId;
 
@@ -959,7 +960,7 @@
                $provider3->expects( $this->any() )->method( '__toString' )
                        ->will( $this->returnValue( 'Mock3' ) );
 
-               \TestingAccessWrapper::newFromObject( $manager 
)->sessionProviders = [
+               TestingAccessWrapper::newFromObject( $manager 
)->sessionProviders = [
                        (string)$provider => $provider,
                        (string)$provider2 => $provider2,
                        (string)$provider3 => $provider3,
diff --git a/tests/phpunit/includes/session/SessionProviderTest.php 
b/tests/phpunit/includes/session/SessionProviderTest.php
index 8284d05..052c016 100644
--- a/tests/phpunit/includes/session/SessionProviderTest.php
+++ b/tests/phpunit/includes/session/SessionProviderTest.php
@@ -3,6 +3,7 @@
 namespace MediaWiki\Session;
 
 use MediaWikiTestCase;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -17,7 +18,7 @@
                $config = new \HashConfig();
 
                $provider = $this->getMockForAbstractClass( 
SessionProvider::class );
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
 
                $provider->setConfig( $config );
                $this->assertSame( $config, $priv->config );
@@ -148,7 +149,7 @@
                $provider = $this->getMockForAbstractClass( 
SessionProvider::class,
                        [], 'MockSessionProvider' );
                $provider->setConfig( $config );
-               $priv = \TestingAccessWrapper::newFromObject( $provider );
+               $priv = TestingAccessWrapper::newFromObject( $provider );
 
                $this->assertSame( 'eoq8cb1mg7j30ui5qolafps4hg29k5bb', 
$priv->hashToSessionId( 'foobar' ) );
                $this->assertSame( '4do8j7tfld1g8tte9jqp3csfgmulaun9',
@@ -198,7 +199,7 @@
                        );
                }
 
-               \TestingAccessWrapper::newFromObject( $backend )->provider = 
$provider;
+               TestingAccessWrapper::newFromObject( $backend )->provider = 
$provider;
                $this->assertNull( $provider->getAllowedUserRights( $backend ) 
);
        }
 
diff --git a/tests/phpunit/includes/session/SessionTest.php 
b/tests/phpunit/includes/session/SessionTest.php
index f6c88ec..adf0f5d 100644
--- a/tests/phpunit/includes/session/SessionTest.php
+++ b/tests/phpunit/includes/session/SessionTest.php
@@ -5,6 +5,7 @@
 use Psr\Log\LogLevel;
 use MediaWikiTestCase;
 use User;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -14,16 +15,16 @@
 
        public function testConstructor() {
                $backend = TestUtils::getDummySessionBackend();
-               \TestingAccessWrapper::newFromObject( $backend )->requests = [ 
-1 => 'dummy' ];
-               \TestingAccessWrapper::newFromObject( $backend )->id = new 
SessionId( 'abc' );
+               TestingAccessWrapper::newFromObject( $backend )->requests = [ 
-1 => 'dummy' ];
+               TestingAccessWrapper::newFromObject( $backend )->id = new 
SessionId( 'abc' );
 
                $session = new Session( $backend, 42, new \TestLogger );
-               $priv = \TestingAccessWrapper::newFromObject( $session );
+               $priv = TestingAccessWrapper::newFromObject( $session );
                $this->assertSame( $backend, $priv->backend );
                $this->assertSame( 42, $priv->index );
 
                $request = new \FauxRequest();
-               $priv2 = \TestingAccessWrapper::newFromObject( 
$session->sessionWithRequest( $request ) );
+               $priv2 = TestingAccessWrapper::newFromObject( 
$session->sessionWithRequest( $request ) );
                $this->assertSame( $backend, $priv2->backend );
                $this->assertNotSame( $priv->index, $priv2->index );
                $this->assertSame( $request, $priv2->getRequest() );
@@ -98,7 +99,7 @@
 
        public function testDataAccess() {
                $session = TestUtils::getDummySession();
-               $backend = \TestingAccessWrapper::newFromObject( $session 
)->backend;
+               $backend = TestingAccessWrapper::newFromObject( $session 
)->backend;
 
                $this->assertEquals( 1, $session->get( 'foo' ) );
                $this->assertEquals( 'zero', $session->get( 0 ) );
@@ -158,7 +159,7 @@
        public function testArrayAccess() {
                $logger = new \TestLogger;
                $session = TestUtils::getDummySession( null, -1, $logger );
-               $backend = \TestingAccessWrapper::newFromObject( $session 
)->backend;
+               $backend = TestingAccessWrapper::newFromObject( $session 
)->backend;
 
                $this->assertEquals( 1, $session['foo'] );
                $this->assertEquals( 'zero', $session[0] );
@@ -222,7 +223,7 @@
 
        public function testClear() {
                $session = TestUtils::getDummySession();
-               $priv = \TestingAccessWrapper::newFromObject( $session );
+               $priv = TestingAccessWrapper::newFromObject( $session );
 
                $backend = $this->getMockBuilder( DummySessionBackend::class )
                        ->setMethods( [ 'canSetUser', 'setUser', 'save' ] )
@@ -269,10 +270,10 @@
 
        public function testTokens() {
                $session = TestUtils::getDummySession();
-               $priv = \TestingAccessWrapper::newFromObject( $session );
+               $priv = TestingAccessWrapper::newFromObject( $session );
                $backend = $priv->backend;
 
-               $token = \TestingAccessWrapper::newFromObject( 
$session->getToken() );
+               $token = TestingAccessWrapper::newFromObject( 
$session->getToken() );
                $this->assertArrayHasKey( 'wsTokenSecrets', $backend->data );
                $this->assertArrayHasKey( 'default', 
$backend->data['wsTokenSecrets'] );
                $secret = $backend->data['wsTokenSecrets']['default'];
@@ -280,13 +281,13 @@
                $this->assertSame( '', $token->salt );
                $this->assertTrue( $token->wasNew() );
 
-               $token = \TestingAccessWrapper::newFromObject( 
$session->getToken( 'foo' ) );
+               $token = TestingAccessWrapper::newFromObject( 
$session->getToken( 'foo' ) );
                $this->assertSame( $secret, $token->secret );
                $this->assertSame( 'foo', $token->salt );
                $this->assertFalse( $token->wasNew() );
 
                $backend->data['wsTokenSecrets']['secret'] = 'sekret';
-               $token = \TestingAccessWrapper::newFromObject(
+               $token = TestingAccessWrapper::newFromObject(
                        $session->getToken( [ 'bar', 'baz' ], 'secret' )
                );
                $this->assertSame( 'sekret', $token->secret );
@@ -358,7 +359,7 @@
 
                // Unserializable data
                $iv = \MWCryptRand::generate( 16, true );
-               list( $encKey, $hmacKey ) = 
\TestingAccessWrapper::newFromObject( $session )->getSecretKeys();
+               list( $encKey, $hmacKey ) = 
TestingAccessWrapper::newFromObject( $session )->getSecretKeys();
                $ciphertext = openssl_encrypt( 'foobar', 'aes-256-ctr', 
$encKey, OPENSSL_RAW_DATA, $iv );
                $sealed = base64_encode( $iv ) . '.' . base64_encode( 
$ciphertext );
                $hmac = hash_hmac( 'sha256', $sealed, $hmacKey, true );
diff --git a/tests/phpunit/includes/session/TestUtils.php 
b/tests/phpunit/includes/session/TestUtils.php
index f00de55..af29d6b 100644
--- a/tests/phpunit/includes/session/TestUtils.php
+++ b/tests/phpunit/includes/session/TestUtils.php
@@ -3,6 +3,7 @@
 namespace MediaWiki\Session;
 
 use Psr\Log\LoggerInterface;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * Utility functions for Session unit tests
@@ -70,7 +71,7 @@
                }
 
                $ret = $rc->newInstanceWithoutConstructor();
-               \TestingAccessWrapper::newFromObject( $ret )->logger = new 
\TestLogger;
+               TestingAccessWrapper::newFromObject( $ret )->logger = new 
\TestLogger;
                return $ret;
        }
 
@@ -95,7 +96,7 @@
                }
 
                $session = $rc->newInstanceWithoutConstructor();
-               $priv = \TestingAccessWrapper::newFromObject( $session );
+               $priv = TestingAccessWrapper::newFromObject( $session );
                $priv->backend = $backend;
                $priv->index = $index;
                $priv->logger = $logger ?: new \TestLogger;
diff --git a/tests/phpunit/includes/session/TokenTest.php 
b/tests/phpunit/includes/session/TokenTest.php
index ca001f3..4797652 100644
--- a/tests/phpunit/includes/session/TokenTest.php
+++ b/tests/phpunit/includes/session/TokenTest.php
@@ -3,6 +3,7 @@
 namespace MediaWiki\Session;
 
 use MediaWikiTestCase;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Session
@@ -27,7 +28,7 @@
        }
 
        public function testToStringAtTimestamp() {
-               $token = \TestingAccessWrapper::newFromObject( new Token( 
'sekret', 'salty', false ) );
+               $token = TestingAccessWrapper::newFromObject( new Token( 
'sekret', 'salty', false ) );
 
                $this->assertSame(
                        'd9ade0c7d4349e9df9094e61c33a5a0d5644fde2+\\',
@@ -53,7 +54,7 @@
        }
 
        public function testMatch() {
-               $token = \TestingAccessWrapper::newFromObject( new Token( 
'sekret', 'salty', false ) );
+               $token = TestingAccessWrapper::newFromObject( new Token( 
'sekret', 'salty', false ) );
 
                $test = $token->toStringAtTimestamp( time() - 10 );
                $this->assertTrue( $token->match( $test ) );
diff --git a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php 
b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
index 1ddb98d..b536c22 100644
--- a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
+++ b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
@@ -1,4 +1,7 @@
 <?php
+
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * Test class for ChangesListSpecialPage class
  *
diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php 
b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
index 011d8a0..e9c7d4b 100644
--- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
+++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * Test class for SpecialRecentchanges class
  *
diff --git a/tests/phpunit/includes/specials/SpecialWatchlistTest.php 
b/tests/phpunit/includes/specials/SpecialWatchlistTest.php
index 66d35a5..7f9f25f 100644
--- a/tests/phpunit/includes/specials/SpecialWatchlistTest.php
+++ b/tests/phpunit/includes/specials/SpecialWatchlistTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @author Addshore
  *
diff --git a/tests/phpunit/includes/user/BotPasswordTest.php 
b/tests/phpunit/includes/user/BotPasswordTest.php
index 594540f..58f1e5f 100644
--- a/tests/phpunit/includes/user/BotPasswordTest.php
+++ b/tests/phpunit/includes/user/BotPasswordTest.php
@@ -2,6 +2,7 @@
 
 use MediaWiki\Session\SessionManager;
 use Wikimedia\ScopedCallback;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @covers BotPassword
diff --git a/tests/phpunit/includes/user/CentralIdLookupTest.php 
b/tests/phpunit/includes/user/CentralIdLookupTest.php
index feac641..789cf08 100644
--- a/tests/phpunit/includes/user/CentralIdLookupTest.php
+++ b/tests/phpunit/includes/user/CentralIdLookupTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @covers CentralIdLookup
  * @group Database
diff --git a/tests/phpunit/includes/user/UserTest.php 
b/tests/phpunit/includes/user/UserTest.php
index fea4a44..776dda1 100644
--- a/tests/phpunit/includes/user/UserTest.php
+++ b/tests/phpunit/includes/user/UserTest.php
@@ -4,6 +4,7 @@
 define( 'NS_UNITTEST_TALK', 5601 );
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\TestingAccessWrapper;
 
 /**
  * @group Database
diff --git a/tests/phpunit/structure/ApiDocumentationTest.php 
b/tests/phpunit/structure/ApiDocumentationTest.php
index bc5a6bd..9e46e07 100644
--- a/tests/phpunit/structure/ApiDocumentationTest.php
+++ b/tests/phpunit/structure/ApiDocumentationTest.php
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * Checks that all API modules, core and extensions, have documentation i18n 
messages
  *
diff --git a/tests/phpunit/structure/ContentHandlerSanityTest.php 
b/tests/phpunit/structure/ContentHandlerSanityTest.php
index 30bae78..c8bcd60 100644
--- a/tests/phpunit/structure/ContentHandlerSanityTest.php
+++ b/tests/phpunit/structure/ContentHandlerSanityTest.php
@@ -1,4 +1,7 @@
 <?php
+
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

-- 
To view, visit https://gerrit.wikimedia.org/r/349163
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52cc257e593da3d6c3b01a909e554a950225aec8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to