3
* $RCSfile: RatingSiteAdminControllerTest.class,v $
5
* Gallery - a web based photo album viewer and editor
6
* Copyright (C) 2000-2006 Bharat Mediratta
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or (at
11
* your option) any later version.
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
23
* @version $Revision: 1.2 $ $Date: 2006/01/10 04:41:54 $
26
* @author Don Seiler <don@seiler.us>
30
* RatingSiteAdmin controller tests
35
class RatingSiteAdminControllerTest extends GalleryControllerTestCase {
37
function RatingSiteAdminControllerTest($methodName) {
38
$this->GalleryControllerTestCase($methodName, 'rating.RatingSiteAdmin');
44
$ret = $this->_markPluginParametersForCleanup('module', 'rating');
46
print $ret->getAsHtml();
47
return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
51
function testEnableAlbumRatings() {
52
GalleryUtilities::putRequestVariable('form[action][save]', 'Save');
53
GalleryUtilities::putRequestVariable('form[allowAlbumRating]', 'on');
54
$results = $this->handleRequest();
55
$this->assertEquals(array(
57
'view' => 'core.SiteAdmin', 'subView' => 'rating.RatingSiteAdmin'),
58
'status' => array('saved' => 1),
62
list ($ret, $allowAlbumRating) = GalleryCoreApi::getPluginParameter('module', 'rating',
65
return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
67
$this->assertEquals(1, (int)$allowAlbumRating);
70
function testDisableAlbumRatings() {
71
GalleryUtilities::putRequestVariable('form[action][save]', 'Save');
72
$results = $this->handleRequest();
73
$this->assertEquals(array(
75
'view' => 'core.SiteAdmin', 'subView' => 'rating.RatingSiteAdmin'),
76
'status' => array('saved' => 1),
80
list ($ret, $allowAlbumRating) = GalleryCoreApi::getPluginParameter('module', 'rating',
83
return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
85
$this->assertEquals(0, (int)$allowAlbumRating);
88
function testReset() {
89
GalleryUtilities::putRequestVariable('form[action][reset]', 'Reset');
90
$results = $this->handleRequest();
91
$this->assertEquals(array(
93
'view' => 'core.SiteAdmin', 'subView' => 'rating.RatingSiteAdmin'),