2 namespace TYPO3\CMS\Backend\Tests\Unit\Form;
17 use Prophecy\Argument;
18 use Prophecy\Prophecy\ObjectProphecy;
19 use TYPO3\CMS\Core\Tests\UnitTestCase;
40 $this->formDataGroupProphecy = $this->prophesize(FormDataGroupInterface::class);
41 $this->subject =
new FormDataCompiler($this->formDataGroupProphecy->reveal());
52 $this->setExpectedException(\InvalidArgumentException::class, $this->anything(), 1440601540);
53 $this->subject->compile($input);
62 'command' =>
'unknownCommand',
64 $this->setExpectedException(\InvalidArgumentException::class, $this->anything(), 1437653136);
65 $this->subject->compile($input);
76 $this->setExpectedException(\InvalidArgumentException::class, $this->anything(), 1437654409);
77 $this->subject->compile($input);
86 'vanillaUid' =>
'foo123',
88 $this->setExpectedException(\InvalidArgumentException::class, $this->anything(), 1437654247);
89 $this->subject->compile($input);
101 $this->setExpectedException(\InvalidArgumentException::class, $this->anything(), 1437654332);
102 $this->subject->compile($input);
111 'tableName' =>
'pages',
115 $this->formDataGroupProphecy->compile(Argument::cetera())->willReturnArgument(0);
116 $result = $this->subject->compile($input);
117 $this->assertEquals(
'pages', $result[
'tableName']);
118 $this->assertEquals(123, $result[
'vanillaUid']);
119 $this->assertEquals(
'edit', $result[
'command']);
127 $this->formDataGroupProphecy->compile(Argument::cetera())->will(
function ($arguments) {
128 $result = $arguments[0];
129 $result[
'databaseRow'] =
'newData';
132 $result = $this->subject->compile([]);
133 $this->assertEquals(
'newData', $result[
'databaseRow']);
141 $this->formDataGroupProphecy->compile(Argument::cetera())->willReturn(null);
142 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1446664764);
143 $this->subject->compile([]);
151 $this->formDataGroupProphecy->compile(Argument::cetera())->will(
function ($arguments) {
152 $result = $arguments[0];
153 unset($result[
'tableName']);
156 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1438079402);
157 $this->subject->compile([]);
165 $this->formDataGroupProphecy->compile(Argument::cetera())->will(
function ($arguments) {
166 $result = $arguments[0];
167 $result[
'newKey'] =
'newData';
170 $this->setExpectedException(\UnexpectedValueException::class, $this->anything(), 1438079402);
171 $this->subject->compile([]);