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

« back to all changes in this revision

Viewing changes to modules/core/test/phpunit/ItemAddAlbumControllerTest.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: ItemAddAlbumControllerTest.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>
41
41
        parent::setUp();
42
42
 
43
43
        list ($ret, $this->_parentAlbum) = $this->_createRandomAlbum($this->_getRootId());
44
 
        if ($ret->isError()) {
 
44
        if ($ret) {
45
45
            print $ret->getAsHtml();
46
46
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
47
47
        }
60
60
        GalleryUtilities::putRequestVariable('form[description]', 'description');
61
61
 
62
62
        list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core');
63
 
        if ($ret->isError()) {
 
63
        if ($ret) {
64
64
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
65
65
        }
66
66
 
79
79
    function testAddDuplicateAlbum() {
80
80
        /* Create an album */
81
81
        list ($ret, $subAlbum) = $this->_createRandomAlbum($this->_parentAlbum->getId());
82
 
        if ($ret->isError()) {
 
82
        if ($ret) {
83
83
            $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
84
84
        }
85
85
 
96
96
        GalleryUtilities::putRequestVariable('form[pathComponent]', $subAlbum->getPathComponent());
97
97
 
98
98
        list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core');
99
 
        if ($ret->isError()) {
 
99
        if ($ret) {
100
100
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
101
101
        }
102
102
 
112
112
                            $results);
113
113
 
114
114
        list ($ret, $newAlbum) = GalleryCoreApi::loadEntitiesById($this->_getSecondChildId());
115
 
        if ($ret->isError()) {
 
115
        if ($ret) {
116
116
            $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
117
117
        }
118
118
 
160
160
 
161
161
    function testAddAlbumWithSpaces() {
162
162
        global $gallery;
163
 
        $platform = $gallery->getPlatform();
 
163
        $platform =& $gallery->getPlatform();
164
164
 
165
165
        $name = ' testalbum-' . rand() . ' ';
166
166
        GalleryUtilities::putRequestVariable('itemId', $this->_parentAlbum->getId());
172
172
        GalleryUtilities::putRequestVariable('form[description]', 'description');
173
173
 
174
174
        list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core');
175
 
        if ($ret->isError()) {
 
175
        if ($ret) {
176
176
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
177
177
        }
178
178
 
188
188
                            $results);
189
189
 
190
190
        list ($ret, $newAlbum) = GalleryCoreApi::loadEntitiesById($id);
191
 
        if ($ret->isError()) {
 
191
        if ($ret) {
192
192
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
193
193
        }
194
194
        $this->assertEquals(trim($name), $newAlbum->getPathComponent(), 'path component');
195
195
 
196
196
        list ($ret, $path) = $newAlbum->fetchPath();
197
 
        if ($ret->isError()) {
 
197
        if ($ret) {
198
198
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
199
199
        }
200
200
        $this->assert($platform->is_dir($path), "directory '$path'");