Skip to content
Permalink
Browse files

Updating setParent() to use either Model.key or alias. Tests added.

  • Loading branch information...
markstory committed Aug 2, 2009
1 parent a599f53 commit ca8744c8b90d46a4fbf6deeda53cc3dca2fdfa2c
Showing with 19 additions and 2 deletions.
  1. +5 −2 cake/console/libs/acl.php
  2. +14 −0 cake/tests/cases/console/libs/acl.test.php
@@ -194,10 +194,13 @@ function setParent() {
$this->_checkArgs(3, 'setParent');
$this->checkNodeType();
extract($this->__dataVars());
$target = $this->parseIdentifier($this->args[1]);
$parent = $this->parseIdentifier($this->args[2]);
$data = array(
$class => array(
'id' => $this->args[1],
'parent_id' => $this->args[2]
'id' => $this->_getNodeId($class, $target),
'parent_id' => $this->_getNodeId($class, $parent)
)
);
$this->Acl->{$class}->create();
@@ -203,5 +203,19 @@ function testDelete() {
$result = $Aro->read(null, 3);
$this->assertFalse($result);
}
/**
* test setParent method.
*
* @return void
**/
function testSetParent() {
$this->Task->args = array('aro', 'AuthUser.2', 'root');
$this->Task->setParent();
$Aro =& ClassRegistry::init('Aro');
$result = $Aro->read(null, 4);
$this->assertEqual($result['Aro']['parent_id'], null);
}
}
?>

0 comments on commit ca8744c

Please sign in to comment.
You can’t perform that action at this time.