$request2 = new \FauxRequest();
$session2 = $backend->getSession( $request2 );
- $this->assertInstanceOf( 'MediaWiki\\Session\\Session', $session1 );
- $this->assertInstanceOf( 'MediaWiki\\Session\\Session', $session2 );
+ $this->assertInstanceOf( Session::class, $session1 );
+ $this->assertInstanceOf( Session::class, $session2 );
$this->assertSame( 2, count( $priv->requests ) );
$index = \TestingAccessWrapper::newFromObject( $session1 )->index;
}
public function testSetUser() {
- $user = User::newFromName( 'UTSysop' );
+ $user = static::getTestSysop()->getUser();
$this->provider = $this->getMock( 'DummySessionProvider', [ 'canChangeUser' ] );
$this->provider->expects( $this->any() )->method( 'canChangeUser' )
// Save happens when delay is consumed
$this->onSessionMetadataCalled = false;
$priv->metaDirty = true;
- \ScopedCallback::consume( $delay );
+ \Wikimedia\ScopedCallback::consume( $delay );
$this->assertTrue( $this->onSessionMetadataCalled );
// Test multiple delays
$priv->metaDirty = true;
$priv->autosave();
$this->assertFalse( $this->onSessionMetadataCalled );
- \ScopedCallback::consume( $delay3 );
+ \Wikimedia\ScopedCallback::consume( $delay3 );
$this->assertFalse( $this->onSessionMetadataCalled );
- \ScopedCallback::consume( $delay1 );
+ \Wikimedia\ScopedCallback::consume( $delay1 );
$this->assertFalse( $this->onSessionMetadataCalled );
- \ScopedCallback::consume( $delay2 );
+ \Wikimedia\ScopedCallback::consume( $delay2 );
$this->assertTrue( $this->onSessionMetadataCalled );
}
public function testSave() {
- $user = User::newFromName( 'UTSysop' );
+ $user = static::getTestSysop()->getUser();
$this->store = new TestBagOStuff();
$testData = [ 'foo' => 'foo!', 'bar', [ 'baz', null ] ];
}
public function testRenew() {
- $user = User::newFromName( 'UTSysop' );
+ $user = static::getTestSysop()->getUser();
$this->store = new TestBagOStuff();
$testData = [ 'foo' => 'foo!', 'bar', [ 'baz', null ] ];
PHPSessionHandler::install( SessionManager::singleton() );
}
if ( !PHPSessionHandler::isEnabled() ) {
- $rProp = new \ReflectionProperty( 'MediaWiki\\Session\\PHPSessionHandler', 'instance' );
+ $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' );
$rProp->setAccessible( true );
$handler = \TestingAccessWrapper::newFromObject( $rProp->getValue() );
- $resetHandler = new \ScopedCallback( function () use ( $handler ) {
+ $resetHandler = new \Wikimedia\ScopedCallback( function () use ( $handler ) {
session_write_close();
$handler->enable = false;
} );
$handler->enable = true;
}
- $backend = $this->getBackend( User::newFromName( 'UTSysop' ) );
+ $backend = $this->getBackend( static::getTestSysop()->getUser() );
\TestingAccessWrapper::newFromObject( $backend )->usePhpSessionHandling = true;
$resetSingleton = TestUtils::setSessionManagerSingleton( $this->manager );
PHPSessionHandler::install( SessionManager::singleton() );
}
if ( !PHPSessionHandler::isEnabled() ) {
- $rProp = new \ReflectionProperty( 'MediaWiki\\Session\\PHPSessionHandler', 'instance' );
+ $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' );
$rProp->setAccessible( true );
$handler = \TestingAccessWrapper::newFromObject( $rProp->getValue() );
- $resetHandler = new \ScopedCallback( function () use ( $handler ) {
+ $resetHandler = new \Wikimedia\ScopedCallback( function () use ( $handler ) {
session_write_close();
$handler->enable = false;
} );
PHPSessionHandler::install( SessionManager::singleton() );
}
if ( !PHPSessionHandler::isEnabled() ) {
- $rProp = new \ReflectionProperty( 'MediaWiki\\Session\\PHPSessionHandler', 'instance' );
+ $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' );
$rProp->setAccessible( true );
$handler = \TestingAccessWrapper::newFromObject( $rProp->getValue() );
- $resetHandler = new \ScopedCallback( function () use ( $handler ) {
+ $resetHandler = new \Wikimedia\ScopedCallback( function () use ( $handler ) {
session_write_close();
$handler->enable = false;
} );