From 7b4916e16a9637a3e9602ac3950278fe35abd2a0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 4 Jul 2010 18:41:08 -0400 Subject: [PATCH] Updating AclComponent to new Component API. --- cake/libs/controller/components/acl.php | 14 +++++++++++ .../libs/controller/components/acl.test.php | 23 +++++++------------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/cake/libs/controller/components/acl.php b/cake/libs/controller/components/acl.php index 180f002d2..f5920753f 100644 --- a/cake/libs/controller/components/acl.php +++ b/cake/libs/controller/components/acl.php @@ -41,6 +41,20 @@ class AclComponent extends Component { */ protected $_Instance = null; +/** + * Aro object. + * + * @var string + */ + public $Aro; + +/** + * Aco object + * + * @var string + */ + public $Aco; + /** * Constructor. Will return an instance of the correct ACL class as defined in `Configure::read('Acl.classname')` * diff --git a/cake/tests/cases/libs/controller/components/acl.test.php b/cake/tests/cases/libs/controller/components/acl.test.php index 2eed2cb17..9e66bde52 100644 --- a/cake/tests/cases/libs/controller/components/acl.test.php +++ b/cake/tests/cases/libs/controller/components/acl.test.php @@ -199,7 +199,8 @@ class AclComponentTest extends CakeTestCase { $this->getMock('AclInterface', array(), array(), 'MockAclImplementation'); } Configure::write('Acl.classname', 'MockAclImplementation'); - $this->Acl = new AclComponent(); + $Collection = new ComponentCollection(); + $this->Acl = new AclComponent($Collection); } /** @@ -216,12 +217,13 @@ class AclComponentTest extends CakeTestCase { * test that construtor throws an exception when Acl.classname is a * non-existant class * + * @expectedException Exception * @return void */ function testConstrutorException() { - $this->expectException(); Configure::write('Acl.classname', 'AclClassNameThatDoesNotExist'); - $acl = new AclComponent(); + $Collection = new ComponentCollection(); + $acl = new AclComponent($Collection); } /** @@ -240,24 +242,14 @@ class AclComponentTest extends CakeTestCase { /** * test that adapter() whines when the class is not an AclBase * + * @expectedException Exception * @return void */ function testAdapterException() { - $this->expectException(); $thing = new StdClass(); $this->Acl->adapter($thing); } -/** - * testStartup method - * - * @access public - * @return void - */ - function testStartup() { - $controller = new Controller(); - $this->assertTrue($this->Acl->startup($controller)); - } } /** @@ -365,7 +357,8 @@ class DbAclTest extends CakeTestCase { Configure::write('Acl.classname', 'DbAclTwoTest'); Configure::write('Acl.database', 'test_suite'); - $this->Acl = new AclComponent(); + $Collection = new ComponentCollection(); + $this->Acl = new AclComponent($Collection); } /**