[TASK] EXT:lang unit tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / lang / Tests / Unit / Domain / Model / LanguageSelectionFormTest.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 * Testcase LanguageSelectionForm
30 *
31 * @author Wouter Wolters <typo3@wouterwolters.nl>
32 * @package TYPO3
33 * @subpackage lang
34 */
35 class LanguageSelectionFormTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
36
37 /**
38 * @var \TYPO3\CMS\Lang\Domain\Model\LanguageSelectionForm
39 */
40 protected $fixture = NULL;
41
42 /**
43 * Set up
44 */
45 public function setUp() {
46 $this->fixture = new \TYPO3\CMS\Lang\Domain\Model\LanguageSelectionForm();
47 }
48
49 /**
50 * Tear down
51 */
52 public function tearDown() {
53 $this->fixture = NULL;
54 }
55
56 /**
57 * @test
58 */
59 public function getLanguagesInitiallyReturnsEmptyArray() {
60 $this->assertSame(
61 array(),
62 $this->fixture->getLanguages()
63 );
64 }
65
66 /**
67 * @test
68 */
69 public function setLanguagesSetsLanguage() {
70 $language = array(
71 'nl' => '1',
72 'de' => '0',
73 );
74 $this->fixture->setLanguages($language);
75
76 $this->assertSame(
77 $language,
78 $this->fixture->getLanguages()
79 );
80 }
81
82 /**
83 * @test
84 */
85 public function getSelectedLanguagesInitiallyReturnsEmptyArray() {
86 $this->assertSame(
87 array(),
88 $this->fixture->getSelectedLanguages()
89 );
90 }
91
92 /**
93 * @test
94 */
95 public function setSelectedLanguagesSetsSelectedLanguages() {
96 $selectedLanguages = array(
97 'nl' => '1',
98 'de' => '0',
99 );
100 $this->fixture->setSelectedLanguages($selectedLanguages);
101
102 $this->assertSame(
103 $selectedLanguages,
104 $this->fixture->getSelectedLanguages()
105 );
106 }
107 }
108 ?>