2 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form;
29 $this->viewHelper = $this->getAccessibleMock(RadioViewHelper::class, array(
'setErrorClassAttribute',
'getName',
'getValueAttribute',
'isObjectAccessorMode',
'getPropertyValue',
'registerFieldNameForFormTokenGeneration'));
31 $this->viewHelper->initializeArguments();
39 $mockTagBuilder = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\TagBuilder::class, array(
'setTagName',
'addAttribute'));
40 $mockTagBuilder->expects($this->once())->method(
'setTagName')->with(
'input');
41 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'radio');
42 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
43 $this->viewHelper->expects($this->once())->method(
'registerFieldNameForFormTokenGeneration')->with(
'foo');
44 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
46 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
47 $this->viewHelper->expects($this->any())->method(
'getValueAttribute')->will($this->returnValue(
'bar'));
48 $this->viewHelper->_set(
'tag', $mockTagBuilder);
50 $this->viewHelper->initialize();
51 $this->viewHelper->render();
59 $mockTagBuilder = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\TagBuilder::class, array(
'setTagName',
'addAttribute'));
60 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'radio');
61 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
62 $this->viewHelper->expects($this->once())->method(
'registerFieldNameForFormTokenGeneration')->with(
'foo');
63 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
64 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
66 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
67 $this->viewHelper->expects($this->any())->method(
'getValueAttribute')->will($this->returnValue(
'bar'));
68 $this->viewHelper->_set(
'tag', $mockTagBuilder);
70 $this->viewHelper->initialize();
71 $this->viewHelper->render(
true);
79 $mockTagBuilder = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\TagBuilder::class, array(
'setTagName',
'addAttribute'));
80 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'radio');
81 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
82 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
84 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
85 $this->viewHelper->expects($this->any())->method(
'getValueAttribute')->will($this->returnValue(
'bar'));
86 $this->viewHelper->expects($this->never())->method(
'isObjectAccessorMode')->will($this->returnValue(
true));
87 $this->viewHelper->expects($this->never())->method(
'getPropertyValue')->will($this->returnValue(
true));
88 $this->viewHelper->_set(
'tag', $mockTagBuilder);
90 $this->viewHelper->initialize();
91 $this->viewHelper->render(
true);
92 $this->viewHelper->render(
false);
100 $mockTagBuilder = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\TagBuilder::class, array(
'setTagName',
'addAttribute'));
101 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'radio');
102 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
103 $this->viewHelper->expects($this->once())->method(
'registerFieldNameForFormTokenGeneration')->with(
'foo');
104 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
105 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
107 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
108 $this->viewHelper->expects($this->any())->method(
'getValueAttribute')->will($this->returnValue(
'bar'));
109 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(
true));
110 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(
true));
111 $this->viewHelper->_set(
'tag', $mockTagBuilder);
113 $this->viewHelper->initialize();
114 $this->viewHelper->render();
122 $mockTagBuilder = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\TagBuilder::class, array(
'setTagName',
'addAttribute'));
123 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'radio');
124 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
125 $this->viewHelper->expects($this->once())->method(
'registerFieldNameForFormTokenGeneration')->with(
'foo');
126 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
128 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
129 $this->viewHelper->expects($this->any())->method(
'getValueAttribute')->will($this->returnValue(
'bar'));
130 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(
true));
131 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(array()));
132 $this->viewHelper->_set(
'tag', $mockTagBuilder);
134 $this->viewHelper->initialize();
135 $this->viewHelper->render();
143 $mockTagBuilder = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\TagBuilder::class, array(
'setTagName',
'addAttribute'));
144 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'radio');
145 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
146 $this->viewHelper->expects($this->once())->method(
'registerFieldNameForFormTokenGeneration')->with(
'foo');
147 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
148 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
150 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
151 $this->viewHelper->expects($this->any())->method(
'getValueAttribute')->will($this->returnValue(
'bar'));
152 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(
true));
153 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(
'bar'));
154 $this->viewHelper->_set(
'tag', $mockTagBuilder);
156 $this->viewHelper->initialize();
157 $this->viewHelper->render();
165 $this->viewHelper->expects($this->once())->method(
'setErrorClassAttribute');
166 $this->viewHelper->render();