19be416bced6c7745aafb94e7cbe5a1d32cf8371
[Packages/TYPO3.CMS.git] / typo3 / sysext / lang / Tests / Domain / Model / LanguageTest.php
1 <?php
2 namespace TYPO3\CMS\Lang\Tests\Unit\Domain\Model;
3 /***************************************************************
4 * Copyright notice
5 *
6 * (c) 2012 Wouter Wolters <typo3@wouterwolters.nl>
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 * A copy is found in the textfile GPL.txt and important notices to the license
18 * from the author is found in LICENSE.txt distributed with these scripts.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * Test case for class \TYPO3\CMS\Lang\Domain\Model\Language
30 *
31 * @author Wouter Wolters <typo3@wouterwolters.nl>
32 * @package TYPO3
33 * @subpackage lang
34 */
35 class LanguageTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
36
37 /**
38 * @var \TYPO3\CMS\Lang\Domain\Model\Language
39 */
40 protected $fixture = NULL;
41
42 public function setUp() {
43 $this->fixture = new \TYPO3\CMS\Lang\Domain\Model\Language();
44 }
45
46 public function tearDown() {
47 unset($this->fixture);
48 }
49
50 /**
51 * @test
52 */
53 public function getLocaleInitiallyReturnsEmptyString() {
54 $this->assertSame(
55 '',
56 $this->fixture->getLocale()
57 );
58 }
59
60 /**
61 * @test
62 */
63 public function getLocaleInitiallyReturnsGivenLocaleFromConstruct() {
64 $locale = 'nl';
65 $this->fixture = new \TYPO3\CMS\Lang\Domain\Model\Language($locale);
66
67 $this->assertSame(
68 $locale,
69 $this->fixture->getLocale()
70 );
71 }
72
73 /**
74 * @test
75 */
76 public function setLocaleSetsLocale() {
77 $locale = 'nl';
78 $this->fixture->setLocale($locale);
79
80 $this->assertSame(
81 $locale,
82 $this->fixture->getLocale()
83 );
84 }
85
86 /**
87 * @test
88 */
89 public function getLanguageInitiallyReturnsEmptyString() {
90 $this->assertSame(
91 '',
92 $this->fixture->getLanguage()
93 );
94 }
95
96 /**
97 * @test
98 */
99 public function getLanguageInitiallyReturnsGivenLanguageFromConstruct() {
100 $language = 'nl';
101 $this->fixture = new \TYPO3\CMS\Lang\Domain\Model\Language('', $language);
102
103 $this->assertSame(
104 $language,
105 $this->fixture->getLanguage()
106 );
107 }
108
109 /**
110 * @test
111 */
112 public function setLanguageSetsLanguage() {
113 $language = 'nl';
114 $this->fixture->setLanguage($language);
115
116 $this->assertSame(
117 $language,
118 $this->fixture->getLanguage()
119 );
120 }
121
122 /**
123 * @test
124 */
125 public function getSelectedInitiallyReturnsFalse() {
126 $this->assertSame(
127 FALSE,
128 $this->fixture->getSelected()
129 );
130 }
131
132 /**
133 * @test
134 */
135 public function getSelectedInitiallyReturnsGivenSelectedFromConstruct() {
136 $selected = FALSE;
137 $this->fixture = new \TYPO3\CMS\Lang\Domain\Model\Language('', '', FALSE);
138
139 $this->assertSame(
140 $selected,
141 $this->fixture->getSelected()
142 );
143 }
144
145 /**
146 * @test
147 */
148 public function setSelectedSetsSelected() {
149 $selected = TRUE;
150 $this->fixture->setSelected($selected);
151
152 $this->assertSame(
153 $selected,
154 $this->fixture->getSelected()
155 );
156 }
157
158 }
159 ?>