Index: ObjectTest.php =================================================================== --- ObjectTest.php (.../branches/release-1.5/tests/Zend/Auth/Adapter/Http/ObjectTest.php) (revision 10487) +++ ObjectTest.php (.../trunk/tests/Zend/Auth/Adapter/Http/ObjectTest.php) (revision 10487) @@ -51,6 +51,10 @@ */ require_once 'Zend/Controller/Response/Http.php'; +/** + * @see Zend_Debug + */ +require_once 'Zend/Debug.php'; /** * @category Zend @@ -138,7 +142,7 @@ } catch (Zend_Auth_Adapter_Exception $e) { $this->fail('Valid config deemed invalid'); } - $this->assertTrue(!empty($t)); + $this->assertFalse(empty($t)); $this->assertType('Zend_Auth_Adapter_Http', $t); unset($t); @@ -147,7 +151,7 @@ } catch (Zend_Auth_Adapter_Exception $e) { $this->fail('Valid config deemed invalid'); } - $this->assertTrue(!empty($t)); + $this->assertFalse(empty($t)); $this->assertType('Zend_Auth_Adapter_Http', $t); unset($t); @@ -156,7 +160,7 @@ } catch (Zend_Auth_Adapter_Exception $e) { $this->fail('Valid config deemed invalid'); } - $this->assertTrue(!empty($t)); + $this->assertFalse(empty($t)); $this->assertType('Zend_Auth_Adapter_Http', $t); unset($t); } @@ -214,9 +218,9 @@ $response = $this->getMock('Zend_Controller_Response_Http'); // If this throws an exception, it fails - $a->setRequest($request); - $a->setResponse($response); - $a->authenticate(); + $a->setRequest($request) + ->setResponse($response) + ->authenticate(); } public function testNoResolvers() @@ -227,42 +231,39 @@ // Stub request for Basic auth $request->expects($this->any()) ->method('getHeader') - ->will($this->returnValue('Basic other stuff not tested')); + ->will($this->returnValue('Basic _basicConfig); - $a->setRequest($request); - $a->setResponse($response); - $result = $a->authenticate(); - - $messages = $result->getMessages(); - $this->fail("Tried Basic authentication without a resolver.\n" . array_shift($messages)); + $a->setRequest($request) + ->setResponse($response); + $result = $a->authenticate(); + $this->fail("Tried Basic authentication without a resolver.\n" . Zend_Debug::dump($result->getMessages(),null,false)); } catch (Zend_Auth_Adapter_Exception $e) { // Good, it threw an exception unset($a); } - // Stub request for Digest auth + // Stub request for Digest auth, must be reseted (recreated) + $request = $this->getMock('Zend_Controller_Request_Http'); $request->expects($this->any()) ->method('getHeader') - ->will($this->returnValue('Digest other stuff not tested')); + ->will($this->returnValue('Digest _digestConfig); - $a->setRequest($request); - $a->setResponse($response); - $result = $a->authenticate(); - - $messages = $result->getMessages(); - $this->fail("Tried Digest authentication without a resolver.\n" . array_shift($messages)); + $a->setRequest($request) + ->setResponse($response); + $result = $a->authenticate(); + $this->fail("Tried Digest authentication without a resolver.\n" . Zend_Debug::dump($result->getMessages(),null,false)); } catch (Zend_Auth_Adapter_Exception $e) { // Good, it threw an exception unset($a); } } - + public function testWrongResolverUsed() { $response = $this->getMock('Zend_Controller_Response_Http'); @@ -279,7 +280,7 @@ $result = $a->authenticate(); $this->assertEquals($result->getCode(),Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID); } - + public function testUnsupportedScheme() { $response = $this->getMock('Zend_Controller_Response_Http'); @@ -291,7 +292,7 @@ $a = new Zend_Auth_Adapter_Http($this->_digestConfig); $a->setDigestResolver($this->_digestResolver) ->setRequest($request) - ->setResponse($response); + ->setResponse($response); $result = $a->authenticate(); $this->assertEquals($result->getCode(),Zend_Auth_Result::FAILURE_UNCATEGORIZED); }