Updating AclComponent to new Component API.

This commit is contained in:
mark_story 2010-07-04 18:41:08 -04:00
parent efc5054b65
commit 7b4916e16a
2 changed files with 22 additions and 15 deletions

View file

@ -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')`
*

View file

@ -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);
}
/**