[HttpFoundation] added some missing tests
This commit is contained in:
parent
cefe237c6f
commit
3b4046e894
@ -71,19 +71,20 @@ class ServerBagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar')));
|
||||
|
||||
$this->assertEquals(array(
|
||||
'AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar'),
|
||||
), $bag->getHeaders());
|
||||
// Username and passwords should not be set as the header is bogus
|
||||
$headers = $bag->getHeaders();
|
||||
$this->assertFalse(isset($headers['PHP_AUTH_USER']));
|
||||
$this->assertFalse(isset($headers['PHP_AUTH_PW']));
|
||||
}
|
||||
|
||||
public function testHttpBasicAuthWithPhpCgiRedirect()
|
||||
{
|
||||
$bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar')));
|
||||
$bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word')));
|
||||
|
||||
$this->assertEquals(array(
|
||||
'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'),
|
||||
'PHP_AUTH_USER' => 'foo',
|
||||
'PHP_AUTH_PW' => 'bar'
|
||||
'AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'),
|
||||
'PHP_AUTH_USER' => 'username',
|
||||
'PHP_AUTH_PW' => 'pass:word'
|
||||
), $bag->getHeaders());
|
||||
}
|
||||
|
||||
@ -114,9 +115,10 @@ class ServerBagTest extends \PHPUnit_Framework_TestCase
|
||||
$digest = 'Digest_username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"';
|
||||
$bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest));
|
||||
|
||||
$this->assertEquals(array(
|
||||
'AUTHORIZATION' => $digest,
|
||||
), $bag->getHeaders());
|
||||
// Username and passwords should not be set as the header is bogus
|
||||
$headers = $bag->getHeaders();
|
||||
$this->assertFalse(isset($headers['PHP_AUTH_USER']));
|
||||
$this->assertFalse(isset($headers['PHP_AUTH_PW']));
|
||||
}
|
||||
|
||||
public function testHttpDigestAuthWithPhpCgiRedirect()
|
||||
|
Reference in New Issue
Block a user