"Refactoring Component tests.

Removed Component::!__construct();"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6374 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-01-13 04:06:01 +00:00
parent 6419ee2bc7
commit 654669d48f
2 changed files with 10 additions and 13 deletions

View file

@ -44,14 +44,6 @@ class Component extends Object {
* @access public
*/
var $controller = null;
/**
* Constructor
*
* @return object
*/
function __construct() {
}
/**
* Used to initialize the components for current controller
*

View file

@ -47,7 +47,7 @@ class ComponentTest extends CakeTestCase {
$Controller = new ComponentTestController();
$Controller->components = array('RequestHandler');
$Component = new Component($Controller);
$Component = new Component();
$Component->init($Controller);
$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));
@ -56,6 +56,7 @@ class ComponentTest extends CakeTestCase {
$Controller->plugin = 'test_plugin';
$Controller->components = array('RequestHandler', 'TestPluginComponent');
$Component = new Component();
$Component->init($Controller);
$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));
@ -66,14 +67,18 @@ class ComponentTest extends CakeTestCase {
$Controller = new ComponentTestController();
$Controller->components = array('Security');
$result = $Component->init($Controller);
$this->assertTrue(is_object($Controller->Security));
$this->assertTrue(is_object($Controller->Security->Session));
$Component = new Component();
$Component->init($Controller);
$this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));
$this->assertTrue(is_a($Controller->Security->Session, 'SessionComponent'));
$Controller = new ComponentTestController();
$Controller->components = array('Security', 'Cookie', 'RequestHandler');
$result = $Component->init($Controller);
$Component = new Component();
$Component->init($Controller);
$this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));
$this->assertTrue(is_a($Controller->Security->RequestHandler, 'RequestHandlerComponent'));
$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));