2 declare(strict_types = 1);
18 use Prophecy\Argument;
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
36 $nodeFactoryProphecy = $this->prophesize(NodeFactory::class);
37 $singleFieldContainerProphecy = $this->prophesize(SingleFieldContainer::class);
38 $singleFieldContainerReturn = [
39 'additionalJavaScriptPost' => [],
40 'additionalJavaScriptSubmit' => [],
41 'additionalHiddenFields' => [],
42 'additionalInlineLanguageLabelFiles' => [],
43 'stylesheetFiles' => [],
44 'requireJsModules' => [],
46 'html' =>
'aFieldRenderedHtml',
48 $singleFieldContainerProphecy->render(Argument::cetera())->shouldBeCalled()->willReturn($singleFieldContainerReturn);
50 $labelReference =
'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
52 'tableName' =>
'aTable',
53 'recordTypeValue' =>
'aType',
60 'showitem' =>
'aField',
65 '--palette--;' . $labelReference .
';aPalette',
69 $languageService = $this->prophesize(LanguageService::class);
70 $GLOBALS[
'LANG'] = $languageService->reveal();
71 $backendUserAuthentication = $this->prophesize(BackendUserAuthentication::class);
72 $GLOBALS[
'BE_USER'] = $backendUserAuthentication->reveal();
73 $languageService->loadSingleTableDescription(Argument::cetera())->willReturn(
'');
76 $languageService->sL($labelReference)->willReturnArgument(0);
78 $expectedChildDataArray = $input;
79 $expectedChildDataArray[
'renderType'] =
'singleFieldContainer';
80 $expectedChildDataArray[
'fieldName'] =
'aField';
82 $nodeFactoryProphecy->create($expectedChildDataArray)->willReturn($singleFieldContainerProphecy->reveal());
85 $this->assertContains($labelReference, $containerResult[
'html']);
93 $nodeFactoryProphecy = $this->prophesize(NodeFactory::class);
94 $singleFieldContainerProphecy = $this->prophesize(SingleFieldContainer::class);
95 $singleFieldContainerReturn = [
96 'additionalJavaScriptPost' => [],
97 'additionalJavaScriptSubmit' => [],
98 'additionalHiddenFields' => [],
99 'additionalInlineLanguageLabelFiles' => [],
100 'stylesheetFiles' => [],
101 'requireJsModules' => [],
103 'html' =>
'aFieldRenderedHtml',
105 $singleFieldContainerProphecy->render(Argument::cetera())->shouldBeCalled()->willReturn($singleFieldContainerReturn);
107 $labelReference =
'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
109 'tableName' =>
'aTable',
110 'recordTypeValue' =>
'aType',
117 'label' => $labelReference,
118 'showitem' =>
'aField',
123 '--palette--;;aPalette',
127 $languageService = $this->prophesize(LanguageService::class);
128 $GLOBALS[
'LANG'] = $languageService->reveal();
129 $backendUserAuthentication = $this->prophesize(BackendUserAuthentication::class);
130 $GLOBALS[
'BE_USER'] = $backendUserAuthentication->reveal();
131 $languageService->loadSingleTableDescription(Argument::cetera())->willReturn(
'');
134 $languageService->sL($labelReference)->willReturnArgument(0);
136 $expectedChildDataArray = $input;
137 $expectedChildDataArray[
'renderType'] =
'singleFieldContainer';
138 $expectedChildDataArray[
'fieldName'] =
'aField';
140 $nodeFactoryProphecy->create($expectedChildDataArray)->willReturn($singleFieldContainerProphecy->reveal());
143 $this->assertContains($labelReference, $containerResult[
'html']);
151 $nodeFactoryProphecy = $this->prophesize(NodeFactory::class);
152 $singleFieldContainerProphecy = $this->prophesize(SingleFieldContainer::class);
153 $singleFieldContainerReturn = [
154 'additionalJavaScriptPost' => [],
155 'additionalJavaScriptSubmit' => [],
156 'additionalHiddenFields' => [],
157 'additionalInlineLanguageLabelFiles' => [],
158 'stylesheetFiles' => [],
159 'requireJsModules' => [],
161 'html' =>
'aFieldRenderedHtml',
163 $singleFieldContainerProphecy->render(Argument::cetera())->shouldBeCalled()->willReturn($singleFieldContainerReturn);
165 $labelReferenceFieldArray =
'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
166 $labelReferencePaletteArray =
'LLL:EXT:Resources/Private/Language/locallang.xlf:aLabel';
168 'tableName' =>
'aTable',
169 'recordTypeValue' =>
'aType',
176 'label' => $labelReferencePaletteArray,
177 'showitem' =>
'aField',
182 '--palette--;' . $labelReferenceFieldArray .
';aPalette',
186 $languageService = $this->prophesize(LanguageService::class);
187 $GLOBALS[
'LANG'] = $languageService->reveal();
188 $backendUserAuthentication = $this->prophesize(BackendUserAuthentication::class);
189 $GLOBALS[
'BE_USER'] = $backendUserAuthentication->reveal();
190 $languageService->loadSingleTableDescription(Argument::cetera())->willReturn(
'');
193 $languageService->sL($labelReferenceFieldArray)->willReturnArgument(0);
195 $expectedChildDataArray = $input;
196 $expectedChildDataArray[
'renderType'] =
'singleFieldContainer';
197 $expectedChildDataArray[
'fieldName'] =
'aField';
199 $nodeFactoryProphecy->create($expectedChildDataArray)->willReturn($singleFieldContainerProphecy->reveal());
202 $this->assertContains($labelReferenceFieldArray, $containerResult[
'html']);