Base for a static organization website

LogPanelTest.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * DebugKit Log Panel Test Cases
  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. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  16. **/
  17. App::uses('LogPanel', 'DebugKit.Lib/Panel');
  18. App::uses('Controller', 'Controller');
  19. /**
  20. * Class LogPanelTest
  21. *
  22. */
  23. class LogPanelTest extends CakeTestCase {
  24. /**
  25. * set up
  26. *
  27. * @return void
  28. */
  29. public function setUp() {
  30. parent::setUp();
  31. $this->panel = new LogPanel();
  32. }
  33. /**
  34. * Test that logging configs are created.
  35. *
  36. * @return void
  37. */
  38. public function testConstructor() {
  39. $result = CakeLog::configured();
  40. $this->assertContains('debug_kit_log_panel', $result);
  41. $this->assertTrue(count($result) > 1, 'Default loggers were not added.');
  42. }
  43. /**
  44. * testBeforeRender
  45. *
  46. * @return void
  47. */
  48. public function testBeforeRender() {
  49. $controller = new Controller();
  50. CakeLog::write('error', 'Test');
  51. $result = $this->panel->beforeRender($controller);
  52. $this->assertInstanceOf('DebugKitLog', $result);
  53. $this->assertTrue(isset($result->logs));
  54. $this->assertCount(1, $result->logs['error']);
  55. }
  56. }