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

« back to all changes in this revision

Viewing changes to modules/webcam/test/phpunit/WebCamSiteAdminControllerTest.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
 
 * WebCamSiteAdmin controller tests
23
 
 *
24
 
 * @package WebCam
25
 
 * @subpackage PHPUnit
26
 
 * @author Alan Harder <alan.harder@sun.com>
27
 
 * @version $Revision: 15513 $
28
 
 */
29
 
class WebCamSiteAdminControllerTest extends GalleryControllerTestCase {
30
 
 
31
 
    function WebCamSiteAdminControllerTest($methodName) {
32
 
        $this->GalleryControllerTestCase($methodName, 'webcam.WebCamSiteAdmin');
33
 
    }
34
 
 
35
 
    function setUp() {
36
 
        parent::setUp();
37
 
 
38
 
        $ret = $this->_markPluginParametersForCleanup('module', 'webcam');
39
 
        if ($ret) {
40
 
                print $ret->getAsHtml();
41
 
                return $this->failWithStatus($ret);
42
 
        }
43
 
    }
44
 
 
45
 
    function testWebCamSiteAdminControllerUndo() {
46
 
        GalleryUtilities::putRequestVariable('form[action][reset]', '1');
47
 
 
48
 
        $results = $this->handleRequest();
49
 
        $this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
50
 
                                                      'subView' => 'webcam.WebCamSiteAdmin'),
51
 
                                  'status' => array(),
52
 
                                  'error' => array()),
53
 
                            $results);
54
 
    }
55
 
 
56
 
    function testWebCamSiteAdminControllerSave() {
57
 
        GalleryUtilities::putRequestVariable('form[duration]', '123.4');
58
 
        GalleryUtilities::putRequestVariable('form[action][save]', '1');
59
 
 
60
 
        $results = $this->handleRequest();
61
 
        $this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
62
 
                                                      'subView' => 'webcam.WebCamSiteAdmin'),
63
 
                                  'status' => array('saved' => 1),
64
 
                                  'error' => array()),
65
 
                            $results);
66
 
 
67
 
        list ($ret, $duration) =
68
 
            GalleryCoreApi::getPluginParameter('module', 'webcam', 'duration');
69
 
        if ($ret) {
70
 
            return $this->failWithStatus($ret);
71
 
        }
72
 
        $this->assertEquals('7404', $duration, 'duration');
73
 
    }
74
 
 
75
 
    function testWebCamSiteAdminControllerSaveNoDuration() {
76
 
        GalleryUtilities::putRequestVariable('form[action][save]', '1');
77
 
 
78
 
        $results = $this->handleRequest();
79
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
80
 
                                                      'subView' => 'webcam.WebCamSiteAdmin'),
81
 
                                  'status' => array(),
82
 
                                  'error' => array('form[error][duration]')),
83
 
                            $results);
84
 
    }
85
 
 
86
 
    function testWebCamSiteAdminControllerSaveBadDuration() {
87
 
        GalleryUtilities::putRequestVariable('form[duration]', 'abc');
88
 
        GalleryUtilities::putRequestVariable('form[action][save]', '1');
89
 
 
90
 
        $results = $this->handleRequest();
91
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
92
 
                                                      'subView' => 'webcam.WebCamSiteAdmin'),
93
 
                                  'status' => array(),
94
 
                                  'error' => array('form[error][duration]')),
95
 
                            $results);
96
 
    }
97
 
 
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');
102
 
 
103
 
        $results = $this->handleRequest();
104
 
        $this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
105
 
                                                      'subView' => 'webcam.WebCamSiteAdmin'),
106
 
                                  'status' => array('saved' => 1),
107
 
                                  'error' => array()),
108
 
                            $results);
109
 
 
110
 
        list ($ret, $duration) =
111
 
            GalleryCoreApi::getPluginParameter('module', 'webcam', 'duration');
112
 
        if ($ret) {
113
 
            return $this->failWithStatus($ret);
114
 
        }
115
 
        $this->assertEquals('7404', $duration, 'duration');
116
 
    }
117
 
}
118
 
?>