3
* Gallery - a web based photo album viewer and editor
4
* Copyright (C) 2000-2007 Bharat Mediratta
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.
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.
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.
22
* ChooseObjects controller tests
25
* @author Bharat Mediratta <bharat@menalto.com>
26
* @version $Revision: 15513 $
28
class ChooseObjectsControllerTest extends GalleryControllerTestCase {
30
function ChooseObjectsControllerTest($methodName) {
31
$this->GalleryControllerTestCase($methodName, 'migrate.ChooseObjects');
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');
41
$results = $this->handleRequest();
42
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
43
'subView' => 'migrate.ChooseObjects'),
45
'error' => array('form[error][nothingSelected]')),
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');
57
$results = $this->handleRequest();
58
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
59
'subView' => 'migrate.ConfirmImport'),
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');
74
$results = $this->handleRequest();
75
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
76
'subView' => 'migrate.ConfirmImport'),
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');
90
$results = $this->handleRequest();
91
$this->assertEquals(array('delegate' => array('view' => 'core.SiteAdmin',
92
'subView' => 'migrate.ChooseObjects'),
94
'error' => array('form[error][emptyCustomField][title]',
95
'form[error][emptyCustomField][summary]',
96
'form[error][emptyCustomField][description]')),