14 $token = $this->getMockBuilder( Token::class )
15 ->setMethods( [
'toStringAtTimestamp' ] )
16 ->setConstructorArgs( [
'sekret',
'salty',
true ] )
18 $token->expects( $this->any() )->method(
'toStringAtTimestamp' )
19 ->will( $this->returnValue(
'faketoken+\\' ) );
21 $this->assertSame(
'faketoken+\\', $token->toString() );
22 $this->assertSame(
'faketoken+\\', (
string)$token );
23 $this->assertTrue( $token->wasNew() );
25 $token =
new Token(
'sekret',
'salty',
false );
26 $this->assertFalse( $token->wasNew() );
56 $token = \TestingAccessWrapper::newFromObject(
new Token(
'sekret',
'salty',
false ) );
58 $test = $token->toStringAtTimestamp( time() - 10 );
59 $this->assertTrue( $token->match( $test ) );
60 $this->assertTrue( $token->match( $test, 12 ) );
61 $this->assertFalse( $token->match( $test, 8 ) );
63 $this->assertFalse( $token->match(
'ee2f7a2488dea9176c224cfb400d43be5644fdea-\\' ) );