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>
|
2011-05-29 21:31:39 +00:00
|
|
|
* Copyright 2005-2011, 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
|
|
|
*
|
2011-05-29 21:31:39 +00:00
|
|
|
* @copyright Copyright 2005-2011, 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
|
2011-07-26 06:16:14 +00:00
|
|
|
* @package Cake.Test.Case.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
|
|
|
*
|
2011-07-26 06:16:14 +00:00
|
|
|
* @package Cake.Test.Case.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
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function endTest() {
|
2010-12-20 04:03:37 +00:00
|
|
|
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
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public 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
|
|
|
));
|
2011-07-03 19:02:46 +00:00
|
|
|
$Pages = new PagesController(new CakeRequest(null, false), new CakeResponse());
|
2008-10-16 23:52:54 +00:00
|
|
|
|
2011-05-16 21:38:28 +00:00
|
|
|
$Pages->viewPath = 'Posts';
|
2008-10-16 23:52:54 +00:00
|
|
|
$Pages->display('index');
|
2011-07-20 02:51:49 +00:00
|
|
|
$this->assertPattern('/posts index/', $Pages->response->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');
|
2011-07-20 02:51:49 +00:00
|
|
|
$this->assertPattern('/posts index themed view/', $Pages->response->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
|
|
|
}
|
|
|
|
}
|