Implementing AclNodeTest through fixtures

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4749 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mariano.iglesias 2007-04-04 07:13:33 +00:00
parent 87bb47b5af
commit f12d025a23
5 changed files with 266 additions and 9 deletions

View file

@ -31,23 +31,80 @@
}
require_once LIBS.'model'.DS.'model.php';
require_once LIBS.'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aclnode.php';
require_once LIBS.'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aco.php';
require_once LIBS.'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aro.php';
require_once LIBS.'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'permission.php';
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
class AclNodeTestBase extends AclNode {
var $useDbConfig = 'test_suite';
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
class AroTest extends AclNodeTestBase {
var $name = 'AroTest';
var $useTable = 'aros';
var $hasAndBelongsToMany = array('AcoTest' => array('with' => 'PermissionTest'));
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
class AcoTest extends AclNodeTestBase {
var $name = 'AcoTest';
var $useTable = 'acos';
var $hasAndBelongsToMany = array('AroTest' => array('with' => 'PermissionTest'));
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
class PermissionTest extends CakeTestModel {
var $name = 'PermissionTest';
var $useTable = 'aros_acos';
var $cacheQueries = false;
var $belongsTo = 'AroTest,AcoTest';
var $actsAs = null;
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
class AcoActionTest extends CakeTestModel {
var $name = 'AcoActionTest';
var $useTable = 'aco_actions';
var $belongsTo = 'AcoTest';
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
class AclNodeTest extends UnitTestCase {
function setUp() {
//$this->Aro =& new Aro();
}
class AclNodeTest extends CakeTestCase {
var $fixtures = array( 'core.aro', 'core.aco', 'core.aros_aco', 'core.aco_action' );
function testNodeNesting() {
return;
$this->Aro =& new AroTest();
$this->Aro->create(1, null, 'Food');
$this->Aro->create(2, null, 'Fruit');
$this->Aro->create(3, null, 'Red');

View file

@ -0,0 +1,50 @@
<?php
/* SVN FILE: $Id: aco_action_fixture.php 4668 2007-03-23 22:11:06Z phpnut $ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2007, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.fixtures
* @since CakePHP(tm) v 1.2.0.4667
* @version $Revision: 4668 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2007-03-23 19:11:06 -0300 (Vie, 23 Mar 2007) $
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.fixtures
*/
class AcoActionFixture extends CakeTestFixture {
var $name = 'AcoAction';
var $fields = array(
'id' => array('type' => 'integer', 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'length' => 10, 'null' => true),
'model' => array('type' => 'string', 'default' => ''),
'foreign_key' => array('type' => 'integer', 'length' => 10, 'null' => true),
'alias' => array('type' => 'string', 'default' => ''),
'lft' => array('type' => 'integer', 'length' => 10, 'null' => true),
'rght' => array('type' => 'integer', 'length' => 10, 'null' => true)
);
var $records = array(
);
}
?>

50
cake/tests/fixtures/aco_fixture.php vendored Normal file
View file

@ -0,0 +1,50 @@
<?php
/* SVN FILE: $Id: aco_fixture.php 4668 2007-03-23 22:11:06Z phpnut $ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2007, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.fixtures
* @since CakePHP(tm) v 1.2.0.4667
* @version $Revision: 4668 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2007-03-23 19:11:06 -0300 (Vie, 23 Mar 2007) $
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.fixtures
*/
class AcoFixture extends CakeTestFixture {
var $name = 'Aco';
var $fields = array(
'id' => array('type' => 'integer', 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'length' => 10, 'null' => true),
'model' => array('type' => 'string', 'default' => ''),
'foreign_key' => array('type' => 'integer', 'length' => 10, 'null' => true),
'alias' => array('type' => 'string', 'default' => ''),
'lft' => array('type' => 'integer', 'length' => 10, 'null' => true),
'rght' => array('type' => 'integer', 'length' => 10, 'null' => true)
);
var $records = array(
);
}
?>

50
cake/tests/fixtures/aro_fixture.php vendored Normal file
View file

@ -0,0 +1,50 @@
<?php
/* SVN FILE: $Id: aro_fixture.php 4668 2007-03-23 22:11:06Z phpnut $ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2007, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.fixtures
* @since CakePHP(tm) v 1.2.0.4667
* @version $Revision: 4668 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2007-03-23 19:11:06 -0300 (Vie, 23 Mar 2007) $
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.fixtures
*/
class AroFixture extends CakeTestFixture {
var $name = 'Aro';
var $fields = array(
'id' => array('type' => 'integer', 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'length' => 10, 'null' => true),
'model' => array('type' => 'string', 'default' => ''),
'foreign_key' => array('type' => 'integer', 'length' => 10, 'null' => true),
'alias' => array('type' => 'string', 'default' => ''),
'lft' => array('type' => 'integer', 'length' => 10, 'null' => true),
'rght' => array('type' => 'integer', 'length' => 10, 'null' => true)
);
var $records = array(
);
}
?>

View file

@ -0,0 +1,50 @@
<?php
/* SVN FILE: $Id: aros_aco_fixture.php 4668 2007-03-23 22:11:06Z phpnut $ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2007, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.fixtures
* @since CakePHP(tm) v 1.2.0.4667
* @version $Revision: 4668 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2007-03-23 19:11:06 -0300 (Vie, 23 Mar 2007) $
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.fixtures
*/
class ArosAcoFixture extends CakeTestFixture {
var $name = 'ArosAco';
var $fields = array(
'id' => array('type' => 'integer', 'key' => 'primary'),
'aro_id' => array('type' => 'integer', 'length' => 10, 'null' => false),
'aco_id' => array('type' => 'integer', 'length' => 10, 'null' => false),
'_create' => array('type' => 'string', 'length' => 2, 'null' => false, 'default' => '0'),
'_read' => array('type' => 'string', 'length' => 2, 'null' => false, 'default' => '0'),
'_update' => array('type' => 'string', 'length' => 2, 'null' => false, 'default' => '0'),
'_delete' => array('type' => 'string', 'length' => 2, 'null' => false, 'default' => '0')
);
var $records = array(
);
}
?>