|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AOE\Languagevisibility\Tests\Functional; |
|
4
|
|
|
|
|
5
|
|
|
/*************************************************************** |
|
6
|
|
|
* Copyright notice |
|
7
|
|
|
* |
|
8
|
|
|
* (c) 2016 AOE GmbH <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* All rights reserved |
|
11
|
|
|
* |
|
12
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
|
13
|
|
|
* free software; you can redistribute it and/or modify |
|
14
|
|
|
* it under the terms of the GNU General Public License as published by |
|
15
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
16
|
|
|
* (at your option) any later version. |
|
17
|
|
|
* |
|
18
|
|
|
* The GNU General Public License can be found at |
|
19
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
|
20
|
|
|
* |
|
21
|
|
|
* This script is distributed in the hope that it will be useful, |
|
22
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24
|
|
|
* GNU General Public License for more details. |
|
25
|
|
|
* |
|
26
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
|
27
|
|
|
***************************************************************/ |
|
28
|
|
|
|
|
29
|
|
|
use AOE\Languagevisibility\Dao\DaoCommon; |
|
30
|
|
|
use AOE\Languagevisibility\ElementFactory; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Class DatabaseTtContentTest |
|
34
|
|
|
* @package AOE\Languagevisibility\Tests\Functional |
|
35
|
|
|
*/ |
|
36
|
|
|
abstract class DatabaseTtContentTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase { |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var array |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $coreExtensionsToLoad = array('version', 'workspaces'); |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var array |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $testExtensionsToLoad = array('typo3conf/ext/languagevisibility'); |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var bool |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $_langImport = FALSE; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var bool |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $_ceImport = FALSE; |
|
57
|
|
|
|
|
58
|
|
|
public function setUp() { |
|
59
|
|
|
parent::setUp(); |
|
60
|
|
|
$GLOBALS['BE_USER'] = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication'); |
|
61
|
|
|
$this->_loadWorkspaces(); |
|
62
|
|
|
$this->flushCache(); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
protected function _loadWorkspaces() { |
|
66
|
|
|
$this->importDataSet(__DIR__ . '/Fixtures/dbDefaultWorkspaces.xml'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
protected function _fakeWorkspaceContext($uid) { |
|
70
|
|
|
$GLOBALS['BE_USER']->workspace = $uid; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
protected function _getLang($uid) { |
|
74
|
|
|
$this->makeSureLanguagesImported(); |
|
75
|
|
|
$languageRep = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('AOE\\Languagevisibility\\LanguageRepository'); |
|
76
|
|
|
return $languageRep->getLanguageById($uid); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
protected function _getContent($table, $uid) { |
|
80
|
|
|
$this->makeSureContentElementsImported(); |
|
81
|
|
|
$dao = new DaoCommon(); |
|
82
|
|
|
|
|
83
|
|
|
$factory = new ElementFactory($dao); |
|
84
|
|
|
return $factory->getElementForTable($table, $uid); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
protected function makeSureLanguagesImported() { |
|
88
|
|
|
if (!$this->_langImport) { |
|
89
|
|
|
$this->_langImport = TRUE; |
|
90
|
|
|
$this->importDataSet(__DIR__ . '/Fixtures/dbDefaultLangs.xml'); |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
protected function makeSureContentElementsImported() { |
|
95
|
|
|
if (!$this->_ceImport) { |
|
96
|
|
|
$this->_ceImport = TRUE; |
|
97
|
|
|
$this->importDataSet(__DIR__ . '/Fixtures/dbContentWithVisibilityTestdata.xml'); |
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
protected function flushCache() { |
|
102
|
|
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager') |
|
103
|
|
|
->getCache('tx_languagevisibility') |
|
104
|
|
|
->flush(); |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|