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
* WebCamSiteAdmin controller tests
26
* @author Alan Harder <alan.harder@sun.com>
27
* @version $Revision: 15513 $
29
class WebCamSiteAdminControllerTest extends GalleryControllerTestCase {
31
function WebCamSiteAdminControllerTest($methodName) {
32
$this->GalleryControllerTestCase($methodName, 'webcam.WebCamSiteAdmin');
38
$ret = $this->_markPluginParametersForCleanup('module', 'webcam');
40
print $ret->getAsHtml();
41
return $this->failWithStatus($ret);
45
function testWebCamSiteAdminControllerUndo() {
46
GalleryUtilities::putRequestVariable('form[action][reset]', '1');
48
$results = $this->handleRequest();
49
$this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
50
'subView' => 'webcam.WebCamSiteAdmin'),
56
function testWebCamSiteAdminControllerSave() {
57
GalleryUtilities::putRequestVariable('form[duration]', '123.4');
58
GalleryUtilities::putRequestVariable('form[action][save]', '1');
60
$results = $this->handleRequest();
61
$this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
62
'subView' => 'webcam.WebCamSiteAdmin'),
63
'status' => array('saved' => 1),
67
list ($ret, $duration) =
68
GalleryCoreApi::getPluginParameter('module', 'webcam', 'duration');
70
return $this->failWithStatus($ret);
72
$this->assertEquals('7404', $duration, 'duration');
75
function testWebCamSiteAdminControllerSaveNoDuration() {
76
GalleryUtilities::putRequestVariable('form[action][save]', '1');
78
$results = $this->handleRequest();
79
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
80
'subView' => 'webcam.WebCamSiteAdmin'),
82
'error' => array('form[error][duration]')),
86
function testWebCamSiteAdminControllerSaveBadDuration() {
87
GalleryUtilities::putRequestVariable('form[duration]', 'abc');
88
GalleryUtilities::putRequestVariable('form[action][save]', '1');
90
$results = $this->handleRequest();
91
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
92
'subView' => 'webcam.WebCamSiteAdmin'),
94
'error' => array('form[error][duration]')),
98
function testWebCamSiteAdminControllerLocale() {
99
/* Verify the form can accept input in locales that use comma for the fraction separator */
100
GalleryUtilities::putRequestVariable('form[duration]', '123,4');
101
GalleryUtilities::putRequestVariable('form[action][save]', '1');
103
$results = $this->handleRequest();
104
$this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
105
'subView' => 'webcam.WebCamSiteAdmin'),
106
'status' => array('saved' => 1),
110
list ($ret, $duration) =
111
GalleryCoreApi::getPluginParameter('module', 'webcam', 'duration');
113
return $this->failWithStatus($ret);
115
$this->assertEquals('7404', $duration, 'duration');