17 use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
29 protected function setUp()
32 $this->viewHelper = $this->getAccessibleMock(TextareaViewHelper::class, [
'setErrorClassAttribute',
'registerFieldNameForFormTokenGeneration']);
33 $this->arguments[
'name'] =
'';
42 $mockTagBuilder = $this->getMockBuilder(TagBuilder::class)
43 ->setMethods([
'setTagName'])
44 ->disableOriginalConstructor()
46 $mockTagBuilder->expects($this->atLeastOnce())->method(
'setTagName')->with(
'textarea');
47 $this->viewHelper->setTagBuilder($mockTagBuilder);
49 $this->viewHelper->initializeArgumentsAndRender();
58 'name' =>
'NameOfTextarea',
59 'value' =>
'Current value'
61 $this->viewHelper->setArguments($arguments);
63 $this->viewHelper->setViewHelperNode(
new Fixtures\EmptySyntaxTreeNode());
64 $actual = $this->viewHelper->initializeArgumentsAndRender();
65 $expected =
'<textarea name="NameOfTextarea">Current value</textarea>';
66 $this->assertSame($expected, $actual);
74 $this->viewHelper->expects($this->once())->method(
'setErrorClassAttribute');
75 $this->viewHelper->render();
84 'name' =>
'NameOfTextarea',
85 'value' =>
'some <tag> & "quotes"'
87 $this->viewHelper->setArguments($arguments);
89 $this->viewHelper->setViewHelperNode(
new Fixtures\EmptySyntaxTreeNode());
90 $actual = $this->viewHelper->initializeArgumentsAndRender();
91 $expected =
'<textarea name="NameOfTextarea">some <tag> & "quotes"</textarea>';
92 $this->assertSame($expected, $actual);
101 'name' =>
'NameOfTextarea',
102 'placeholder' =>
'SomePlaceholder'
104 $this->viewHelper->setArguments($arguments);
106 $this->viewHelper->setViewHelperNode(
new Fixtures\EmptySyntaxTreeNode());
107 $actual = $this->viewHelper->initializeArgumentsAndRender();
108 $expected =
'<textarea placeholder="SomePlaceholder" name="NameOfTextarea"></textarea>';
109 $this->assertSame($expected, $actual);
119 'name' =>
'NameOfTextarea',
121 $this->viewHelper->setArguments($arguments);
123 $this->viewHelper->setViewHelperNode(
new Fixtures\EmptySyntaxTreeNode());
124 $actual = $this->viewHelper->initializeArgumentsAndRender();
125 $expected =
'<textarea readonly="foo" name="NameOfTextarea"></textarea>';
126 $this->assertSame($expected, $actual);
136 'name' =>
'NameOfTextarea',
138 $this->viewHelper->setArguments($arguments);
140 $this->viewHelper->setViewHelperNode(
new Fixtures\EmptySyntaxTreeNode());
141 $actual = $this->viewHelper->initializeArgumentsAndRender();
142 $expected =
'<textarea name="NameOfTextarea" required="required"></textarea>';
143 $this->assertSame($expected, $actual);