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