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

« back to all changes in this revision

Viewing changes to modules/migrate/test/phpunit/ChooseObjectsControllerTest.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
 
 * ChooseObjects controller tests
23
 
 * @package Migrate
24
 
 * @subpackage PHPUnit
25
 
 * @author Bharat Mediratta <bharat@menalto.com>
26
 
 * @version $Revision: 15513 $
27
 
 */
28
 
class ChooseObjectsControllerTest extends GalleryControllerTestCase {
29
 
 
30
 
    function ChooseObjectsControllerTest($methodName) {
31
 
        $this->GalleryControllerTestCase($methodName, 'migrate.ChooseObjects');
32
 
    }
33
 
 
34
 
    function testImportNothingSelected() {
35
 
        GalleryUtilities::putRequestVariable('albumsPath', dirname(__FILE__) . '/../data/albums/');
36
 
        GalleryUtilities::putRequestVariable('form[action][import]', 1);
37
 
        GalleryUtilities::putRequestVariable('form[set][title]', 'caption');
38
 
        GalleryUtilities::putRequestVariable('form[set][summary]', 'blank');
39
 
        GalleryUtilities::putRequestVariable('form[set][description]', 'blank');
40
 
 
41
 
        $results = $this->handleRequest();
42
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
43
 
                                                      'subView' => 'migrate.ChooseObjects'),
44
 
                                  'status' => array(),
45
 
                                  'error' => array('form[error][nothingSelected]')),
46
 
                            $results);
47
 
    }
48
 
 
49
 
    function testImportValidSelections1() {
50
 
        GalleryUtilities::putRequestVariable('albumsPath', dirname(__FILE__) . '/../data/albums/');
51
 
        GalleryUtilities::putRequestVariable('form[migrateUser][12345:6789]', 1);
52
 
        GalleryUtilities::putRequestVariable('form[action][import]', 1);
53
 
        GalleryUtilities::putRequestVariable('form[set][title]', 'filename');
54
 
        GalleryUtilities::putRequestVariable('form[set][summary]', 'caption');
55
 
        GalleryUtilities::putRequestVariable('form[set][description]', 'blank');
56
 
 
57
 
        $results = $this->handleRequest();
58
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
59
 
                                                      'subView' => 'migrate.ConfirmImport'),
60
 
                                  'status' => array(),
61
 
                                  'error' => array()),
62
 
                            $results);
63
 
    }
64
 
 
65
 
    function testImportValidSelections2() {
66
 
        GalleryUtilities::putRequestVariable('albumsPath', dirname(__FILE__) . '/../data/albums/');
67
 
        GalleryUtilities::putRequestVariable('form[sourceAlbums][0]', 'album01');
68
 
        GalleryUtilities::putRequestVariable('form[action][import]', 1);
69
 
        GalleryUtilities::putRequestVariable('form[set][title]', 'caption');
70
 
        GalleryUtilities::putRequestVariable('form[set][summary]', 'filename');
71
 
        GalleryUtilities::putRequestVariable('form[set][description]', 'custom');
72
 
        GalleryUtilities::putRequestVariable('form[customfield][description]', 'Description');
73
 
 
74
 
        $results = $this->handleRequest();
75
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
76
 
                                                      'subView' => 'migrate.ConfirmImport'),
77
 
                                  'status' => array(),
78
 
                                  'error' => array()),
79
 
                            $results);
80
 
    }
81
 
 
82
 
    function testMissingCustomField() {
83
 
        GalleryUtilities::putRequestVariable('albumsPath', dirname(__FILE__) . '/../data/albums/');
84
 
        GalleryUtilities::putRequestVariable('form[sourceAlbums][0]', 'album01');
85
 
        GalleryUtilities::putRequestVariable('form[action][import]', 1);
86
 
        GalleryUtilities::putRequestVariable('form[set][title]', 'custom');
87
 
        GalleryUtilities::putRequestVariable('form[set][summary]', 'custom');
88
 
        GalleryUtilities::putRequestVariable('form[set][description]', 'custom');
89
 
 
90
 
        $results = $this->handleRequest();
91
 
        $this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
92
 
                                                      'subView' => 'migrate.ChooseObjects'),
93
 
                                  'status' => array(),
94
 
                                  'error' => array('form[error][emptyCustomField][title]',
95
 
                                                   'form[error][emptyCustomField][summary]',
96
 
                                                   'form[error][emptyCustomField][description]')),
97
 
                            $results);
98
 
    }
99
 
}
100
 
?>