Adding test for ACL node creation with parent ID, disproves #4098

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7026 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-05-23 06:16:50 +00:00
parent 57473a4633
commit c6e5ed8aba

View file

@ -109,6 +109,20 @@ class AclComponentTest extends CakeTestCase {
$this->assertTrue($this->Acl->Aco->save()); $this->assertTrue($this->Acl->Aco->save());
} }
function testAclCreateWithParent() {
$parent = $this->Acl->Aro->findByAlias('Peter', null, null, -1);
$this->Acl->Aro->create();
$this->Acl->Aro->save(array(
'alias' => 'Subordinate',
'model' => 'User',
'foreign_key' => 7,
'parent_id' => $parent['AroTwoTest']['id']
));
$result = $this->Acl->Aro->findByAlias('Subordinate', null, null, -1);
$this->assertEqual($result['AroTwoTest']['lft'], 16);
$this->assertEqual($result['AroTwoTest']['rght'], 17);
}
function testDbAclAllow() { function testDbAclAllow() {
$this->assertFalse($this->Acl->check('Micheal', 'tpsReports', 'read')); $this->assertFalse($this->Acl->check('Micheal', 'tpsReports', 'read'));
$this->assertTrue($this->Acl->allow('Micheal', 'tpsReports', array('read', 'delete', 'update'))); $this->assertTrue($this->Acl->allow('Micheal', 'tpsReports', array('read', 'delete', 'update')));