2 declare(strict_types = 1);
7 use Psr\Http\Message\ServerRequestInterface;
12 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 $this->beUserProphecy = $this->prophesize(BackendUserAuthentication::class);
25 $GLOBALS[
'BE_USER'] = $this->beUserProphecy->reveal();
33 $userTsAdmPanelConfig = [
41 $result = $configurationService->getMainConfiguration();
43 self::assertSame($userTsAdmPanelConfig, $result);
51 $configurationService =
new ConfigurationService();
52 $result = $configurationService->getConfigurationOption(
'foo',
'bar');
53 self::assertSame(
'', $result);
65 'showHiddenPages' =>
'1',
71 $configurationService =
new ConfigurationService();
72 $result = $configurationService->getConfigurationOption(
'preview',
'showHiddenPages');
74 self::assertSame(
'1', $result);
86 'showHiddenPages' => 1,
92 $configurationService =
new ConfigurationService();
93 $result = $configurationService->getConfigurationOption(
'preview',
'showHiddenPages');
95 self::assertSame(
'1', $result);
101 'empty identifier' => [
124 $this->expectException(\InvalidArgumentException::class);
125 $this->expectExceptionCode(1532861423);
128 $configurationService->getConfigurationOption($identifier, $option);
137 $this->beUserProphecy->uc = [
139 'preview_showHiddenPages' =>
'1',
143 $configurationService =
new ConfigurationService();
144 $result = $configurationService->getConfigurationOption(
'preview',
'showHiddenPages');
146 self::assertSame(
'1', $result);
154 $subModuleFixture = $this->prophesize(SubModuleFixture::class);
155 $mainModuleFixture = $this->prophesize(MainModuleFixture::class);
156 $mainModuleFixture->isEnabled()->willReturn(
true);
157 $mainModuleFixture->onSubmit(Argument::cetera())->shouldBeCalled()->hasReturnVoid();
158 $mainModuleFixture->getSubModules()->willReturn(
159 [$subModuleFixture->reveal()]
162 $mainModuleFixture->reveal(),
165 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
167 $configurationService =
new ConfigurationService();
168 $configurationService->saveConfiguration($modules, $requestProphecy->reveal());
170 $mainModuleFixture->onSubmit([], $requestProphecy->reveal())->shouldHaveBeenCalled();
171 $subModuleFixture->onSubmit([], $requestProphecy->reveal())->shouldHaveBeenCalled();
180 $this->beUserProphecy->uc = [
187 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
188 $requestProphecy->getParsedBody()->willReturn(
190 'TSFE_ADMIN_PANEL' => [
196 $configurationService =
new ConfigurationService();
197 $configurationService->saveConfiguration([], $requestProphecy->reveal());
205 self::assertSame($expected, $this->beUserProphecy->uc);
206 $this->beUserProphecy->writeUC()->shouldHaveBeenCalled();
214 $this->beUserProphecy->getTSConfig()->willReturn(
215 [
'admPanel.' => $userTsAdmPanelConfig]