Exemplo n.º 1
0
/** Public functions */
function p($r, $usePr = false)
{
    if ($usePr || false === method_exists('\\Zend\\Debug', 'dump')) {
        echo '<pre>' . print_r($r, true) . '</pre>';
        return;
    }
    \Zend\Debug::dump($r);
}
Exemplo n.º 2
0
 /**
  * @group ZF-4136
  * @group ZF-1663
  */
 public function testXdebugEnabledAndNonCliSapiDoesNotEscapeSpecialChars()
 {
     if (!extension_loaded('xdebug')) {
         $this->markTestSkipped("This test only works in combination with xdebug.");
     }
     Debug::setSapi('apache');
     $a = array("a" => "b");
     $result = Debug::dump($a, "LABEL", false);
     $this->assertContains("<pre>", $result);
     $this->assertContains("</pre>", $result);
 }
Exemplo n.º 3
0
 public function testNoResolvers()
 {
     // Stub request for Basic auth
     $headers = new Headers();
     $headers->addHeaderLine('Authorization', 'Basic <followed by a space character');
     $request = new Request();
     $request->setHeaders($headers);
     $response = new Response();
     // Once for Basic
     try {
         $a = new Adapter\Http($this->_basicConfig);
         $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 (Adapter\Exception\ExceptionInterface $e) {
         // Good, it threw an exception
         unset($a);
     }
     // Stub request for Digest auth, must be reseted (recreated)
     $headers = new Headers();
     $headers->addHeaderLine('Authorization', 'Digest <followed by a space character');
     $request = new Request();
     $request->setHeaders($headers);
     // Once for Digest
     try {
         $a = new Adapter\Http($this->_digestConfig);
         $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 (Adapter\Exception\ExceptionInterface $e) {
         // Good, it threw an exception
         unset($a);
     }
 }
Exemplo n.º 4
0
 public function testNoResolvers()
 {
     $request = $this->getMock('Zend_Controller_Request_Http');
     $response = $this->getMock('Zend_Controller_Response_Http');
     // Stub request for Basic auth
     $request->expects($this->any())->method('getHeader')->will($this->returnValue('Basic <followed by a space caracter'));
     // Once for Basic
     try {
         $a = new Adapter\HTTP($this->_basicConfig);
         $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 (Adapter\Exception $e) {
         // Good, it threw an exception
         unset($a);
     }
     // 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 <followed by a space caracter'));
     // Once for Digest
     try {
         $a = new Adapter\HTTP($this->_digestConfig);
         $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 (Adapter\Exception $e) {
         // Good, it threw an exception
         unset($a);
     }
 }