From c6e5ed8aba6c2b86cc63f65e53845e96747bb139 Mon Sep 17 00:00:00 2001 From: nate Date: Fri, 23 May 2008 06:16:50 +0000 Subject: [PATCH] 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 --- .../cases/libs/controller/components/acl.test.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cake/tests/cases/libs/controller/components/acl.test.php b/cake/tests/cases/libs/controller/components/acl.test.php index 3c9a2e883..10249aacc 100644 --- a/cake/tests/cases/libs/controller/components/acl.test.php +++ b/cake/tests/cases/libs/controller/components/acl.test.php @@ -109,6 +109,20 @@ class AclComponentTest extends CakeTestCase { $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() { $this->assertFalse($this->Acl->check('Micheal', 'tpsReports', 'read')); $this->assertTrue($this->Acl->allow('Micheal', 'tpsReports', array('read', 'delete', 'update')));