Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12345 anikendra 1
<?php
2
/**
3
 * DebugKit ToolbarAccess Model Test case
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         DebugKit 1.3
16
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
17
 **/
18
 
19
App::uses('ToolbarAccess', 'DebugKit.Model');
20
 
21
/**
22
 * Test case for ToolbarAccess model
23
 *
24
 * @since         DebugKit 1.3
25
 */
26
class ToolbarAccessTestCase extends CakeTestCase {
27
 
28
/**
29
 * Included fixtures
30
 *
31
 * @var array
32
 */
33
	public $fixtures = array('core.post');
34
 
35
/**
36
 * setUp method
37
 *
38
 * @return void
39
 */
40
	public function setUp() {
41
		parent::setUp();
42
		$this->Model = new ToolbarAccess();
43
	}
44
 
45
/**
46
 * tearDown
47
 *
48
 * @return void
49
 */
50
	public function tearDown() {
51
		parent::tearDown();
52
		unset($this->Model);
53
	}
54
 
55
/**
56
 * test that explain query returns arrays of query information.
57
 *
58
 * @return void
59
 */
60
	public function testExplainQuery() {
61
		$Post = new CakeTestModel(array('table' => 'posts', 'alias' => 'Post'));
62
		$db = $Post->getDataSource();
63
		$sql = 'SELECT * FROM ' . $db->fullTableName('posts') . ';';
64
		$result = $this->Model->explainQuery($Post->useDbConfig, $sql);
65
 
66
		$this->assertTrue(is_array($result));
67
		$this->assertFalse(empty($result));
68
	}
69
}