Exemple #1
0
 /**
  * Tests that changes in output formats using Debugger::output() change the templates used.
  *
  * @return void
  */
 public function testChangeOutputFormats()
 {
     set_error_handler('Cake\\Error\\Debugger::showError');
     $this->_restoreError = true;
     Debugger::output('js', array('traceLine' => '{:reference} - <a href="txmt://open?url=file://{:file}' . '&line={:line}">{:path}</a>, line {:line}'));
     $result = Debugger::trace();
     $this->assertRegExp('/' . preg_quote('txmt://open?url=file://', '/') . '(\\/|[A-Z]:\\\\)' . '/', $result);
     Debugger::output('xml', array('error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' . '{:description}</error>', 'context' => "<context>{:context}</context>", 'trace' => "<stack>{:trace}</stack>"));
     Debugger::output('xml');
     ob_start();
     $foo .= '';
     $result = ob_get_clean();
     $expected = array('error' => array(), 'code' => array(), '8', '/code', 'file' => array(), 'preg:/[^<]+/', '/file', 'line' => array(), '' . ((int) __LINE__ - 7), '/line', 'preg:/Undefined variable:\\s+foo/', '/error');
     $this->assertHtml($expected, $result, true);
 }