updating auth and db_acl test

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5553 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-08-20 02:18:27 +00:00
parent eeeee7b49b
commit 6c1a81eeb8
2 changed files with 104 additions and 65 deletions

View file

@ -36,8 +36,10 @@ uses('controller'.DS.'components'.DS.'acl', 'model'.DS.'db_acl');
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
class AclNodeTestBase extends AclNode {
var $useDbConfig = 'test_suite';
if(!class_exists('aclnodetestbase')) {
class AclNodeTestBase extends AclNode {
var $useDbConfig = 'test_suite';
}
}
/**
@ -46,10 +48,12 @@ class AclNodeTestBase extends AclNode {
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
class AroTest extends AclNodeTestBase {
var $name = 'AroTest';
var $useTable = 'aros';
var $hasAndBelongsToMany = array('AcoTest' => array('with' => 'PermissionTest'));
if(!class_exists('arotest')) {
class AroTest extends AclNodeTestBase {
var $name = 'AroTest';
var $useTable = 'aros';
var $hasAndBelongsToMany = array('AcoTest' => array('with' => 'PermissionTest'));
}
}
/**
@ -58,10 +62,12 @@ class AroTest extends AclNodeTestBase {
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
class AcoTest extends AclNodeTestBase {
var $name = 'AcoTest';
var $useTable = 'acos';
var $hasAndBelongsToMany = array('AroTest' => array('with' => 'PermissionTest'));
if(!class_exists('acotest')) {
class AcoTest extends AclNodeTestBase {
var $name = 'AcoTest';
var $useTable = 'acos';
var $hasAndBelongsToMany = array('AroTest' => array('with' => 'PermissionTest'));
}
}
/**
@ -70,26 +76,16 @@ class AcoTest extends AclNodeTestBase {
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
class PermissionTest extends CakeTestModel {
var $name = 'PermissionTest';
var $useTable = 'aros_acos';
var $cacheQueries = false;
var $belongsTo = array('AroTest' => array('foreignKey' => 'aro_id'),
'AcoTest' => array('foreignKey' => 'aco_id')
);
var $actsAs = null;
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
class AcoActionTest extends CakeTestModel {
var $name = 'AcoActionTest';
var $useTable = 'aco_actions';
var $belongsTo = array('AcoTest' => array('foreignKey' => 'aco_id'));
if(!class_exists('permissiontest')) {
class PermissionTest extends CakeTestModel {
var $name = 'PermissionTest';
var $useTable = 'aros_acos';
var $cacheQueries = false;
var $belongsTo = array('AroTest' => array('foreignKey' => 'aro_id'),
'AcoTest' => array('foreignKey' => 'aco_id')
);
var $actsAs = null;
}
}
/**
* Short description for class.
@ -97,13 +93,28 @@ class AcoActionTest extends CakeTestModel {
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
class DB_ACL_TEST extends DB_ACL {
if(!class_exists('acoactiontest')) {
class AcoActionTest extends CakeTestModel {
var $name = 'AcoActionTest';
var $useTable = 'aco_actions';
var $belongsTo = array('AcoTest' => array('foreignKey' => 'aco_id'));
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
if(!class_exists('db_acl_test')) {
class DB_ACL_TEST extends DB_ACL {
function __construct() {
$this->Aro =& new AroTest();
$this->Aro->Permission =& new PermissionTest();
$this->Aco =& new AcoTest();
$this->Aro->Permission =& new PermissionTest();
function __construct() {
$this->Aro =& new AroTest();
$this->Aro->Permission =& new PermissionTest();
$this->Aco =& new AcoTest();
$this->Aro->Permission =& new PermissionTest();
}
}
}
/**

View file

@ -33,65 +33,92 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
uses('controller'.DS.'components'.DS.'acl', 'model'.DS.'db_acl');
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
if(!class_exists('aclnodetestbase')) {
class AclNodeTestBase extends AclNode {
var $useDbConfig = 'test_suite';
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
if(!class_exists('arotest')) {
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
*/
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
if(!class_exists('acotest')) {
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
*/
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
if(!class_exists('permissiontest')) {
class PermissionTest extends CakeTestModel {
var $name = 'PermissionTest';
var $useTable = 'aros_acos';
var $cacheQueries = false;
var $belongsTo = 'AroTest,AcoTest';
var $belongsTo = array('AroTest' => array('foreignKey' => 'aro_id'),
'AcoTest' => array('foreignKey' => 'aco_id')
);
var $actsAs = null;
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
if(!class_exists('acoactiontest')) {
class AcoActionTest extends CakeTestModel {
var $name = 'AcoActionTest';
var $useTable = 'aco_actions';
var $belongsTo = 'AcoTest';
var $belongsTo = array('AcoTest' => array('foreignKey' => 'aco_id'));
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
if(!class_exists('db_acl_test')) {
class DB_ACL_TEST extends DB_ACL {
function __construct() {
$this->Aro =& new AroTest();
$this->Aro->Permission =& new PermissionTest();
$this->Aco =& new AcoTest();
$this->Aro->Permission =& new PermissionTest();
}
}
}
/**
* Short description for class.
*
@ -99,10 +126,11 @@ uses('controller'.DS.'components'.DS.'acl', 'model'.DS.'db_acl');
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
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 testNodeNesting() {
}
}
?>