1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AOE\Languagevisibility\Tests\Functional; |
4
|
|
|
|
5
|
|
|
/*************************************************************** |
6
|
|
|
* Copyright notice |
7
|
|
|
* |
8
|
|
|
* (c) 2016 AOE GmbH <[email protected]> |
9
|
|
|
* All rights reserved |
10
|
|
|
* |
11
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
12
|
|
|
* free software; you can redistribute it and/or modify |
13
|
|
|
* it under the terms of the GNU General Public License as published by |
14
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
15
|
|
|
* (at your option) any later version. |
16
|
|
|
* |
17
|
|
|
* The GNU General Public License can be found at |
18
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
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
|
|
|
use AOE\Languagevisibility\Language; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Test case for checking the PHPUnit 3.1.9 |
31
|
|
|
* |
32
|
|
|
* WARNING: Never ever run a unit test like this on a live site! |
33
|
|
|
* |
34
|
|
|
* |
35
|
|
|
* @author Daniel Pötzinger |
36
|
|
|
*/ |
37
|
|
|
class LanguageRepositoryTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase { |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var array |
41
|
|
|
*/ |
42
|
|
|
protected $coreExtensionsToLoad = array('version', 'workspaces'); |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var array |
46
|
|
|
*/ |
47
|
|
|
protected $testExtensionsToLoad = array('typo3conf/ext/languagevisibility'); |
48
|
|
|
|
49
|
|
|
function setUp() { |
|
|
|
|
50
|
|
|
parent::setUp(); |
51
|
|
|
$this->importDataSet(__DIR__ . '/Fixtures/dbDefaultLangs.xml'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function test_getLanguages() { |
55
|
|
|
$languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
56
|
|
|
$languageList = $languageRep->getLanguages(); |
57
|
|
|
$this->assertTrue(is_array($languageList), "no array"); |
58
|
|
|
|
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function test_getLanguageById() { |
62
|
|
|
$languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
63
|
|
|
$language = $languageRep->getLanguageById(0); |
64
|
|
|
$this->assertTrue($language instanceof Language, "no language object"); |
65
|
|
|
$this->assertEquals($language->getUid(), 0, "wrong uid"); |
66
|
|
|
|
67
|
|
|
$languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
68
|
|
|
$language = $languageRep->getLanguageById(1); |
69
|
|
|
$this->assertTrue($language instanceof Language, "no language object"); |
70
|
|
|
$this->assertEquals($language->getUid(), 1, "wrong uid"); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.