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

« back to all changes in this revision

Viewing changes to modules/core/test/phpunit/AdminUsersControllerTest.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: AdminUsersControllerTest.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.17 $ $Date: 2005/08/23 03:49:33 $
 
23
 * @version $Revision: 1.18 $ $Date: 2006/01/10 04:39:36 $
24
24
 * @package GalleryCore
25
25
 * @subpackage PHPUnit
26
26
 * @author Bharat Mediratta <bharat@menalto.com>
60
60
    function testEditFromText() {
61
61
        /* Normal */
62
62
        list ($ret, $user) = $this->_createUser();
63
 
        if ($ret->isError()) {
 
63
        if ($ret) {
64
64
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
65
65
        }
66
66
        $this->_markForCleanup($user);
103
103
    function testDeleteFromText() {
104
104
        /* Normal */
105
105
        list ($ret, $user) = $this->_createUser();
106
 
        if ($ret->isError()) {
 
106
        if ($ret) {
107
107
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
108
108
        }
109
109
        $this->_markForCleanup($user);
148
148
 
149
149
        list ($ret, $anonymousUserId) =
150
150
            GalleryCoreApi::getPluginParameter('module', 'core', 'id.anonymousUser');
151
 
        if ($ret->isError()) {
 
151
        if ($ret) {
152
152
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
153
153
        }
154
154
 
155
155
        list ($ret, $anonymousUser) = GalleryCoreApi::loadEntitiesById($anonymousUserId);
156
 
        if ($ret->isError()) {
 
156
        if ($ret) {
157
157
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
158
158
        }
159
159
 
188
188
        global $gallery;
189
189
 
190
190
        list ($ret, $user) = GalleryCoreApi::newFactoryInstance('GalleryEntity', 'GalleryUser');
191
 
        if ($ret->isError()) {
 
191
        if ($ret) {
192
192
            return array($ret->wrap(__FILE__, __LINE__), null);
193
193
        }
194
194
 
195
195
        if (!isset($user)) {
196
 
            return array(GalleryStatus::error(ERROR_MISSING_OBJECT, __FILE__, __LINE__),
 
196
            return array(GalleryCoreApi::error(ERROR_MISSING_OBJECT, __FILE__, __LINE__),
197
197
                         null);
198
198
        }
199
199
 
200
200
        $ret = $user->create('testuser-'.rand());
201
 
        if ($ret->isError()) {
 
201
        if ($ret) {
202
202
            return array($ret->wrap(__FILE__, __LINE__), null);
203
203
        }
204
204
        $ret = $user->save();
205
 
        if ($ret->isError()) {
 
205
        if ($ret) {
206
206
            return array($ret->wrap(__FILE__, __LINE__), null);
207
207
        }
208
 
        return array(GalleryStatus::success(), $user);
 
208
        return array(null, $user);
209
209
    }
210
210
}
211
211
?>