diff --git a/cake/tests/cases/libs/http/digest_authentication.test.php b/cake/tests/cases/libs/http/digest_authentication.test.php index 7862f3147..75e98595e 100644 --- a/cake/tests/cases/libs/http/digest_authentication.test.php +++ b/cake/tests/cases/libs/http/digest_authentication.test.php @@ -37,6 +37,12 @@ class DigestHttpSocket extends HttpSocket { * @return void */ public function request($request) { + if ($request === false) { + if (isset($this->response['header']['WWW-Authenticate'])) { + unset($this->response['header']['WWW-Authenticate']); + } + return; + } $this->response['header']['WWW-Authenticate'] = $this->nextHeader; } @@ -179,4 +185,17 @@ class DigestAuthenticationTest extends CakeTestCase { $this->assertNotEqual($response, 'da7e2a46b471d77f70a9bb3698c8902b'); } +/** + * testNoDigestResponse method + * + * @return void + */ + public function testNoDigestResponse() { + $this->HttpSocket->nextHeader = false; + $this->HttpSocket->request['uri']['path'] = '/admin'; + $this->HttpSocket->config['request']['auth'] = array(); + DigestAuthentication::authentication($this->HttpSocket); + $this->assertFalse(isset($this->HttpSocket->request['header']['Authorization'])); + } + } \ No newline at end of file