2008-05-30 11:40:08 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2009-03-18 17:55:58 +00:00
|
|
|
* ComponentTest file
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
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
|
|
|
*
|
|
|
|
* Licensed under The Open Group Test Suite License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
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
|
2009-03-18 17:55:58 +00:00
|
|
|
* @package cake
|
2008-10-30 17:30:26 +00:00
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
|
|
|
* @since CakePHP(tm) v 1.2.0.5436
|
|
|
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
2008-05-30 11:40:08 +00:00
|
|
|
*/
|
2009-07-26 01:27:02 +00:00
|
|
|
App::import('Controller', 'Controller', false);
|
|
|
|
App::import('Controller', 'Component', false);
|
2008-06-04 02:39:05 +00:00
|
|
|
|
|
|
|
if (!class_exists('AppController')) {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-05 15:20:45 +00:00
|
|
|
/**
|
|
|
|
* AppController class
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-10-30 17:30:26 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-05 15:20:45 +00:00
|
|
|
*/
|
2008-06-04 02:39:05 +00:00
|
|
|
class AppController extends Controller {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-05 15:20:45 +00:00
|
|
|
/**
|
|
|
|
* name property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-05 15:20:45 +00:00
|
|
|
* @var string 'App'
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $name = 'App';
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-05 15:20:45 +00:00
|
|
|
/**
|
|
|
|
* uses property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-05 15:20:45 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $uses = array();
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-05 15:20:45 +00:00
|
|
|
/**
|
|
|
|
* helpers property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-05 15:20:45 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $helpers = array();
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-05 15:20:45 +00:00
|
|
|
/**
|
|
|
|
* components property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-05 15:20:45 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $components = array('Orange' => array('colour' => 'blood orange'));
|
2008-06-04 02:39:05 +00:00
|
|
|
}
|
2009-03-21 23:55:39 +00:00
|
|
|
} elseif (!defined('APP_CONTROLLER_EXISTS')){
|
2008-06-20 20:17:23 +00:00
|
|
|
define('APP_CONTROLLER_EXISTS', true);
|
2008-06-04 02:39:05 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-04 02:39:05 +00:00
|
|
|
/**
|
|
|
|
* ParamTestComponent
|
|
|
|
*
|
2009-03-18 17:55:58 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-04 02:39:05 +00:00
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
class ParamTestComponent extends Component {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-05 15:20:45 +00:00
|
|
|
/**
|
|
|
|
* name property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-05 15:20:45 +00:00
|
|
|
* @var string 'ParamTest'
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $name = 'ParamTest';
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-10 22:38:05 +00:00
|
|
|
/**
|
2008-06-05 15:20:45 +00:00
|
|
|
* components property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-05 15:20:45 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $components = array('Banana' => array('config' => 'value'));
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-10 22:38:05 +00:00
|
|
|
/**
|
2008-06-05 15:20:45 +00:00
|
|
|
* initialize method
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
|
|
|
* @param mixed $controller
|
|
|
|
* @param mixed $settings
|
2008-06-05 15:20:45 +00:00
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
2008-06-04 02:39:05 +00:00
|
|
|
function initialize(&$controller, $settings) {
|
|
|
|
foreach ($settings as $key => $value) {
|
|
|
|
if (is_numeric($key)) {
|
|
|
|
$this->{$value} = true;
|
|
|
|
} else {
|
|
|
|
$this->{$key} = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-05-30 11:40:08 +00:00
|
|
|
/**
|
2009-03-18 17:55:58 +00:00
|
|
|
* ComponentTestController class
|
2008-05-30 11:40:08 +00:00
|
|
|
*
|
2009-03-18 17:55:58 +00:00
|
|
|
* @package cake
|
2008-10-30 17:30:26 +00:00
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-05-30 11:40:08 +00:00
|
|
|
*/
|
|
|
|
class ComponentTestController extends AppController {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* name property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @var string 'ComponentTest'
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $name = 'ComponentTest';
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* uses property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $uses = array();
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* AppleComponent class
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-10-30 17:30:26 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-02 19:22:55 +00:00
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
class AppleComponent extends Component {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* components property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $components = array('Orange');
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testName property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @var mixed null
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $testName = null;
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* startup method
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
|
|
|
* @param mixed $controller
|
2008-06-02 19:22:55 +00:00
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
2008-05-31 03:54:22 +00:00
|
|
|
function startup(&$controller) {
|
2008-06-02 04:57:06 +00:00
|
|
|
$this->testName = $controller->name;
|
2008-05-31 03:54:22 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* OrangeComponent class
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-10-30 17:30:26 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-02 19:22:55 +00:00
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
class OrangeComponent extends Component {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* components property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $components = array('Banana');
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* initialize method
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
|
|
|
* @param mixed $controller
|
2008-06-02 19:22:55 +00:00
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
2010-08-12 03:08:46 +00:00
|
|
|
function initialize(&$controller) {
|
2009-01-02 22:47:38 +00:00
|
|
|
$this->Controller = $controller;
|
2008-06-02 04:57:06 +00:00
|
|
|
$this->Banana->testField = 'OrangeField';
|
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-03-18 17:55:58 +00:00
|
|
|
/**
|
|
|
|
* startup method
|
|
|
|
*
|
|
|
|
* @param Controller $controller
|
|
|
|
* @return string
|
|
|
|
*/
|
2010-04-05 03:19:38 +00:00
|
|
|
public function startup(&$controller) {
|
2008-10-15 13:07:46 +00:00
|
|
|
$controller->foo = 'pass';
|
|
|
|
}
|
2008-05-31 03:54:22 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* BananaComponent class
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-10-30 17:30:26 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-02 19:22:55 +00:00
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
class BananaComponent extends Component {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* testField property
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @var string 'BananaField'
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $testField = 'BananaField';
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-03-18 17:55:58 +00:00
|
|
|
/**
|
|
|
|
* startup method
|
|
|
|
*
|
|
|
|
* @param Controller $controller
|
|
|
|
* @return string
|
|
|
|
*/
|
2010-04-05 03:19:38 +00:00
|
|
|
public function startup(&$controller) {
|
2008-10-15 13:07:46 +00:00
|
|
|
$controller->bar = 'fail';
|
|
|
|
}
|
2008-05-31 03:54:22 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-06 16:18:14 +00:00
|
|
|
/**
|
|
|
|
* MutuallyReferencingOneComponent class
|
|
|
|
*
|
2008-10-30 17:30:26 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-06 16:18:14 +00:00
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
class MutuallyReferencingOneComponent extends Component {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-03-18 17:55:58 +00:00
|
|
|
/**
|
|
|
|
* components property
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $components = array('MutuallyReferencingTwo');
|
2008-06-06 16:18:14 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-06 16:18:14 +00:00
|
|
|
/**
|
|
|
|
* MutuallyReferencingTwoComponent class
|
|
|
|
*
|
2008-10-30 17:30:26 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-06 16:18:14 +00:00
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
class MutuallyReferencingTwoComponent extends Component {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-03-18 17:55:58 +00:00
|
|
|
/**
|
|
|
|
* components property
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $components = array('MutuallyReferencingOne');
|
2008-06-06 16:18:14 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-01-02 22:47:38 +00:00
|
|
|
/**
|
|
|
|
* SomethingWithEmailComponent class
|
|
|
|
*
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
class SomethingWithEmailComponent extends Component {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-03-18 17:55:58 +00:00
|
|
|
/**
|
|
|
|
* components property
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2010-04-04 07:14:00 +00:00
|
|
|
public $components = array('Email');
|
2009-01-02 22:47:38 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2010-02-28 06:49:19 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* ComponentTest class
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-10-30 17:30:26 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.tests.cases.libs.controller
|
2008-06-02 19:22:55 +00:00
|
|
|
*/
|
2008-05-30 11:40:08 +00:00
|
|
|
class ComponentTest extends CakeTestCase {
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-02 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* setUp method
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-02 19:22:55 +00:00
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
2008-05-30 11:40:08 +00:00
|
|
|
function setUp() {
|
2009-06-07 22:24:10 +00:00
|
|
|
$this->_pluginPaths = App::path('plugins');
|
2009-06-11 16:13:16 +00:00
|
|
|
App::build(array(
|
|
|
|
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
2008-10-15 13:07:46 +00:00
|
|
|
));
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-03-21 23:55:39 +00:00
|
|
|
/**
|
|
|
|
* tearDown method
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function tearDown() {
|
2009-06-11 16:13:16 +00:00
|
|
|
App::build();
|
2009-03-21 23:55:39 +00:00
|
|
|
ClassRegistry::flush();
|
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2010-07-04 18:58:57 +00:00
|
|
|
/**
|
|
|
|
* test accessing inner components.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function testInnerComponentConstruction() {
|
|
|
|
$Collection = new ComponentCollection();
|
|
|
|
$Component = new AppleComponent($Collection);
|
|
|
|
|
|
|
|
$this->assertType('OrangeComponent', $Component->Orange, 'class is wrong');
|
|
|
|
}
|
|
|
|
|
2008-06-04 02:39:05 +00:00
|
|
|
/**
|
|
|
|
* test component loading
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2008-05-31 03:54:22 +00:00
|
|
|
function testNestedComponentLoading() {
|
2010-07-04 18:58:57 +00:00
|
|
|
$Collection = new ComponentCollection();
|
|
|
|
$Apple = new AppleComponent($Collection);
|
2008-05-31 03:54:22 +00:00
|
|
|
|
2010-07-04 18:58:57 +00:00
|
|
|
$this->assertType('OrangeComponent', $Apple->Orange, 'class is wrong');
|
|
|
|
$this->assertType('BananaComponent', $Apple->Orange->Banana, 'class is wrong');
|
|
|
|
$this->assertTrue(empty($Apple->Session));
|
|
|
|
$this->assertTrue(empty($Apple->Orange->Session));
|
2008-05-31 03:54:22 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2008-06-04 02:39:05 +00:00
|
|
|
/**
|
2010-07-04 18:58:57 +00:00
|
|
|
* test that component components are not enabled in the collection.
|
2008-06-04 02:39:05 +00:00
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2010-07-04 18:58:57 +00:00
|
|
|
function testInnerComponentsAreNotEnabled() {
|
|
|
|
$Collection = new ComponentCollection();
|
|
|
|
$Apple = $Collection->load('Apple');
|
2008-10-15 13:07:46 +00:00
|
|
|
|
2010-07-04 18:58:57 +00:00
|
|
|
$this->assertType('OrangeComponent', $Apple->Orange, 'class is wrong');
|
|
|
|
$result = $Collection->enabled();
|
|
|
|
$this->assertEquals(array('Apple'), $result, 'Too many components enabled.');
|
2010-02-28 06:49:19 +00:00
|
|
|
}
|
|
|
|
|
2008-06-04 02:39:05 +00:00
|
|
|
/**
|
|
|
|
* test a component being used more than once.
|
2008-06-06 16:18:14 +00:00
|
|
|
*
|
2008-06-04 02:39:05 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2008-06-02 04:57:06 +00:00
|
|
|
function testMultipleComponentInitialize() {
|
2010-07-04 18:58:57 +00:00
|
|
|
$Collection = new ComponentCollection();
|
|
|
|
$Banana = $Collection->load('Banana');
|
|
|
|
$Orange = $Collection->load('Orange');
|
|
|
|
|
|
|
|
$this->assertSame($Banana, $Orange->Banana, 'Should be references');
|
|
|
|
$Banana->testField = 'OrangeField';
|
|
|
|
|
|
|
|
$this->assertSame($Banana->testField, $Orange->Banana->testField, 'References are broken');
|
2008-05-31 03:54:22 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-01-02 22:47:38 +00:00
|
|
|
/**
|
|
|
|
* Test mutually referencing components.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function testSomethingReferencingEmailComponent() {
|
2010-08-12 03:08:46 +00:00
|
|
|
$Controller = new ComponentTestController();
|
2009-01-02 22:47:38 +00:00
|
|
|
$Controller->components = array('SomethingWithEmail');
|
2009-10-31 18:08:56 +00:00
|
|
|
$Controller->uses = false;
|
2009-01-02 22:47:38 +00:00
|
|
|
$Controller->constructClasses();
|
2010-08-12 03:08:46 +00:00
|
|
|
$Controller->Components->trigger('initialize', array(&$Controller));
|
2009-01-02 22:47:38 +00:00
|
|
|
$Controller->beforeFilter();
|
2010-08-12 03:08:46 +00:00
|
|
|
$Controller->Components->trigger('startup', array(&$Controller));
|
2009-03-18 17:55:58 +00:00
|
|
|
|
2010-08-12 03:08:46 +00:00
|
|
|
$this->assertType('SomethingWithEmailComponent', $Controller->SomethingWithEmail);
|
|
|
|
$this->assertType('EmailComponent', $Controller->SomethingWithEmail->Email);
|
|
|
|
$this->assertType('ComponentTestController', $Controller->SomethingWithEmail->Email->Controller);
|
2009-01-02 22:47:38 +00:00
|
|
|
}
|
2009-07-24 19:18:37 +00:00
|
|
|
|
2009-02-12 13:36:20 +00:00
|
|
|
/**
|
2009-03-21 23:55:39 +00:00
|
|
|
* Test that SessionComponent doesn't get added if its already in the components array.
|
2009-02-12 13:36:20 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2009-03-21 23:55:39 +00:00
|
|
|
*/
|
2010-04-05 03:19:38 +00:00
|
|
|
public function testDoubleLoadingOfSessionComponent() {
|
2009-10-31 18:08:56 +00:00
|
|
|
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
|
|
|
|
return;
|
|
|
|
}
|
2009-03-21 23:55:39 +00:00
|
|
|
|
2009-02-12 13:36:20 +00:00
|
|
|
$Controller =& new ComponentTestController();
|
2009-10-31 18:08:56 +00:00
|
|
|
$Controller->uses = false;
|
2009-02-12 13:36:20 +00:00
|
|
|
$Controller->components = array('Session');
|
|
|
|
$Controller->constructClasses();
|
|
|
|
|
|
|
|
$this->assertEqual($Controller->components, array('Session' => '', 'Orange' => array('colour' => 'blood orange')));
|
|
|
|
}
|
2009-10-31 18:08:56 +00:00
|
|
|
|
2008-05-30 11:40:08 +00:00
|
|
|
}
|