Example #1
0
 /**
  * Tests if we can authenticate using a valid auth string and the default adapter with a Sha1 hashed password
  *
  * @return void
  */
 public function testValidAuthDefaultAdapterSha1Algorithm()
 {
     // create ourselves a new test instance
     $this->initTestEnvironment('htpasswd_sha1');
     // prepare the mock request instance
     $mockRequest = $this->getMock('AppserverIo\\Psr\\HttpMessage\\RequestInterface');
     $mockRequest->expects($this->once())->method('getMethod')->willReturn(Protocol::METHOD_POST);
     $mockRequest->expects($this->once())->method('getHeader')->with(Protocol::HEADER_AUTHORIZATION)->willReturn($this->getValidAuthString());
     // prepare the mock response instance
     $mockResponse = $this->getMock('AppserverIo\\Psr\\HttpMessage\\ResponseInterface');
     $this->testClass->init($mockRequest, $mockResponse);
     $this->assertNull($this->testClass->authenticate($mockResponse));
 }