~ubuntu-branches/ubuntu/quantal/gallery2/quantal

« back to all changes in this revision

Viewing changes to modules/albumselect/test/phpunit/AlbumSelectSiteAdminControllerTest.class

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2007-09-10 20:22:19 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070910202219-0jsuntvqge4ade6b
Tags: 2.2.3-2
Add Slovak translation of Debconf templates.  (Thanks to 
Ivan Masá.  Closes: #441671)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/*
3
 
 * Gallery - a web based photo album viewer and editor
4
 
 * Copyright (C) 2000-2007 Bharat Mediratta
5
 
 *
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.
10
 
 *
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.
15
 
 *
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.
19
 
 */
20
 
 
21
 
/**
22
 
 * AlbumSelectSiteAdmin controller tests
23
 
 *
24
 
 * @package AlbumSelect
25
 
 * @subpackage PHPUnit
26
 
 * @author Alan Harder <alan.harder@sun.com>
27
 
 * @version $Revision: 15513 $
28
 
 */
29
 
class AlbumSelectSiteAdminControllerTest extends GalleryControllerTestCase {
30
 
 
31
 
    function AlbumSelectSiteAdminControllerTest($methodName) {
32
 
        $this->GalleryControllerTestCase($methodName, 'albumselect.AlbumSelectSiteAdmin');
33
 
    }
34
 
 
35
 
    function setUp() {
36
 
        parent::setUp();
37
 
 
38
 
        $ret = $this->_markPluginParametersForCleanup('module', 'albumselect');
39
 
        if ($ret) {
40
 
            print $ret->getAsHtml();
41
 
            return $ret;
42
 
        }
43
 
    }
44
 
 
45
 
    function testAlbumSelectSiteAdminControllerReset() {
46
 
        GalleryUtilities::putRequestVariable('form[action][reset]', '1');
47
 
 
48
 
        $results = $this->handleRequest();
49
 
        $this->assertEquals(array('redirect' => array(
50
 
                                      'view' => 'core.SiteAdmin',
51
 
                                      'subView' => 'albumselect.AlbumSelectSiteAdmin'),
52
 
                                  'status' => array(),
53
 
                                  'error' => array()),
54
 
                            $results);
55
 
    }
56
 
 
57
 
    function testAlbumSelectSiteAdminControllerSave() {
58
 
        GalleryUtilities::putRequestVariable('form[sort]', 'manual');
59
 
        GalleryUtilities::putRequestVariable('form[treeIcons]', '1');
60
 
        GalleryUtilities::putRequestVariable('form[treeCloseSameLevel]', '1');
61
 
        GalleryUtilities::putRequestVariable('form[action][save]', '1');
62
 
 
63
 
        $results = $this->handleRequest();
64
 
        $this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
65
 
                                                  'subView' => 'albumselect.AlbumSelectSiteAdmin'),
66
 
                                  'status' => array('saved' => 1),
67
 
                                  'error' => array()),
68
 
                            $results);
69
 
 
70
 
        foreach (array('sort' => 'manual', 'treeLines' => '0',
71
 
                       'treeIcons' => '1', 'treeCookies' => '0', 'treeExpandCollapse' => '0',
72
 
                       'treeCloseSameLevel' => '1') as $key => $expectedValue) {
73
 
            list ($ret, $value) = GalleryCoreApi::getPluginParameter('module', 'albumselect', $key);
74
 
            if ($ret) {
75
 
                return $this->failWithStatus($ret);
76
 
            }
77
 
            $this->assertEquals($expectedValue, $value, $key);
78
 
        }
79
 
    }
80
 
}
81
 
?>