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

« back to all changes in this revision

Viewing changes to modules/core/test/phpunit/ItemCreateLinkSingleControllerTest.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: ItemCreateLinkSingleControllerTest.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.8 $ $Date: 2005/08/23 03:49:33 $
 
23
 * @version $Revision: 1.10 $ $Date: 2006/01/13 03:39:32 $
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->_rootAlbum) = $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
        }
49
49
        $this->_markForCleanup($this->_rootAlbum);
50
50
 
51
51
        list ($ret, $this->_destinationAlbum) = $this->_createRandomAlbum($this->_getRootId());
52
 
        if ($ret->isError()) {
 
52
        if ($ret) {
53
53
            print $ret->getAsHtml();
54
54
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
55
55
        }
58
58
 
59
59
        /* Create a data item */
60
60
        list ($ret, $this->_item) = $this->_createRandomDataItem($this->_rootAlbum->getId());
61
 
        if ($ret->isError()) {
 
61
        if ($ret) {
62
62
            print $ret->getAsHtml();
63
63
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
64
64
        }
71
71
        global $gallery;
72
72
        GalleryUtilities::putRequestVariable('itemId', $this->_item->getId());
73
73
        GalleryUtilities::putRequestVariable('form[action][link]', 1);
74
 
        GalleryUtilities::putRequestVariable('form[destination]', $this->_destinationAlbum->getId());
 
74
        GalleryUtilities::putRequestVariable('form[destination]',
 
75
                                             $this->_destinationAlbum->getId());
75
76
 
76
77
        $results = $this->handleRequest();
77
78
        $this->assertEquals(array('redirect' => array('view' => 'core.ItemAdmin',
89
90
        global $gallery;
90
91
        GalleryUtilities::putRequestVariable('itemId', $this->_rootAlbum->getId());
91
92
        GalleryUtilities::putRequestVariable('form[action][link]', 1);
92
 
        GalleryUtilities::putRequestVariable('form[destination]', $this->_destinationAlbum->getId());
 
93
        GalleryUtilities::putRequestVariable('form[destination]',
 
94
                                             $this->_destinationAlbum->getId());
93
95
 
94
96
        $results = $this->handleRequest(ERROR_PERMISSION_DENIED);
95
97
    }
99
101
     */
100
102
    function testLinkItemWithNoViewPermissions() {
101
103
        $ret = GalleryCoreApi::removeItemPermissions($this->_item->getId());
102
 
        if ($ret->isError()) {
 
104
        if ($ret) {
103
105
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
104
106
        }
105
107
 
106
108
        global $gallery;
107
109
        GalleryUtilities::putRequestVariable('itemId', $this->_item->getId());
108
110
        GalleryUtilities::putRequestVariable('form[action][link]', 1);
109
 
        GalleryUtilities::putRequestVariable('form[destination]', $this->_destinationAlbum->getId());
 
111
        GalleryUtilities::putRequestVariable('form[destination]',
 
112
                                             $this->_destinationAlbum->getId());
110
113
 
111
114
        $results = $this->handleRequest(ERROR_PERMISSION_DENIED);
112
115
    }
134
137
        global $gallery;
135
138
        GalleryUtilities::putRequestVariable('itemId', $this->_item->getId());
136
139
        GalleryUtilities::putRequestVariable('form[action][link]', 1);
137
 
        GalleryUtilities::putRequestVariable('form[destination]', $this->_destinationAlbum->getId());
 
140
        GalleryUtilities::putRequestVariable('form[destination]',
 
141
                                             $this->_destinationAlbum->getId());
138
142
 
139
143
        $ret = GalleryCoreApi::removeItemPermissions($this->_destinationAlbum->getId());
140
 
        if ($ret->isError()) {
 
144
        if ($ret) {
141
145
            return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
142
146
        }
143
147