17 use Prophecy\Argument;
25 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
37 $iconFactoryProphecy = $this->prophesize(IconFactory::class);
38 GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
39 $iconProphecy = $this->prophesize(Icon::class);
40 $iconProphecy->render()->shouldBeCalled()->willReturn(
'');
41 $iconFactoryProphecy->getIcon(Argument::cetera())->shouldBeCalled()->willReturn($iconProphecy->reveal());
43 $languageServiceProphecy = $this->prophesize(LanguageService::class);
44 $languageServiceProphecy->sL(Argument::cetera())->willReturnArgument(0);
45 $GLOBALS[
'LANG'] = $languageServiceProphecy->reveal();
47 $nodeFactoryProphecy = $this->prophesize(NodeFactory::class);
52 'renderType' =>
'aControl',
55 'renderType' =>
'anotherControl',
56 'after' => [
'aControl' ],
62 $aControlProphecy = $this->prophesize(AbstractNode::class);
63 $aControlProphecy->render()->willReturn(
65 'iconIdentifier' =>
'actions-open',
67 'linkAttributes' => [
'href' =>
'' ],
68 'additionalJavaScriptPost' => [
'someJavaScript' ],
69 'requireJsModules' => [
74 $aControlNodeFactoryInput = $data;
75 $aControlNodeFactoryInput[
'renderData'][
'fieldControlOptions'] = [];
76 $aControlNodeFactoryInput[
'renderType'] =
'aControl';
77 $nodeFactoryProphecy->create($aControlNodeFactoryInput)->willReturn($aControlProphecy->reveal());
79 $anotherControlProphecy = $this->prophesize(AbstractNode::class);
80 $anotherControlProphecy->render()->willReturn(
82 'iconIdentifier' =>
'actions-close',
84 'linkAttributes' => [
'href' =>
'' ],
85 'requireJsModules' => [
90 $anotherControlNodeFactoryInput = $data;
91 $anotherControlNodeFactoryInput[
'renderData'][
'fieldControlOptions'] = [];
92 $anotherControlNodeFactoryInput[
'renderType'] =
'anotherControl';
93 $nodeFactoryProphecy->create($anotherControlNodeFactoryInput)->willReturn($anotherControlProphecy->reveal());
96 'additionalJavaScriptPost' => [
99 'additionalJavaScriptSubmit' => [],
100 'additionalHiddenFields' => [],
101 'additionalInlineLanguageLabelFiles' => [],
102 'stylesheetFiles' => [],
103 'requireJsModules' => [
108 'html' =>
'\n<a class="btn btn-default">\n...>\n</a>'
110 $result = (
new FieldControl($nodeFactoryProphecy->reveal(), $data))->render();
112 $expected[
'html'] = $result[
'html'];
114 $this->assertEquals($expected, $result);