~ubuntu-branches/ubuntu/hardy/gallery2/hardy-security

« back to all changes in this revision

Viewing changes to modules/core/test/phpunit/AdminEditGroupUsersControllerTest.class

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2006-04-16 16:42:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060416164235-8uy0u4bfjdxpge2o
Tags: 2.1.1-1
* New upstream release (Closes: #362936)
  + Bugfixes for Postgres7 (Closes: #359000, #362152)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * $RCSfile: AdminEditGroupUsersControllerTest.class,v $
4
4
 *
5
5
 * Gallery - a web based photo album viewer and editor
6
 
 * Copyright (C) 2000-2005 Bharat Mediratta
 
6
 * Copyright (C) 2000-2006 Bharat Mediratta
7
7
 *
8
8
 * This program is free software; you can redistribute it and/or modify
9
9
 * it under the terms of the GNU General Public License as published by
20
20
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
21
21
 */
22
22
/**
23
 
 * @version $Revision: 1.21 $ $Date: 2005/08/23 03:49:33 $
 
23
 * @version $Revision: 1.22 $ $Date: 2006/01/10 04:39:36 $
24
24
 * @package GalleryCore
25
25
 * @subpackage PHPUnit
26
26
 * @author Bharat Mediratta <bharat@menalto.com>
42
42
 
43
43
        /* Create a test group */
44
44
        list ($ret, $this->_group) = $this->_createRandomGroup();
45
 
        if ($ret->isError()) {
 
45
        if ($ret) {
46
46
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
47
47
        }
48
48
        $this->_markForCleanup($this->_group);
49
49
 
50
50
        /* Create a test user */
51
51
        list ($ret, $this->_user) = $this->_createRandomUser();
52
 
        if ($ret->isError()) {
 
52
        if ($ret) {
53
53
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
54
54
        }
55
55
        $this->_markForCleanup($this->_user);
70
70
    function testRemoveUser() {
71
71
        /* Add the user to the group */
72
72
        $ret = GalleryCoreApi::addUserToGroup($this->_user->getId(), $this->_group->getId());
73
 
        if ($ret->isError()) {
 
73
        if ($ret) {
74
74
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
75
75
        }
76
76
 
93
93
    function testRemoveMultipleUser() {
94
94
        /* Create a second user */
95
95
        list ($ret, $newUser) = $this->_createRandomUser();
96
 
        if ($ret->isError()) {
 
96
        if ($ret) {
97
97
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
98
98
        }
99
99
 
100
100
        /* Add the users to the group */
101
101
        $ret = GalleryCoreApi::addUserToGroup($this->_user->getId(), $this->_group->getId());
102
 
        if ($ret->isError()) {
 
102
        if ($ret) {
103
103
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
104
104
        }
105
105
        $ret = GalleryCoreApi::addUserToGroup($newUser->getId(), $this->_group->getId());
106
 
        if ($ret->isError()) {
 
106
        if ($ret) {
107
107
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
108
108
        }
109
109
 
124
124
 
125
125
        /* Delete it */
126
126
        $ret = $this->_deleteAndVerifyEntity($newUser->getId());
127
 
        if ($ret->isError()) {
 
127
        if ($ret) {
128
128
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
129
129
        }
130
130
    }
133
133
        global $gallery;
134
134
        list ($ret, $adminGroupId) =
135
135
            GalleryCoreApi::getPluginParameter('module', 'core', 'id.adminGroup');
136
 
        if ($ret->isError()) {
 
136
        if ($ret) {
137
137
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
138
138
        }
139
139
 
140
140
        /* Add the user to the site admin group */
141
141
        $ret = GalleryCoreApi::addUserToGroup($this->_user->getId(), $adminGroupId);
142
 
        if ($ret->isError()) {
 
142
        if ($ret) {
143
143
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
144
144
        }
145
145
 
161
161
 
162
162
        list ($ret, $inGroup) =
163
163
            GalleryCoreApi::isUserInGroup($this->_user->getId(), $adminGroupId);
164
 
        if ($ret->isError()) {
 
164
        if ($ret) {
165
165
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
166
166
        }
167
167
 
213
213
 
214
214
    function testAddDuplicateUser() {
215
215
        $ret = GalleryCoreApi::addUserToGroup($this->_user->getId(), $this->_group->getId());
216
 
        if ($ret->isError()) {
 
216
        if ($ret) {
217
217
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
218
218
        }
219
219