From 76da85a1a08cdf065bf186c81ea444d03d6f8935 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 19 Jan 2010 22:38:19 -0800 Subject: Extend Gallery_Unit_Test_Case instead of Unit_Test_Case. --- modules/user/tests/No_Direct_ORM_Access_Test.php | 2 +- modules/user/tests/User_Groups_Test.php | 2 +- modules/user/tests/User_Installer_Test.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/user/tests') diff --git a/modules/user/tests/No_Direct_ORM_Access_Test.php b/modules/user/tests/No_Direct_ORM_Access_Test.php index 440321fa..c372258e 100644 --- a/modules/user/tests/No_Direct_ORM_Access_Test.php +++ b/modules/user/tests/No_Direct_ORM_Access_Test.php @@ -19,7 +19,7 @@ */ require_once(MODPATH . "gallery/tests/Gallery_Filters.php"); -class No_Direct_ORM_Access_Test extends Unit_Test_Case { +class No_Direct_ORM_Access_Test extends Gallery_Unit_Test_Case { public function no_access_to_users_table_test() { $dir = new UserModuleFilterIterator( new PhpCodeFilterIterator( diff --git a/modules/user/tests/User_Groups_Test.php b/modules/user/tests/User_Groups_Test.php index 163b7d79..089ab9a6 100644 --- a/modules/user/tests/User_Groups_Test.php +++ b/modules/user/tests/User_Groups_Test.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class User_Groups_Test extends Unit_Test_Case { +class User_Groups_Test extends Gallery_Unit_Test_Case { public function teardown() { try { $group = ORM::factory("group")->where("name", "=", "user_groups_test")->find(); diff --git a/modules/user/tests/User_Installer_Test.php b/modules/user/tests/User_Installer_Test.php index 12a10eda..b3c5960a 100644 --- a/modules/user/tests/User_Installer_Test.php +++ b/modules/user/tests/User_Installer_Test.php @@ -22,7 +22,7 @@ * This test case operates under the assumption that user_installer::install() is called by the * test controller before it starts. */ -class User_Installer_Test extends Unit_Test_Case { +class User_Installer_Test extends Gallery_Unit_Test_Case { public function install_creates_admin_user_test() { $user = ORM::factory("user", 1); $this->assert_equal("guest", $user->name); -- cgit v1.2.3 From 2f9077e26a0d36ac5805db87069827979d965c5f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 21 Jan 2010 19:08:40 -0800 Subject: Simplify the test using the test helper. --- modules/user/tests/User_Groups_Test.php | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'modules/user/tests') diff --git a/modules/user/tests/User_Groups_Test.php b/modules/user/tests/User_Groups_Test.php index 089ab9a6..d0026d89 100644 --- a/modules/user/tests/User_Groups_Test.php +++ b/modules/user/tests/User_Groups_Test.php @@ -19,32 +19,9 @@ */ class User_Groups_Test extends Gallery_Unit_Test_Case { - public function teardown() { - try { - $group = ORM::factory("group")->where("name", "=", "user_groups_test")->find(); - if ($group->loaded()) { - $group->delete(); - } - } catch (Exception $e) { } - - try { - $user = ORM::factory("user")->where("name", "=", "user_groups_test")->find(); - if ($user->loaded()) { - $user->delete(); - } - } catch (Exception $e) { } - } - public function add_user_to_group_test() { - $user = ORM::factory("user"); - $user->name = "user_groups_test"; - $user->full_name = "user groups test"; - $user->password = "test password"; - $user->save(); - - $group = ORM::factory("group"); - $group->name = "user_groups_test"; - $group->save(); + $user = test::random_user(); + $group = test::random_group(); $group->add($user); $group->save(); -- cgit v1.2.3