コード例 #1
0
 /**
  * Tests if the client auth data gets parsed correctly
  *
  * @return void
  */
 public function testParseCorrectCredentials()
 {
     // 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->assertEquals('appserver', $this->testClass->getUsername());
     $this->assertEquals('appserver.i0', $this->testClass->getPassword());
 }
コード例 #2
0
 /**
  * Tests if we can generate a correct auth header
  *
  * @return void
  */
 public function testGetAuthenticateHeader()
 {
     $header = $this->testClass->getAuthenticateHeader();
     $this->assertContains('Basic', $header);
     $this->assertContains('Basic-Test-Realm', $header);
 }