19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
31 $generator =
function ($method, $indexType =
'numeric') {
73 return [$method, $set, $expected];
76 'simple numeric index, template' => $generator(TemplatePaths::CONFIG_TEMPLATEROOTPATHS,
'numeric'),
77 'alpha index, template' => $generator(TemplatePaths::CONFIG_TEMPLATEROOTPATHS,
'alpha'),
78 'alpha-numeric index, template' => $generator(TemplatePaths::CONFIG_TEMPLATEROOTPATHS,
'alphanumeric'),
79 'simple numeric index, partial' => $generator(TemplatePaths::CONFIG_PARTIALROOTPATHS,
'numeric'),
80 'alpha index, partial' => $generator(TemplatePaths::CONFIG_PARTIALROOTPATHS,
'alpha'),
81 'alpha-numeric index, partial' => $generator(TemplatePaths::CONFIG_PARTIALROOTPATHS,
'alphanumeric'),
82 'simple numeric index, layout' => $generator(TemplatePaths::CONFIG_LAYOUTROOTPATHS,
'numeric'),
83 'alpha index, layout' => $generator(TemplatePaths::CONFIG_LAYOUTROOTPATHS,
'alpha'),
84 'alpha-numeric index, layout' => $generator(TemplatePaths::CONFIG_LAYOUTROOTPATHS,
'alphanumeric'),
97 $setter =
'set' . ucfirst($method);
98 $subject = $this->getMockBuilder(TemplatePaths::class)->setMethods([
'sanitizePath'])->getMock();
99 $subject->expects($this->any())->method(
'sanitizePath')->willReturnArgument(0);
100 $subject->$setter($paths);
101 $this->assertAttributeSame($expected, $method, $subject);
109 $configurationManager = $this->getMockBuilder(ConfigurationManagerInterface::class)->getMockForAbstractClass();
110 $configurationManager->expects($this->once())->method(
'getConfiguration')->willReturn([
114 'templateRootPaths.' => [
119 'partialRootPaths.' => [
124 'layoutRootPaths.' => [
133 $subject = $this->getMockBuilder(TemplatePaths::class)->setMethods([
'getConfigurationManager',
'getExtensionPrivateResourcesPath',
'getRuntimeCache',
'isBackendMode',
'isFrontendMode'])->getMock();
134 $subject->expects($this->once())->method(
'getExtensionPrivateResourcesPath')->with(
'test')->willReturn(
'test/');
135 $subject->expects($this->once())->method(
'getConfigurationManager')->willReturn($configurationManager);
136 $subject->expects($this->once())->method(
'isBackendMode')->willReturn(
false);
137 $subject->expects($this->once())->method(
'isFrontendMode')->willReturn(
true);
138 $result = $this->callInaccessibleMethod($subject,
'getContextSpecificViewConfiguration',
'test');
140 'templateRootPaths' => [
146 'partialRootPaths' => [
152 'layoutRootPaths' => [
166 $configurationManager = $this->getMockBuilder(ConfigurationManagerInterface::class)->getMockForAbstractClass();
167 $configurationManager->expects($this->once())->method(
'getConfiguration')->willReturn([
171 'templateRootPaths.' => [
176 'partialRootPaths.' => [
181 'layoutRootPaths.' => [
190 $subject = $this->getMockBuilder(TemplatePaths::class)->setMethods([
'getConfigurationManager',
'getExtensionPrivateResourcesPath',
'getRuntimeCache',
'isBackendMode',
'isFrontendMode'])->getMock();
191 $subject->expects($this->once())->method(
'getExtensionPrivateResourcesPath')->with(
'test')->willReturn(
'test/');
192 $subject->expects($this->once())->method(
'getConfigurationManager')->willReturn($configurationManager);
193 $subject->expects($this->once())->method(
'isBackendMode')->willReturn(
true);
194 $subject->expects($this->never())->method(
'isFrontendMode');
195 $result = $this->callInaccessibleMethod($subject,
'getContextSpecificViewConfiguration',
'test');
197 'templateRootPaths' => [
203 'partialRootPaths' => [
209 'layoutRootPaths' => [
223 $configurationManager = $this->getMockBuilder(ConfigurationManagerInterface::class)->getMockForAbstractClass();
224 $configurationManager->expects($this->once())->method(
'getConfiguration')->willReturn([
228 'templateRootPaths.' => [
233 'partialRootPaths.' => [
238 'layoutRootPaths.' => [
247 $subject = $this->getMockBuilder(TemplatePaths::class)->setMethods([
'getConfigurationManager',
'getExtensionPrivateResourcesPath',
'getRuntimeCache',
'isBackendMode',
'isFrontendMode'])->getMock();
248 $subject->expects($this->once())->method(
'getExtensionPrivateResourcesPath')->with(
'test')->willReturn(
'test/');
249 $subject->expects($this->once())->method(
'getConfigurationManager')->willReturn($configurationManager);
250 $subject->expects($this->once())->method(
'isBackendMode')->willReturn(
false);
251 $subject->expects($this->once())->method(
'isFrontendMode')->willReturn(
false);
252 $result = $this->callInaccessibleMethod($subject,
'getContextSpecificViewConfiguration',
'test');
254 'templateRootPaths' => [
257 'partialRootPaths' => [
260 'layoutRootPaths' => [