17 use Prophecy\Argument;
18 use Prophecy\Prophecy\ObjectProphecy;
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
38 protected function setUp()
40 $this->formDataGroupProphecy = $this->prophesize(FormDataGroupInterface::class);
52 $this->expectException(\InvalidArgumentException::class);
53 $this->expectExceptionCode(1440601540);
54 $this->subject->compile($input);
63 'command' =>
'unknownCommand',
65 $this->expectException(\InvalidArgumentException::class);
66 $this->expectExceptionCode(1437653136);
67 $this->subject->compile($input);
78 $this->expectException(\InvalidArgumentException::class);
79 $this->expectExceptionCode(1437654409);
80 $this->subject->compile($input);
89 'vanillaUid' =>
'foo123',
91 $this->expectException(\InvalidArgumentException::class);
92 $this->expectExceptionCode(1437654247);
93 $this->subject->compile($input);
103 'vanillaUid' => -100,
105 $this->expectException(\InvalidArgumentException::class);
106 $this->expectExceptionCode(1437654332);
107 $this->subject->compile($input);
116 'tableName' =>
'pages',
120 $this->formDataGroupProphecy->compile(Argument::cetera())->willReturnArgument(0);
121 $result = $this->subject->compile($input);
122 $this->assertEquals(
'pages', $result[
'tableName']);
123 $this->assertEquals(123, $result[
'vanillaUid']);
124 $this->assertEquals(
'edit', $result[
'command']);
132 $this->formDataGroupProphecy->compile(Argument::cetera())->will(
function ($arguments) {
133 $result = $arguments[0];
134 $result[
'databaseRow'] =
'newData';
137 $result = $this->subject->compile([]);
138 $this->assertEquals(
'newData', $result[
'databaseRow']);
146 $this->formDataGroupProphecy->compile(Argument::cetera())->willReturn(
null);
147 $this->expectException(\UnexpectedValueException::class);
148 $this->expectExceptionCode(1446664764);
149 $this->subject->compile([]);
157 $this->formDataGroupProphecy->compile(Argument::cetera())->willReturn([
158 'renderData' => [
'foo' ],
160 $this->expectException(\RuntimeException::class);
161 $this->expectExceptionCode(1485201279);
162 $this->subject->compile([]);
170 $this->formDataGroupProphecy->compile(Argument::cetera())->will(
function ($arguments) {
171 $result = $arguments[0];
172 unset($result[
'tableName']);
175 $this->expectException(\UnexpectedValueException::class);
176 $this->expectExceptionCode(1438079402);
177 $this->subject->compile([]);
185 $this->formDataGroupProphecy->compile(Argument::cetera())->will(
function ($arguments) {
186 $result = $arguments[0];
187 $result[
'newKey'] =
'newData';
190 $this->expectException(\UnexpectedValueException::class);
191 $this->expectExceptionCode(1438079402);
192 $this->subject->compile([]);