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

« back to all changes in this revision

Viewing changes to modules/register/test/phpunit/RegisterModuleTest.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
 
 * Test Register module functionality
23
 
 * @package Registration
24
 
 * @subpackage PHPUnit
25
 
 * @author Alan Harder <alan.harder@sun.com>
26
 
 * @version $Revision: 15513 $
27
 
 */
28
 
class RegisterModuleTest extends GalleryTestCase {
29
 
 
30
 
    function RewriteModuleTest($methodName) {
31
 
        $this->GalleryTestCase($methodName);
32
 
    }
33
 
 
34
 
    function setUp() {
35
 
        parent::setUp();
36
 
 
37
 
        list ($ret, $this->_module) = GalleryCoreApi::loadPlugin('module', 'register');
38
 
        if ($ret) {
39
 
            print $ret->getAsHtml();
40
 
            return $this->failWithStatus($ret);
41
 
        }
42
 
    }
43
 
 
44
 
    function testSystemLinks() {
45
 
        global $gallery;
46
 
        $label = $this->_module->translate('Register');
47
 
 
48
 
        list ($ret, $links) = $this->_module->getSystemLinks();
49
 
        if ($ret) {
50
 
            return $this->failWithStatus($ret);
51
 
        }
52
 
        /* None for non-guest */
53
 
        $this->assertEquals(array(), $links, 'admin');
54
 
 
55
 
        $gallery->setConfig('anonymousUserId', $gallery->getActiveUserId());
56
 
        list ($ret, $links) = $this->_module->getSystemLinks();
57
 
        if ($ret) {
58
 
            return $this->failWithStatus($ret);
59
 
        }
60
 
        $this->assertEquals(
61
 
                array('Register' => array('text' => $label,
62
 
                        'params' => array('view' => 'core.UserAdmin',
63
 
                                          'subView' => 'register.UserSelfRegistration',
64
 
                                          'return' => 1))),
65
 
                $links, 'alternate guest');
66
 
 
67
 
        $gallery->setConfig('anonymousUserId', null);
68
 
        $this->_becomeGuestUser();
69
 
        list ($ret, $links) = $this->_module->getSystemLinks();
70
 
        if ($ret) {
71
 
            return $this->failWithStatus($ret);
72
 
        }
73
 
        $this->assertEquals(
74
 
                array('Register' => array('text' => $label,
75
 
                        'params' => array('view' => 'core.UserAdmin',
76
 
                                          'subView' => 'register.UserSelfRegistration',
77
 
                                          'return' => 1))),
78
 
                $links, 'guest');
79
 
    }
80
 
}
81
 
?>