2008-05-30 11:40:08 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2009-03-18 17:55:58 +00:00
|
|
|
* PagesControllerTest file
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-10-03 16:31:21 +00:00
|
|
|
* PHP 5
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-05-19 01:15:13 +00:00
|
|
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
2010-01-26 19:18:20 +00:00
|
|
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-10-03 16:31:21 +00:00
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-01-26 19:18:20 +00:00
|
|
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2010-05-19 01:15:13 +00:00
|
|
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
2010-12-24 18:57:20 +00:00
|
|
|
* @package cake.tests.cases.libs.controller
|
2008-10-30 17:30:26 +00:00
|
|
|
* @since CakePHP(tm) v 1.2.0.5436
|
2010-10-03 16:27:27 +00:00
|
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
2008-05-30 11:40:08 +00:00
|
|
|
*/
|
2010-12-18 04:34:44 +00:00
|
|
|
|
2010-12-09 05:55:24 +00:00
|
|
|
App::uses('PagesController', 'Controller');
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-05-30 11:40:08 +00:00
|
|
|
/**
|
2009-03-18 17:55:58 +00:00
|
|
|
* PagesControllerTest class
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-12-24 18:57:20 +00:00
|
|
|
* @package cake.tests.cases.libs.controller
|
2008-05-30 11:40:08 +00:00
|
|
|
*/
|
|
|
|
class PagesControllerTest extends CakeTestCase {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2010-12-20 04:03:37 +00:00
|
|
|
/**
|
|
|
|
* endTest method
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function endTest() {
|
|
|
|
App::build();
|
|
|
|
}
|
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
2008-10-16 23:52:54 +00:00
|
|
|
* testDisplay method
|
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
2008-10-16 23:52:54 +00:00
|
|
|
function testDisplay() {
|
2010-01-14 04:35:56 +00:00
|
|
|
App::build(array(
|
2011-03-22 05:16:51 +00:00
|
|
|
'View' => array(
|
2011-04-17 10:35:21 +00:00
|
|
|
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
|
2011-03-22 05:16:51 +00:00
|
|
|
)
|
2010-01-14 04:35:56 +00:00
|
|
|
));
|
2010-05-27 04:28:51 +00:00
|
|
|
$Pages = new PagesController(new CakeRequest(null, false));
|
2008-10-16 23:52:54 +00:00
|
|
|
|
|
|
|
$Pages->viewPath = 'posts';
|
|
|
|
$Pages->display('index');
|
2010-08-28 05:15:23 +00:00
|
|
|
$this->assertPattern('/posts index/', $Pages->getResponse()->body());
|
2008-10-16 23:52:54 +00:00
|
|
|
$this->assertEqual($Pages->viewVars['page'], 'index');
|
|
|
|
|
2011-05-15 04:44:41 +00:00
|
|
|
$Pages->viewPath = 'Themed';
|
|
|
|
$Pages->display('TestTheme', 'Posts', 'index');
|
2010-08-28 05:15:23 +00:00
|
|
|
$this->assertPattern('/posts index themed view/', $Pages->getResponse()->body());
|
2011-05-15 04:44:41 +00:00
|
|
|
$this->assertEqual($Pages->viewVars['page'], 'TestTheme');
|
|
|
|
$this->assertEqual($Pages->viewVars['subpage'], 'Posts');
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
|
|
|
}
|