From 134bac46d07a4d027ef350c69a6cc8f787bfa6e9 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 5 Nov 2008 22:10:35 +0000 Subject: add installation unit tests and corrected a problem where the groups_users pivot table was not populated. --- modules/user/tests/User_Installer_Test.php | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 modules/user/tests/User_Installer_Test.php (limited to 'modules/user/tests') diff --git a/modules/user/tests/User_Installer_Test.php b/modules/user/tests/User_Installer_Test.php new file mode 100644 index 00000000..2acfcaeb --- /dev/null +++ b/modules/user/tests/User_Installer_Test.php @@ -0,0 +1,55 @@ +find(1); + $this->assert_equal("Gallery Administrator", $user->display_name); + $this->assert_equal("admin", $user->name); + + $groups = $user->groups->as_array(); + $this->assert_equal(2, count($groups)); + $this->assert_equal("administrator", $groups[0]->name); + + $this->assert_equal("registered", $groups[1]->name); + } + + public function install_creates_admininstrator_group_test() { + $group = ORM::factory('group')->find(1); + $this->assert_equal("administrator", $group->name); + + $users = $group->users->as_array(); + $this->assert_equal(1, count($users)); + $this->assert_equal("admin", $users[0]->name); + } + + public function install_creates_registered_group_test() { + $group = ORM::factory('group')->find(2); + $this->assert_equal("registered", $group->name); + + $users = $group->users->as_array(); + $this->assert_equal(1, count($users)); + $this->assert_equal("admin", $users[0]->name); + } +} -- cgit v1.2.3