3
* PagesControllerTest file
7
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
8
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
10
* Licensed under The Open Group Test Suite License
11
* Redistributions of files must retain the above copyright notice.
13
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
14
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
16
* @subpackage cake.tests.cases.libs.controller
17
* @since CakePHP(tm) v 1.2.0.5436
18
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
20
if (!class_exists('AppController')) {
21
require_once LIBS . 'controller' . DS . 'app_controller.php';
22
} elseif (!defined('APP_CONTROLLER_EXISTS')) {
23
define('APP_CONTROLLER_EXISTS', true);
25
App::import('Controller', 'Pages');
28
* PagesControllerTest class
31
* @subpackage cake.tests.cases.libs.controller
33
class PagesControllerTest extends CakeTestCase {
51
function testDisplay() {
52
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
57
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS)
59
$Pages =& new PagesController();
61
$Pages->viewPath = 'posts';
62
$Pages->display('index');
63
$this->assertPattern('/posts index/', $Pages->output);
64
$this->assertEqual($Pages->viewVars['page'], 'index');
66
$Pages->viewPath = 'themed';
67
$Pages->display('test_theme', 'posts', 'index');
68
$this->assertPattern('/posts index themed view/', $Pages->output);
69
$this->assertEqual($Pages->viewVars['page'], 'test_theme');
70
$this->assertEqual($Pages->viewVars['subpage'], 'posts');