/** * @test */ public function authenticationAddsAnAccountHoldingTheConfiguredRoles() { $this->mockToken = $this->getMockBuilder(PasswordToken::class)->disableOriginalConstructor()->setMethods(['getCredentials'])->getMock(); $this->mockToken->expects($this->once())->method('getCredentials')->will($this->returnValue(['password' => $this->testKeyClearText])); $authenticationProvider = new FileBasedSimpleKeyProvider('myProvider', ['keyName' => 'testKey', 'authenticateRoles' => ['Neos.Flow:TestRoleIdentifier']]); $this->inject($authenticationProvider, 'policyService', $this->mockPolicyService); $this->inject($authenticationProvider, 'hashService', $this->mockHashService); $this->inject($authenticationProvider, 'fileBasedSimpleKeyService', $this->mockFileBasedSimpleKeyService); $authenticationProvider->authenticate($this->mockToken); $authenticatedRoles = $this->mockToken->getAccount()->getRoles(); $this->assertTrue(in_array('Neos.Flow:TestRoleIdentifier', array_keys($authenticatedRoles))); }