/** * @test */ public function canAuthenticateReturnsTrueOnlyForAnTokenThatHasTheCorrectProviderNameSet() { $mockToken1 = $this->getMock('TYPO3\\Flow\\Security\\Authentication\\TokenInterface'); $mockToken1->expects($this->once())->method('getAuthenticationProviderName')->will($this->returnValue('myProvider')); $mockToken2 = $this->getMock('TYPO3\\Flow\\Security\\Authentication\\TokenInterface'); $mockToken2->expects($this->once())->method('getAuthenticationProviderName')->will($this->returnValue('someOtherProvider')); $authenticationProvider = new FileBasedSimpleKeyProvider('myProvider'); $this->assertTrue($authenticationProvider->canAuthenticate($mockToken1)); $this->assertFalse($authenticationProvider->canAuthenticate($mockToken2)); }