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

« back to all changes in this revision

Viewing changes to modules/core/test/phpunit/AdminToolkitPriorityControllerTest.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
 
 * AdminToolkitPriority controller tests
23
 
 * @package GalleryCore
24
 
 * @subpackage PHPUnit
25
 
 * @author Alan Harder <alan.harder@sun.com>
26
 
 * @version $Revision: 15513 $
27
 
 */
28
 
class AdminToolkitPriorityControllerTest extends GalleryControllerTestCase {
29
 
 
30
 
    function AdminToolkitPriorityControllerTest($methodName) {
31
 
        $this->GalleryControllerTestCase($methodName, 'core.AdminToolkitPriority');
32
 
    }
33
 
 
34
 
    function setUp() {
35
 
        parent::setUp();
36
 
 
37
 
        $ret = GalleryCoreApi::registerToolkitOperation('TestToolkitPriority',
38
 
                array('test/type'), 'test-operation', array(),
39
 
                'test-description', 'test/outputType', 30);
40
 
        if ($ret) {
41
 
            return $this->failWithStatus($ret);
42
 
        }
43
 
        $this->_markToolkitForCleanup('TestToolkitPriority');
44
 
 
45
 
        $ret = GalleryCoreApi::registerToolkitOperation('TestToolkitPriority2',
46
 
                array('test/type'), 'test-operation', array(),
47
 
                'test-description', 'test/outputType', 27);
48
 
        if ($ret) {
49
 
            return $this->failWithStatus($ret);
50
 
        }
51
 
        $this->_markToolkitForCleanup('TestToolkitPriority2');
52
 
    }
53
 
 
54
 
    function testReset() {
55
 
        GalleryUtilities::putRequestVariable('form[action][reset]', 1);
56
 
 
57
 
        $results = $this->handleRequest();
58
 
        $this->assertEquals(array('return' => 0,
59
 
                                  'redirect' => array('view' => 'core.SiteAdmin',
60
 
                                                      'subView' => 'core.AdminToolkitPriority'),
61
 
                                  'status' => array(),
62
 
                                  'error' => array()),
63
 
                            $results);
64
 
    }
65
 
 
66
 
    function testSave() {
67
 
        GalleryUtilities::putRequestVariable('form[action][save]', 1);
68
 
        GalleryUtilities::putRequestVariable('form[priority][27]', 'TestToolkitPriority');
69
 
        GalleryUtilities::putRequestVariable('form[priority][30]', 'TestToolkitPriority2');
70
 
 
71
 
        $results = $this->handleRequest();
72
 
        $this->assertEquals(array('return' => 0,
73
 
                                  'redirect' => array('view' => 'core.SiteAdmin',
74
 
                                                      'subView' => 'core.AdminToolkitPriority'),
75
 
                                  'status' => array('saved' => 1),
76
 
                                  'error' => array()),
77
 
                            $results);
78
 
 
79
 
        list ($ret, $list) = GalleryCoreApi::getRedundantToolkitPriorities();
80
 
        if ($ret) {
81
 
            return $this->failWithStatus($ret);
82
 
        }
83
 
 
84
 
        $this->assert(count($list) >= 2, 'count');
85
 
        $this->assertEquals(27, $list['TestToolkitPriority'], 'TestToolkitPriority');
86
 
        $this->assertEquals(30, $list['TestToolkitPriority2'], 'TestToolkitPriority2');
87
 
    }
88
 
}
89
 
 
90
 
/**
91
 
 * Mock toolkit
92
 
 *
93
 
 * @package GalleryCore
94
 
 * @subpackage PHPUnit
95
 
 */
96
 
class TestToolkitPriority { }
97
 
 
98
 
/**
99
 
 * Mock toolkit
100
 
 *
101
 
 * @package GalleryCore
102
 
 * @subpackage PHPUnit
103
 
 */
104
 
class TestToolkitPriority2 { }
105
 
?>