Adding DbAcl test case for ticket #4288

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6530 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-03-09 04:19:58 +00:00
parent b3842566dc
commit 12ae20d228

View file

@ -112,6 +112,7 @@ class DBACL_TEST extends DB_ACL {
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models * @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/ */
class AclNodeTest extends CakeTestCase { class AclNodeTest extends CakeTestCase {
var $fixtures = array('core.aro', 'core.aco', 'core.aros_aco', 'core.aco_action'); var $fixtures = array('core.aro', 'core.aco', 'core.aros_aco', 'core.aco_action');
function setUp() { function setUp() {
@ -153,5 +154,26 @@ class DBACL_TEST extends DB_ACL {
$expected = array(6, 1); $expected = array(6, 1);
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
function testNodeAliasParenting() {
$Aco = new DbAcoTest();
$db =& ConnectionManager::getDataSource('test_suite');
$db->truncate($Aco);
$db->_queriesLog = array();
$Aco->create(array('model' => null, 'foreign_key' => null, 'parent_id' => null, 'alias' => 'Application'));
$Aco->save();
$Aco->create(array('model' => null, 'foreign_key' => null, 'parent_id' => $Aco->id, 'alias' => 'Pages'));
$Aco->save();
$result = $Aco->find('all');
$expected = array(
array('DbAcoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'Application', 'lft' => '1', 'rght' => '4'), 'DbAroTest' => array()),
array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3', ), 'DbAroTest' => array())
);
$this->assertEqual($result, $expected);
} }
}
?> ?>