~tsep-dev/tsep/0.9-beta

« back to all changes in this revision

Viewing changes to branches/symfony/cake/tests/cases/libs/controller/pages_controller.test.php

  • Committer: geoffreyfishing
  • Date: 2011-01-11 23:46:12 UTC
  • Revision ID: svn-v4:ae0de26e-ed09-4cbe-9a20-e40b4c60ac6c::125
Created a symfony branch for future migration to symfony

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * PagesControllerTest file
 
4
 *
 
5
 * PHP versions 4 and 5
 
6
 *
 
7
 * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 
8
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 
9
 *
 
10
 *  Licensed under The Open Group Test Suite License
 
11
 *  Redistributions of files must retain the above copyright notice.
 
12
 *
 
13
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 
14
 * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
 
15
 * @package       cake
 
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
 
19
 */
 
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);
 
24
}
 
25
App::import('Controller', 'Pages');
 
26
 
 
27
/**
 
28
 * PagesControllerTest class
 
29
 *
 
30
 * @package       cake
 
31
 * @subpackage    cake.tests.cases.libs.controller
 
32
 */
 
33
class PagesControllerTest extends CakeTestCase {
 
34
 
 
35
/**
 
36
 * endTest method
 
37
 *
 
38
 * @access public
 
39
 * @return void
 
40
 */
 
41
        function endTest() {
 
42
                App::build();
 
43
        }
 
44
 
 
45
/**
 
46
 * testDisplay method
 
47
 *
 
48
 * @access public
 
49
 * @return void
 
50
 */
 
51
        function testDisplay() {
 
52
                if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
 
53
                        return;
 
54
                }
 
55
 
 
56
                App::build(array(
 
57
                        'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS)
 
58
                ));
 
59
                $Pages =& new PagesController();
 
60
 
 
61
                $Pages->viewPath = 'posts';
 
62
                $Pages->display('index');
 
63
                $this->assertPattern('/posts index/', $Pages->output);
 
64
                $this->assertEqual($Pages->viewVars['page'], 'index');
 
65
 
 
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');
 
71
        }
 
72
}