Base for a static organization website

ToolbarAccessTest.php 1.5KB

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