2 declare(strict_types = 1);
18 use Psr\Http\Message\ServerRequestInterface;
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
33 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
34 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
41 $this->expectException(\RuntimeException::class);
42 $this->expectExceptionCode(1489751361);
51 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
52 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
55 'context' => json_encode([
'config' =>
'' ]),
59 $this->expectException(\RuntimeException::class);
60 $this->expectExceptionCode(1489751362);
69 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
70 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
73 'context' => json_encode(
75 'config' => json_encode([
78 'hmac' =>
'anInvalidHash',
84 $this->expectException(\RuntimeException::class);
85 $this->expectExceptionCode(1489751363);
94 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
95 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
102 $this->expectException(\RuntimeException::class);
103 $this->expectExceptionCode(1489751361);
112 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
113 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
116 'context' => json_encode([
'config' =>
'' ]),
120 $this->expectException(\RuntimeException::class);
121 $this->expectExceptionCode(1489751362);
130 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
131 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
134 'context' => json_encode(
136 'config' => json_encode([
139 'hmac' =>
'anInvalidHash',
145 $this->expectException(\RuntimeException::class);
146 $this->expectExceptionCode(1489751363);
155 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
156 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
163 $this->expectException(\RuntimeException::class);
164 $this->expectExceptionCode(1489751361);
173 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
174 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
177 'context' => json_encode([
'config' =>
'' ]),
181 $this->expectException(\RuntimeException::class);
182 $this->expectExceptionCode(1489751362);
191 $requestProphecy = $this->prophesize(ServerRequestInterface::class);
192 $requestProphecy->getParsedBody()->shouldBeCalled()->willReturn(
195 'context' => json_encode(
197 'config' => json_encode([
200 'hmac' =>
'anInvalidHash',
206 $this->expectException(\RuntimeException::class);
207 $this->expectExceptionCode(1489751363);
219 $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class);
220 $backendUserProphecy->uc = [];
221 $backendUser = $backendUserProphecy->reveal();
223 $mockObject = $this->getAccessibleMock(
224 FormInlineAjaxController::class,
225 [
'getBackendUserAuthentication'],
230 $mockObject->method(
'getBackendUserAuthentication')->willReturn($backendUser);
231 $result = $mockObject->_call(
'getInlineExpandCollapseStateArray');
233 $this->assertEmpty($result);
244 $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class);
245 $backendUserProphecy->uc = [
'inlineView' => serialize([
'foo' =>
'bar'])];
246 $backendUser = $backendUserProphecy->reveal();
248 $mockObject = $this->getAccessibleMock(
249 FormInlineAjaxController::class,
250 [
'getBackendUserAuthentication'],
255 $mockObject->method(
'getBackendUserAuthentication')->willReturn($backendUser);
256 $result = $mockObject->_call(
'getInlineExpandCollapseStateArray');
258 $this->assertNotEmpty($result);