Base for a static organization website

DebugKitDebuggerTest.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * DebugKit Debugger Test Case File
  4. *
  5. * PHP 5
  6. *
  7. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  8. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * Redistributions of files must retain the above copyright notice.
  12. *
  13. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://cakephp.org CakePHP(tm) Project
  15. * @since debug_kit 0.1
  16. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  17. **/
  18. App::uses('DebugKitDebugger', 'DebugKit.Lib');
  19. require_once CakePlugin::path('DebugKit') . 'Test' . DS . 'Case' . DS . 'TestFireCake.php';
  20. /**
  21. * Test case for the DebugKitDebugger
  22. *
  23. * @since debug_kit 0.1
  24. */
  25. class DebugKitDebuggerTest extends CakeTestCase {
  26. /**
  27. * setUp method
  28. *
  29. * @return void
  30. */
  31. public function setUp() {
  32. parent::setUp();
  33. Configure::write('log', false);
  34. $this->firecake = FireCake::getInstance('TestFireCake');
  35. TestFireCake::reset();
  36. }
  37. /**
  38. * tearDown method
  39. *
  40. * @return void
  41. */
  42. public function tearDown() {
  43. parent::tearDown();
  44. Configure::write('log', true);
  45. DebugKitDebugger::clearTimers();
  46. TestFireCake::reset();
  47. }
  48. /**
  49. * test output switch to firePHP
  50. *
  51. * @return void
  52. */
  53. public function testOutput() {
  54. Debugger::getInstance('DebugKitDebugger');
  55. Debugger::addFormat('fb', array('callback' => 'DebugKitDebugger::fireError'));
  56. Debugger::outputAs('fb');
  57. set_error_handler('ErrorHandler::handleError');
  58. $foo .= '';
  59. restore_error_handler();
  60. $result = $this->firecake->sentHeaders;
  61. $this->assertRegExp('/GROUP_START/', $result['X-Wf-1-1-1-1']);
  62. $this->assertRegExp('/ERROR/', $result['X-Wf-1-1-1-2']);
  63. $this->assertRegExp('/GROUP_END/', $result['X-Wf-1-1-1-5']);
  64. Debugger::getInstance('Debugger');
  65. Debugger::outputAs('html');
  66. }
  67. }