TYPO3  7.6
lang/Tests/Unit/Domain/Model/ExtensionTest.php
Go to the documentation of this file.
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 
20 class ExtensionTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
21 {
25  protected $subject = null;
26 
30  protected function setUp()
31  {
32  $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Extension();
33  }
34 
39  {
40  $this->assertSame(
41  '',
42  $this->subject->getKey()
43  );
44  }
45 
50  {
51  $key = 'foo bar';
52  $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Extension($key);
53 
54  $this->assertSame(
55  $key,
56  $this->subject->getKey()
57  );
58  }
59 
63  public function setKeySetsKey()
64  {
65  $key = 'foo bar';
66  $this->subject->setKey($key);
67 
68  $this->assertSame(
69  $key,
70  $this->subject->getKey()
71  );
72  }
73 
78  {
79  $this->assertSame(
80  '',
81  $this->subject->getTitle()
82  );
83  }
84 
89  {
90  $title = 'foo bar';
91  $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Extension('', $title);
92 
93  $this->assertSame(
94  $title,
95  $this->subject->getTitle()
96  );
97  }
98 
102  public function setTitleSetsTitle()
103  {
104  $title = 'foo bar';
105  $this->subject->setTitle($title);
106 
107  $this->assertSame(
108  $title,
109  $this->subject->getTitle()
110  );
111  }
112 
117  {
118  $this->assertSame(
119  '',
120  $this->subject->getIcon()
121  );
122  }
123 
128  {
129  $icon = 'foo bar';
130  $this->subject = new \TYPO3\CMS\Lang\Domain\Model\Extension('', '', $icon);
131 
132  $this->assertSame(
133  $icon,
134  $this->subject->getIcon()
135  );
136  }
137 
141  public function setIconSetsIcon()
142  {
143  $icon = 'foo bar';
144  $this->subject->setIcon($icon);
145 
146  $this->assertSame(
147  $icon,
148  $this->subject->getIcon()
149  );
150  }
151 
156  {
157  $this->assertSame(
158  '',
159  $this->subject->getVersion()
160  );
161  }
162 
166  public function setVersionSetsVersion()
167  {
168  $version = 10;
169  $this->subject->setVersion($version);
170 
171  $this->assertSame(
172  $version,
173  $this->subject->getVersion()
174  );
175  }
176 
181  {
182  $version = 4012003;
183  $this->subject->setVersionFromString('4.12.3');
184 
185  $this->assertSame(
186  $version,
187  $this->subject->getVersion()
188  );
189  }
190 
195  {
196  $this->assertSame(
197  array(),
198  $this->subject->getUpdateResult()
199  );
200  }
201 
206  {
207  $updateResult = array(
208  'nl' => array(
209  'icon' => '<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-info">&nbsp;</span>',
210  'message' => 'translation_n_a'
211  ),
212  );
213 
214  $this->subject->setUpdateResult($updateResult);
215 
216  $this->assertSame(
217  $updateResult,
218  $this->subject->getUpdateResult()
219  );
220  }
221 }