assertEquals($sapi, Zend_Debug::getSapi()); } public function testDebugDump() { Zend_Debug::setSapi('cli'); $data = 'string'; $result = Zend_Debug::Dump($data, null, false); $result = str_replace(array(PHP_EOL, "\n"), '_', $result); $expected = "__string(6) \"string\"__"; $this->assertEquals($expected, $result); } public function testDebugCgi() { Zend_Debug::setSapi('cgi'); $data = 'string'; $result = Zend_Debug::Dump($data, null, false); // Has to check for two strings, because xdebug internally handles CLI vs Web $this->assertContains($result, array( "
string(6) \"string\"\n
", "
string(6) "string"\n
", ) ); } public function testDebugDumpEcho() { Zend_Debug::setSapi('cli'); $data = 'string'; ob_start(); $result1 = Zend_Debug::Dump($data, null, true); $result2 = ob_get_contents(); ob_end_clean(); $this->assertContains('string(6) "string"', $result1); $this->assertEquals($result1, $result2); } public function testDebugDumpLabel() { Zend_Debug::setSapi('cli'); $data = 'string'; $label = 'LABEL'; $result = Zend_Debug::Dump($data, $label, false); $result = str_replace(array(PHP_EOL, "\n"), '_', $result); $expected = "_{$label} _string(6) \"string\"__"; $this->assertEquals($expected, $result); } /** * @group ZF-4136 * @group ZF-1663 */ public function testXdebugEnabledAndNonCliSapiDoesNotEscapeSpecialChars() { if(!extension_loaded('xdebug')) { $this->markTestSkipped("This test only works in combination with xdebug."); } Zend_Debug::setSapi('apache'); $a = array("a" => "b"); $result = Zend_Debug::dump($a, "LABEL", false); $this->assertContains("
", $result);
        $this->assertContains("
", $result); } }