Exemplo n.º 1
0
 public function testValue()
 {
     $authentication = new Authentication\BasicAuth($this->username, $this->password);
     $this->assertInternalType('string', $authentication->getValue());
     $encodedDetails = 'Basic ' . base64_encode($this->username . ':' . $this->password);
     $this->assertEquals($encodedDetails, $authentication->getValue());
 }
Exemplo n.º 2
0
 public function testBasicAuth()
 {
     $request = new Consumer\Request();
     $username = '******';
     $password = '******';
     $authentication = new Consumer\Authentication\BasicAuth($username, $password);
     $key = $authentication->getName();
     $request = $request->withBasicAuth($username, $password);
     $this->assertArrayHasKey($key, $request->getHeaders());
     $this->assertEquals($authentication->getValue(), $request->getHeaderLine($key));
 }