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
* Test language selection functionality
23
* @package GalleryCore
25
* @author Alan Harder <alan.harder@sun.com>
26
* @version $Revision: 15513 $
28
class LanguageTest extends GalleryControllerTestCase {
30
function LanguageTest($methodName) {
31
$this->GalleryControllerTestCase($methodName, 'core.ChangeLanguage');
37
list ($ret, $this->_siteLanguage) =
38
GalleryCoreApi::getPluginParameter('module', 'core', 'default.language');
40
print $ret->getAsHtml();
41
return $this->failWithStatus($ret);
45
function testGetActiveLanguageCode() {
47
$session =& $gallery->getSession();
48
$session->remove('core.language');
50
list ($ret, $language) = $gallery->getActiveLanguageCode();
52
return $this->failWithStatus($ret);
54
$this->assertEquals(null, $language, 'not set');
56
$user = new GalleryUser();
57
$user->setId('testId');
58
$user->setLanguage('test_language');
59
$gallery->setActiveUser($user);
61
list ($ret, $language) = $gallery->getActiveLanguageCode();
63
return $this->failWithStatus($ret);
65
$this->assertEquals('test_language', $language, 'user language');
67
$gallery->setActiveLanguageCode('sess_language');
69
list ($ret, $language) = $gallery->getActiveLanguageCode();
71
return $this->failWithStatus($ret);
73
$this->assertEquals('sess_language', $language, 'session language');
76
function testChangeLanguageController() {
78
GalleryUtilities::putRequestVariable('language', 'test_language');
80
$results = $this->handleRequest();
81
$this->assertEquals(array('return' => 1,
86
list ($ret, $language) = $gallery->getActiveLanguageCode();
88
return $this->failWithStatus($ret);
90
$this->assertEquals('test_language', $language, 'language');