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

« back to all changes in this revision

Viewing changes to modules/migrate/test/phpunit/SelectGalleryControllerTest.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
 
 * SelectGallery controller tests
23
 
 * @package Migrate
24
 
 * @subpackage PHPUnit
25
 
 * @author Bharat Mediratta <bharat@menalto.com>
26
 
 * @version $Revision: 15513 $
27
 
 */
28
 
class SelectGalleryControllerTest extends GalleryControllerTestCase {
29
 
 
30
 
    function SelectGalleryControllerTest($methodName) {
31
 
        $this->GalleryControllerTestCase($methodName, 'migrate.SelectGallery');
32
 
    }
33
 
 
34
 
    /**
35
 
     * Test what the controller does when you enter a bad albums path
36
 
     */
37
 
    function testBadAlbumsPath() {
38
 
        GalleryUtilities::putRequestVariable('form[albumsPath]', dirname(__FILE__));
39
 
        GalleryUtilities::putRequestVariable('form[action][select]', 1);
40
 
 
41
 
        $results = $this->handleRequest();
42
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
43
 
                                                      'subView' => 'migrate.SelectGallery'),
44
 
                                  'status' => array(),
45
 
                                  'error' => array('form[error][albumsPath][invalid]')),
46
 
                            $results);
47
 
    }
48
 
 
49
 
    /**
50
 
     * Test what the controller does when you enter a valid albums path
51
 
     */
52
 
    function testGoodAlbumsPath() {
53
 
        global $gallery;
54
 
        $platform =& $gallery->getPlatform();
55
 
        $slash = $platform->getDirectorySeparator();
56
 
 
57
 
        $albumsPath = dirname(__FILE__) . '/../data/albums';
58
 
        GalleryUtilities::putRequestVariable('form[albumsPath]', $albumsPath);
59
 
        GalleryUtilities::putRequestVariable('form[action][select]', 1);
60
 
 
61
 
        $results = $this->handleRequest();
62
 
        $this->assertEquals(array('redirect' => array('view' => 'core.SiteAdmin',
63
 
                                                      'subView' => 'migrate.ChooseObjects',
64
 
                                                      'albumsPath' => $albumsPath . $slash),
65
 
                                  'status' => array(),
66
 
                                  'error' => array()),
67
 
                            $results);
68
 
    }
69
 
 
70
 
    /**
71
 
     * Test what the controller does when you enter a missing albums path
72
 
     */
73
 
    function testMissingAlbumsPath() {
74
 
        GalleryUtilities::putRequestVariable('form[albumsPath]', '');
75
 
        GalleryUtilities::putRequestVariable('form[action][select]', 1);
76
 
 
77
 
        $results = $this->handleRequest();
78
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
79
 
                                                      'subView' => 'migrate.SelectGallery'),
80
 
                                  'status' => array(),
81
 
                                  'error' => array('form[error][albumsPath][missing]')),
82
 
                            $results);
83
 
    }
84
 
}
85
 
?>