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; 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')` * 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'); $this->getMock('AclInterface', array(), array(), 'MockAclImplementation');
} }
Configure::write('Acl.classname', '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 * test that construtor throws an exception when Acl.classname is a
* non-existant class * non-existant class
* *
* @expectedException Exception
* @return void * @return void
*/ */
function testConstrutorException() { function testConstrutorException() {
$this->expectException();
Configure::write('Acl.classname', 'AclClassNameThatDoesNotExist'); 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 * test that adapter() whines when the class is not an AclBase
* *
* @expectedException Exception
* @return void * @return void
*/ */
function testAdapterException() { function testAdapterException() {
$this->expectException();
$thing = new StdClass(); $thing = new StdClass();
$this->Acl->adapter($thing); $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.classname', 'DbAclTwoTest');
Configure::write('Acl.database', 'test_suite'); Configure::write('Acl.database', 'test_suite');
$this->Acl = new AclComponent(); $Collection = new ComponentCollection();
$this->Acl = new AclComponent($Collection);
} }
/** /**