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
* CommentSiteAdmin controller tests
26
* @author Alan Harder <alan.harder@sun.com>
27
* @version $Revision: 15513 $
29
class CommentSiteAdminControllerTest extends GalleryControllerTestCase {
31
function CommentSiteAdminControllerTest($methodName) {
32
$this->GalleryControllerTestCase($methodName, 'comment.CommentSiteAdmin');
38
$ret = $this->_markPluginParametersForCleanup('module', 'comment');
40
print $ret->getAsHtml();
41
return $this->failWithStatus($ret);
45
function testCommentSiteAdminControllerReset() {
46
GalleryUtilities::putRequestVariable('form[action][reset]', '1');
48
$results = $this->handleRequest();
49
$this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
50
'subView' => 'comment.CommentSiteAdmin'),
56
function testCommentSiteAdminControllerSave() {
57
GalleryUtilities::putRequestVariable('form[latest]', 1);
58
GalleryUtilities::putRequestVariable('form[show]', '12');
59
GalleryUtilities::putRequestVariable('form[action][save]', '1');
61
$results = $this->handleRequest();
62
$this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
63
'subView' => 'comment.CommentSiteAdmin'),
64
'status' => array('saved' => 1),
68
foreach (array('latest' => '1', 'show' => '12') as $key => $expectedValue) {
70
GalleryCoreApi::getPluginParameter('module', 'comment', 'comments.' . $key);
72
return $this->failWithStatus($ret);
74
$this->assertEquals($expectedValue, $value, $key);
78
function testCommentSiteAdminControllerSaveNoShow() {
79
GalleryUtilities::putRequestVariable('form[action][save]', '1');
81
$results = $this->handleRequest();
82
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
83
'subView' => 'comment.CommentSiteAdmin'),
85
'error' => array('form[error][show]')),
89
function testCommentSiteAdminControllerSaveBadShow() {
90
GalleryUtilities::putRequestVariable('form[show]', 'abc5000');
91
GalleryUtilities::putRequestVariable('form[action][save]', '1');
93
$results = $this->handleRequest();
94
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
95
'subView' => 'comment.CommentSiteAdmin'),
97
'error' => array('form[error][show]')),