[!!!][TASK] Extract testing framework for TYPO3
[Packages/TYPO3.CMS.git] / typo3 / sysext / lang / Tests / Unit / Domain / Model / LanguageTest.php
1 <?php
2 namespace TYPO3\CMS\Lang\Tests\Unit\Domain\Model;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Testcase for Language
19 */
20 class LanguageTest extends \TYPO3\CMS\Components\TestingFramework\Core\UnitTestCase
21 {
22 /**
23 * @var \TYPO3\CMS\Lang\Domain\Model\Language
24 */
25 protected $subject = null;
26
27 /**
28 * Set up
29 */
30 protected function setUp()
31 {
32 $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Language();
33 }
34
35 /**
36 * @test
37 */
38 public function getLocaleInitiallyReturnsEmptyString()
39 {
40 $this->assertSame(
41 '',
42 $this->subject->getLocale()
43 );
44 }
45
46 /**
47 * @test
48 */
49 public function getLocaleInitiallyReturnsGivenLocaleFromConstruct()
50 {
51 $locale = 'nl';
52 $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Language($locale);
53
54 $this->assertSame(
55 $locale,
56 $this->subject->getLocale()
57 );
58 }
59
60 /**
61 * @test
62 */
63 public function setLocaleSetsLocale()
64 {
65 $locale = 'nl';
66 $this->subject->setLocale($locale);
67
68 $this->assertSame(
69 $locale,
70 $this->subject->getLocale()
71 );
72 }
73
74 /**
75 * @test
76 */
77 public function getLanguageInitiallyReturnsEmptyString()
78 {
79 $this->assertSame(
80 '',
81 $this->subject->getLabel()
82 );
83 }
84
85 /**
86 * @test
87 */
88 public function getLanguageInitiallyReturnsGivenLanguageFromConstruct()
89 {
90 $language = 'nl';
91 $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Language('', $language);
92
93 $this->assertSame(
94 $language,
95 $this->subject->getLabel()
96 );
97 }
98
99 /**
100 * @test
101 */
102 public function setLanguageSetsLanguage()
103 {
104 $language = 'nl';
105 $this->subject->setLabel($language);
106
107 $this->assertSame(
108 $language,
109 $this->subject->getLabel()
110 );
111 }
112
113 /**
114 * @test
115 */
116 public function getSelectedInitiallyReturnsFalse()
117 {
118 $this->assertSame(
119 false,
120 $this->subject->getSelected()
121 );
122 }
123
124 /**
125 * @test
126 */
127 public function getSelectedInitiallyReturnsGivenSelectedFromConstruct()
128 {
129 $selected = false;
130 $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Language('', '', false);
131
132 $this->assertSame(
133 $selected,
134 $this->subject->getSelected()
135 );
136 }
137
138 /**
139 * @test
140 */
141 public function setSelectedSetsSelected()
142 {
143 $selected = true;
144 $this->subject->setSelected($selected);
145
146 $this->assertSame(
147 $selected,
148 $this->subject->getSelected()
149 );
150 }
151 }