diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-02 14:31:59 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-01-02 14:31:59 -0800 |
commit | 28597ba53354537704899e7ad9eb39bbd5718b21 (patch) | |
tree | 45de0d70d0b80e98bdab62de5b05d5d66bc4bc5f /modules/tag/tests | |
parent | bff7b393ec763c50f9fe66fef16150bcaa55dac3 (diff) |
Correct file structure tests, Have the tests delete the userid they create so as not to impact other tests.
Diffstat (limited to 'modules/tag/tests')
-rw-r--r-- | modules/tag/tests/Tag_Rest_Helper_Test.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/modules/tag/tests/Tag_Rest_Helper_Test.php b/modules/tag/tests/Tag_Rest_Helper_Test.php index ac64470c..055e5cec 100644 --- a/modules/tag/tests/Tag_Rest_Helper_Test.php +++ b/modules/tag/tests/Tag_Rest_Helper_Test.php @@ -31,18 +31,24 @@ class Tag_Rest_Helper_Test extends Unit_Test_Case { Database::instance()->query("TRUNCATE {tags}"); Database::instance()->query("TRUNCATE {items_tags}"); + if (!empty($this->_user)) { + $this->_user->delete(); + } } catch (Exception $e) { } } private function _create_user() { - $user = identity::create_user("access_test" . rand(), "Access Test", "password"); - $key = ORM::factory("user_access_token"); - $key->access_key = md5($user->name . rand()); - $key->user_id = $user->id; - $key->save(); - identity::set_active_user($user); - return $user; + if (empty($this->_user)) { + $this->_user = identity::create_user("access_test" . rand(), "Access Test", "password"); + $key = ORM::factory("user_access_token"); + $key->access_key = md5($this->_user->name . rand()); + $key->user_id = $this->_user->id; + $key->save(); + identity::set_active_user($this->_user); + } + return $this->_user; } + private function _create_album($tags=array(), $parent=null) { $album_name = "album_" . rand(); if (empty($parent)) { |