public function testBasics() { $token = $this->getMockBuilder('MediaWiki\\Session\\Token')->setMethods(array('toStringAtTimestamp'))->setConstructorArgs(array('sekret', 'salty', true))->getMock(); $token->expects($this->any())->method('toStringAtTimestamp')->will($this->returnValue('faketoken+\\')); $this->assertSame('faketoken+\\', $token->toString()); $this->assertSame('faketoken+\\', (string) $token); $this->assertTrue($token->wasNew()); $token = new Token('sekret', 'salty', false); $this->assertFalse($token->wasNew()); }