Completed
Push — 7LTS_compatible ( 4a528e...8b7547 )
by Tomas Norre
02:51
created

LanguageRepositoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A test_getLanguages() 0 6 1
A test_getLanguageById() 0 11 1
1
<?php
2
3
namespace AOE\Languagevisibility\Tests\Functional;
4
5
/***************************************************************
6
 * Copyright notice
7
 *
8
 * (c) 2007 AOE media ([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() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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('tx_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('tx_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('tx_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