From 6dc742d67582e3e7688fbe90900b11c4dce022c2 Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 13 Jan 2008 04:23:19 +0000 Subject: [PATCH] Adding ACL test setup to Auth test case git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6375 3807eeeb-6ff5-0310-8944-8be069107fe0 --- .../libs/controller/components/auth.test.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index 5fbe6d831..5fd469ec2 100644 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -107,14 +107,31 @@ class AuthTest extends CakeTestCase { var $fixtures = array('core.auth_user', 'core.aro', 'core.aco', 'core.aros_aco', 'core.aco_action'); + var $initialized = false; + function startTest() { + if (!$this->initialized) { + Configure::write('Acl.database', 'test_suite'); + if (isset($this->fixtures) && (!is_array($this->fixtures) || empty($this->fixtures))) { + unset($this->fixtures); + } + + // Create records + if (isset($this->_fixtures) && isset($this->db)) { + foreach ($this->_fixtures as $fixture) { + $fixture->insert($this->db); + } + } + } + $this->Controller =& new AuthTestController(); restore_error_handler(); - @$this->Controller->_initComponents(); + $this->Controller->_initComponents(); set_error_handler('simpleTestErrorHandler'); ClassRegistry::addObject('view', new View($this->Controller)); $this->Controller->Session->del('Auth'); $this->Controller->Session->del('Message.auth'); + $this->initialized = true; } function testNoAuth() {