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 12:31:21 -04:00
|
|
|
* PHP 5
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-05-18 22:15:13 -03:00
|
|
|
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
2010-01-26 14:18:20 -05:00
|
|
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2010-10-03 12:31:21 -04: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 14:18:20 -05:00
|
|
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2010-05-18 22:15:13 -03:00
|
|
|
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
2010-12-24 13:57:20 -05: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 12:27:27 -04:00
|
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
2008-05-30 11:40:08 +00:00
|
|
|
*/
|
2010-12-18 00:04:44 -04:30
|
|
|
|
2010-12-09 01:25:24 -04:30
|
|
|
App::uses('PagesController', 'Controller');
|
2009-07-24 21:18:37 +02: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 13:57:20 -05:00
|
|
|
* @package cake.tests.cases.libs.controller
|
2008-05-30 11:40:08 +00:00
|
|
|
*/
|
|
|
|
class PagesControllerTest extends CakeTestCase {
|
2009-07-24 21:18:37 +02:00
|
|
|
|
2010-12-19 23:33:37 -04:30
|
|
|
/**
|
|
|
|
* 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-13 23:35:56 -05:00
|
|
|
App::build(array(
|
2011-03-22 00:46:51 -04:30
|
|
|
'View' => array(
|
|
|
|
LIBS . 'tests' . DS . 'test_app' . DS . 'View'. DS
|
|
|
|
)
|
2010-01-13 23:35:56 -05:00
|
|
|
));
|
2010-05-27 00:28:51 -04: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 15:15:23 +10:00
|
|
|
$this->assertPattern('/posts index/', $Pages->getResponse()->body());
|
2008-10-16 23:52:54 +00:00
|
|
|
$this->assertEqual($Pages->viewVars['page'], 'index');
|
|
|
|
|
|
|
|
$Pages->viewPath = 'themed';
|
|
|
|
$Pages->display('test_theme', 'posts', 'index');
|
2010-08-28 15:15:23 +10:00
|
|
|
$this->assertPattern('/posts index themed view/', $Pages->getResponse()->body());
|
2008-10-16 23:52:54 +00:00
|
|
|
$this->assertEqual($Pages->viewVars['page'], 'test_theme');
|
|
|
|
$this->assertEqual($Pages->viewVars['subpage'], 'posts');
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
|
|
|
}
|