Skip to content

Commit

Permalink
Merge remote branch 'origin/1.2' into 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
predominant committed Mar 28, 2010
2 parents 5f3f662 + 39a4566 commit df544f2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
3 changes: 2 additions & 1 deletion cake/libs/model/db_acl.php
Expand Up @@ -111,7 +111,8 @@ function node($ref = null) {
'conditions' => array(
$db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"),
$db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"),
$db->name("{$type}{$i}.alias") . ' = ' . $db->value($alias, 'string')
$db->name("{$type}{$i}.alias") . ' = ' . $db->value($alias, 'string'),
$db->name("{$type}{$j}.id") . ' = ' . $db->name("{$type}{$i}.parent_id")
)
);

Expand Down
16 changes: 14 additions & 2 deletions cake/tests/cases/libs/model/db_acl.test.php
Expand Up @@ -260,7 +260,7 @@ function setUp() {
* @return void
*/
function testNode() {
$Aco = new DbAcoTest();
$Aco =& new DbAcoTest();
$result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id');
$expected = array(2, 1);
$this->assertEqual($result, $expected);
Expand Down Expand Up @@ -294,7 +294,19 @@ function testNode() {
$result = $Aco->node('');
$this->assertEqual($result, null);
}
/**

/**
* test that node() doesn't dig deeper than it should.
*
* @return void
*/
function testNodeWithDuplicatePathSegments() {
$Aco =& new DbAcoTest();
$nodes = $Aco->node('ROOT/Users');
$this->assertEqual($nodes[0]['DbAcoTest']['parent_id'], 1, 'Parent id does not point at ROOT. %s');
}

/**
* testNodeArrayFind method
*
* @access public
Expand Down
22 changes: 12 additions & 10 deletions cake/tests/fixtures/aco_fixture.php
@@ -1,5 +1,4 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
Expand Down Expand Up @@ -59,15 +58,18 @@ class AcoFixture extends CakeTestFixture {
* @access public
*/
var $records = array(
array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 18),
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller1', 'lft' => 2, 'rght' => 9),
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 3, 'rght' => 6),
array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 4, 'rght' => 5),
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 7, 'rght' => 8),
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller2', 'lft' => 10, 'rght' => 17),
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 11, 'rght' => 14),
array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 12, 'rght' => 13),
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 15, 'rght' => 16),
array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 24),
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller1', 'lft' => 2, 'rght' => 9),
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 3, 'rght' => 6),
array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 4, 'rght' => 5),
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 7, 'rght' => 8),
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller2','lft' => 10, 'rght' => 17),
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 11, 'rght' => 14),
array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 12, 'rght' => 13),
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 15, 'rght' => 16),
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Users', 'lft' => 18, 'rght' => 23),
array('parent_id' => 9, 'model' => null, 'foreign_key' => null, 'alias' => 'Users', 'lft' => 19, 'rght' => 22),
array('parent_id' => 10, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 20, 'rght' => 21),
);
}

Expand Down

0 comments on commit df544f2

Please sign in to comment.