~ubuntu-branches/ubuntu/maverick/gallery2/maverick

« back to all changes in this revision

Viewing changes to modules/getid3/test/phpunit/Getid3DetailModeControllerTest.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
 
 * SwitchDetailMode controller tests
23
 
 * @package Getid3
24
 
 * @subpackage PHPUnit
25
 
 * @author Don Willingham <donwillingham@users.sf.net>
26
 
 * @version $Revision: 15513 $
27
 
 */
28
 
class Getid3DetailModeControllerTest extends GalleryControllerTestCase {
29
 
 
30
 
    function Getid3DetailModeControllerTest($methodName) {
31
 
        $this->GalleryControllerTestCase($methodName, 'getid3:Getid3DetailMode');
32
 
    }
33
 
 
34
 
    function testSwitchToSummary() {
35
 
        global $gallery;
36
 
        GalleryUtilities::putRequestVariable('mode', 'summary');
37
 
 
38
 
        /* Perform the request and verify that we succeeded */
39
 
        $results = $this->handleRequest();
40
 
        $this->assertEquals(array('return' => 1,
41
 
                                  'redirect' => array('view' => 'core.ShowItem'),
42
 
                                  'status' => array(),
43
 
                                  'error' => array()),
44
 
                            $results);
45
 
 
46
 
        /* Verify that we're in the right mode now */
47
 
        $session =& $gallery->getSession();
48
 
        if (!$session->exists('getid3.module.LoadGetid3Info.mode')) {
49
 
            $this->fail('Missing session value');
50
 
        }
51
 
        $this->assertEquals('summary', $session->get('getid3.module.LoadGetid3Info.mode'));
52
 
    }
53
 
 
54
 
    function testSwitchToDetailed() {
55
 
        global $gallery;
56
 
        GalleryUtilities::putRequestVariable('mode', 'detailed');
57
 
 
58
 
        /* Perform the request and verify that we succeeded */
59
 
        $results = $this->handleRequest();
60
 
        $this->assertEquals(array('return' => 1,
61
 
                                  'redirect' => array('view' => 'core.ShowItem'),
62
 
                                  'status' => array(),
63
 
                                  'error' => array()),
64
 
                            $results);
65
 
 
66
 
        /* Verify that we're in the right mode now */
67
 
        $session =& $gallery->getSession();
68
 
        if (!$session->exists('getid3.module.LoadGetid3Info.mode')) {
69
 
            $this->fail('Missing session value');
70
 
        }
71
 
        $this->assertEquals('detailed', $session->get('getid3.module.LoadGetid3Info.mode'));
72
 
    }
73
 
 
74
 
    function testSwitchToBogus() {
75
 
        global $gallery;
76
 
        GalleryUtilities::putRequestVariable('mode', 'BoGuS');
77
 
 
78
 
        /* Perform the request and verify that we succeeded */
79
 
        $results = $this->handleRequest();
80
 
        $this->assertEquals(array('return' => 1,
81
 
                                  'redirect' => array('view' => 'core.ShowItem'),
82
 
                                  'status' => array(),
83
 
                                  'error' => array()),
84
 
                            $results);
85
 
 
86
 
        /* Verify that we're in the right mode now */
87
 
        $session =& $gallery->getSession();
88
 
        if (!$session->exists('getid3.module.LoadGetid3Info.mode')) {
89
 
            $this->fail('Missing session value');
90
 
        }
91
 
        $this->assertEquals('summary', $session->get('getid3.module.LoadGetid3Info.mode'));
92
 
    }
93
 
}
94
 
?>