}
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 ] ];
$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 );
$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;
} );
$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;
} );