public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $authenticationService = $serviceLocator->get('UghAuthentication\\Authentication\\AuthenticationService');
     $authenticationValidator = new Authentication();
     $authenticationValidator->setIdentity('username');
     $authenticationValidator->setCredential('password');
     $authenticationValidator->setService($authenticationService);
     return $authenticationValidator;
 }
 public function testWithoutContext()
 {
     $authenticationResult = new Result(Result::SUCCESS, 'username');
     $authenticationServiceMock = $this->getMock('UghAuthentication\\Authentication\\AuthenticationServiceInterface');
     $authenticationServiceMock->expects($this->once())->method('authenticate')->will($this->returnValue($authenticationResult));
     $authenticationValidator = new Authentication();
     $authenticationValidator->setService($authenticationServiceMock);
     $authenticationValidator->setIdentity('username');
     $authenticationValidator->setCredential('credential');
     $this->assertEquals('username', $authenticationValidator->getIdentity());
     $this->assertEquals('credential', $authenticationValidator->getCredential());
     $this->assertTrue($authenticationValidator->isValid());
 }