26 $this->viewHelper = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\CheckboxViewHelper', array(
'setErrorClassAttribute',
'getName',
'getValue',
'isObjectAccessorMode',
'getPropertyValue',
'registerFieldNameForFormTokenGeneration'));
27 $this->arguments[
'property'] =
'';
29 $this->viewHelper->initializeArguments();
36 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute'));
37 $mockTagBuilder->expects($this->once())->method(
'setTagName')->with(
'input');
38 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
39 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
40 $this->viewHelper->expects($this->once())->method(
'registerFieldNameForFormTokenGeneration')->with(
'foo');
41 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
43 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
44 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
45 $this->viewHelper->_set(
'tag', $mockTagBuilder);
47 $this->viewHelper->initialize();
48 $this->viewHelper->render();
55 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute'));
56 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
57 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
58 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
59 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
61 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
62 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
63 $this->viewHelper->_set(
'tag', $mockTagBuilder);
65 $this->viewHelper->initialize();
66 $this->viewHelper->render(TRUE);
73 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute'));
74 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
75 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
76 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
78 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
79 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
80 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(TRUE));
81 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(TRUE));
82 $this->viewHelper->_set(
'tag', $mockTagBuilder);
84 $this->viewHelper->initialize();
85 $this->viewHelper->render(TRUE);
86 $this->viewHelper->render(FALSE);
93 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute'));
94 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
95 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
96 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
97 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
99 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
100 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
101 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(TRUE));
102 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(TRUE));
103 $this->viewHelper->_set(
'tag', $mockTagBuilder);
105 $this->viewHelper->initialize();
106 $this->viewHelper->render();
113 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute'));
114 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
115 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo[]');
116 $this->viewHelper->expects($this->once())->method(
'registerFieldNameForFormTokenGeneration')->with(
'foo[]');
117 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
119 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
120 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
121 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(TRUE));
122 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(array()));
123 $this->viewHelper->_set(
'tag', $mockTagBuilder);
125 $this->viewHelper->initialize();
126 $this->viewHelper->render();
133 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute'));
134 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
135 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo[]');
136 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
137 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
139 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
140 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
141 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(TRUE));
142 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(array(
'foo',
'bar',
'baz')));
143 $this->viewHelper->_set(
'tag', $mockTagBuilder);
145 $this->viewHelper->initialize();
146 $this->viewHelper->render();
153 $mockTagBuilder = $this->getMock(
'TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder', array(
'setTagName',
'addAttribute'));
154 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
155 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo[]');
156 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
157 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
159 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
160 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
161 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(TRUE));
162 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(
new \ArrayObject(array(
'foo',
'bar',
'baz'))));
163 $this->viewHelper->_set(
'tag', $mockTagBuilder);
165 $this->viewHelper->initialize();
166 $this->viewHelper->render();
173 $mockTagBuilder = $this->getMock(
'TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder', array(
'setTagName',
'addAttribute'));
174 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
175 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo');
176 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value',
'bar');
177 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
179 $this->viewHelper->expects($this->any())->method(
'getName')->will($this->returnValue(
'foo'));
180 $this->viewHelper->expects($this->any())->method(
'getValue')->will($this->returnValue(
'bar'));
181 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->will($this->returnValue(TRUE));
182 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->will($this->returnValue(
new \stdClass()));
183 $this->viewHelper->_set(
'tag', $mockTagBuilder);
185 $this->viewHelper->initialize();
186 $this->viewHelper->render();
193 $mockTagBuilder = $this->getMock(
'TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder', array(
'setTagName',
'addAttribute'));
194 $mockTagBuilder->expects($this->at(1))->method(
'addAttribute')->with(
'type',
'checkbox');
195 $mockTagBuilder->expects($this->at(2))->method(
'addAttribute')->with(
'name',
'foo[]');
196 $mockTagBuilder->expects($this->at(3))->method(
'addAttribute')->with(
'value', 2);
197 $mockTagBuilder->expects($this->at(4))->method(
'addAttribute')->with(
'checked',
'checked');
199 $object1 = new \stdClass();
200 $object2 = new \stdClass();
201 $object3 = new \stdClass();
203 $this->viewHelper->expects($this->any())->method(
'getName')->willReturn(
'foo');
204 $this->viewHelper->expects($this->any())->method(
'getValue')->willReturn(2);
205 $this->viewHelper->expects($this->any())->method(
'isObjectAccessorMode')->willReturn(TRUE);
206 $this->viewHelper->expects($this->any())->method(
'getPropertyValue')->willReturn(array($object1, $object2, $object3));
207 $this->viewHelper->_set(
'tag', $mockTagBuilder);
209 $mockPersistenceManager = $this->getMock(
'TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface');
210 $mockPersistenceManager->expects($this->any())->method(
'getIdentifierByObject')->will($this->returnValueMap(array(
215 $this->viewHelper->_set(
'persistenceManager', $mockPersistenceManager);
217 $this->viewHelper->initialize();
218 $this->viewHelper->render();
225 $this->viewHelper->expects($this->once())->method(
'setErrorClassAttribute');
226 $this->viewHelper->render();
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)