3
* Gallery - a web based photo album viewer and editor
4
* Copyright (C) 2000-2007 Bharat Mediratta
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or (at
9
* your option) any later version.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
22
* SquareThumbSiteAdmin controller tests
24
* @package SquareThumb
26
* @author Alan Harder <alan.harder@sun.com>
27
* @version $Revision: 15513 $
29
class SquareThumbSiteAdminControllerTest extends GalleryControllerTestCase {
31
function SquareThumbSiteAdminControllerTest($methodName) {
32
$this->GalleryControllerTestCase($methodName, 'squarethumb.SquareThumbSiteAdmin');
38
$ret = $this->_markPluginParametersForCleanup('module', 'squarethumb');
40
print $ret->getAsHtml();
41
return $this->failWithStatus($ret);
45
function testSquareThumbSiteAdminControllerReset() {
46
GalleryUtilities::putRequestVariable('form[action][reset]', '1');
48
$results = $this->handleRequest();
49
$this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
50
'subView' => 'squarethumb.SquareThumbSiteAdmin'),
56
function testSquareThumbSiteAdminControllerSave() {
57
GalleryUtilities::putRequestVariable('form[mode]', 'crop');
58
GalleryUtilities::putRequestVariable('form[color]', '159cE0');
59
GalleryUtilities::putRequestVariable('form[action][save]', '1');
61
$results = $this->handleRequest();
62
$this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
63
'subView' => 'squarethumb.SquareThumbSiteAdmin'),
64
'status' => array('saved' => 1),
69
function testSquareThumbSiteAdminControllerSaveNoColor() {
70
GalleryUtilities::putRequestVariable('form[mode]', 'crop');
71
GalleryUtilities::putRequestVariable('form[action][save]', '1');
73
$results = $this->handleRequest();
74
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
75
'subView' => 'squarethumb.SquareThumbSiteAdmin'),
77
'error' => array('form[error][color][missing]')),
81
function testSquareThumbSiteAdminControllerSaveBadColor() {
82
GalleryUtilities::putRequestVariable('form[mode]', 'fit');
83
GalleryUtilities::putRequestVariable('form[color]', '123Q45');
84
GalleryUtilities::putRequestVariable('form[action][save]', '1');
86
$results = $this->handleRequest();
87
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
88
'subView' => 'squarethumb.SquareThumbSiteAdmin'),
90
'error' => array('form[error][color][invalid]')),
93
GalleryUtilities::putRequestVariable('form[color]', '1234567');
95
$results = $this->handleRequest();
96
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
97
'subView' => 'squarethumb.SquareThumbSiteAdmin'),
99
'error' => array('form[error][color][invalid]')),