From 654669d48f0e4029f68200259e8466b767c696df Mon Sep 17 00:00:00 2001 From: phpnut Date: Sun, 13 Jan 2008 04:06:01 +0000 Subject: [PATCH] "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 --- cake/libs/controller/component.php | 8 -------- .../cases/libs/controller/component.test.php | 15 ++++++++++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cake/libs/controller/component.php b/cake/libs/controller/component.php index c77f50481..9c7e67f4f 100644 --- a/cake/libs/controller/component.php +++ b/cake/libs/controller/component.php @@ -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 * diff --git a/cake/tests/cases/libs/controller/component.test.php b/cake/tests/cases/libs/controller/component.test.php index 741e65f86..528bb4d1a 100644 --- a/cake/tests/cases/libs/controller/component.test.php +++ b/cake/tests/cases/libs/controller/component.test.php @@ -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'));