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

LanguageDbTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A getFallBackOrderMultipleTimes() 0 16 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
28
class LanguageDbTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
29
30
	/**
31
	 * @var array
32
	 */
33
	protected $coreExtensionsToLoad = array('version', 'workspaces');
34
35
	/**
36
	 * @var array
37
	 */
38
	protected $testExtensionsToLoad = array('typo3conf/ext/languagevisibility');
39
40
	public function setUp(){
41
		parent::setUp();
42
		$this->importDataSet(__DIR__ . '/Fixtures/dbDefaultLangs.xml');
43
		unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['languagevisibility']);
44
	}
45
46
	/**
47
	 * The fallback order property is cached. This testcase
48
	 * should ensure that it can be read multiple times.
49
	 *
50
	 * @test
51
	 * @return void
52
	 */
53
	public function getFallBackOrderMultipleTimes() {
54
55
		$el = $this->getMockForAbstractClass('tx_languagevisibility_element', array(), '', FALSE);
56
57
		$languageRepository = new tx_languagevisibility_languagerepository();
58
59
		/* @var $language tx_languagevisibility_language */
60
		$language = $languageRepository->getLanguageById(1);
61
62
		$this->assertEquals(array(0 => 0 ), $language->getFallbackOrder($el));
63
		$this->assertEquals(count(array(0 => 0 )), 1);
64
		$this->assertEquals(array(0 => 0 ), $language->getFallbackOrder($el));
65
66
		$this->assertFalse($language->isLanguageUidInFallbackOrder(22, $el));
67
		$this->assertTrue($language->isLanguageUidInFallbackOrder(0, $el));
68
	}
69
}
70