Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12345 anikendra 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
 
18
App::uses('LogPanel', 'DebugKit.Lib/Panel');
19
App::uses('Controller', 'Controller');
20
 
21
/**
22
 * Class LogPanelTest
23
 *
24
 */
25
class LogPanelTest extends CakeTestCase {
26
 
27
/**
28
 * set up
29
 *
30
 * @return void
31
 */
32
	public function setUp() {
33
		parent::setUp();
34
		$this->panel = new LogPanel();
35
	}
36
 
37
/**
38
 * Test that logging configs are created.
39
 *
40
 * @return void
41
 */
42
	public function testConstructor() {
43
		$result = CakeLog::configured();
44
		$this->assertContains('debug_kit_log_panel', $result);
45
		$this->assertTrue(count($result) > 1, 'Default loggers were not added.');
46
	}
47
 
48
/**
49
 * testBeforeRender
50
 *
51
 * @return void
52
 */
53
	public function testBeforeRender() {
54
		$controller = new Controller();
55
 
56
		CakeLog::write('error', 'Test');
57
 
58
		$result = $this->panel->beforeRender($controller);
59
		$this->assertInstanceOf('DebugKitLog', $result);
60
		$this->assertTrue(isset($result->logs));
61
		$this->assertCount(1, $result->logs['error']);
62
	}
63
}