‪TYPO3CMS  9.5
SelectViewHelperTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use PHPUnit\Framework\Exception;
21 use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
22 use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
23 
27 class ‪SelectViewHelperTest extends ViewHelperBaseTestcase
28 {
32  protected ‪$viewHelper;
33 
34  protected function ‪setUp()
35  {
36  parent::setUp();
37  $this->arguments['name'] = '';
38  $this->arguments['sortByOptionLabel'] = false;
39  $this->viewHelper = $this->getAccessibleMock(SelectViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration', 'renderChildren']);
40  $this->tagBuilder = $this->createMock(TagBuilder::class);
41  $this->viewHelper->setTagBuilder($this->tagBuilder);
42  }
43 
47  public function ‪selectCorrectlySetsTagName()
48  {
49  $this->tagBuilder->expects($this->atLeastOnce())->method('setTagName')->with('select');
50 
51  $this->arguments['options'] = [];
52  $this->injectDependenciesIntoViewHelper($this->viewHelper);
53  $this->viewHelper->setTagBuilder($this->tagBuilder);
54  $this->viewHelper->initializeArgumentsAndRender();
55  }
56 
60  public function ‪selectCreatesExpectedOptions()
61  {
62  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
63  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
64  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value1">label1</option>' . \chr(10) . '<option value="value2" selected="selected">label2</option>' . \chr(10));
65  $this->tagBuilder->expects($this->once())->method('render');
66 
67  $this->arguments['options'] = [
68  'value1' => 'label1',
69  'value2' => 'label2'
70  ];
71  $this->arguments['value'] = 'value2';
72  $this->arguments['name'] = 'myName';
73 
74  $this->injectDependenciesIntoViewHelper($this->viewHelper);
75  $this->viewHelper->setTagBuilder($this->tagBuilder);
76  $this->viewHelper->initializeArgumentsAndRender();
77  }
78 
83  {
84  $this->tagBuilder->expects($this->exactly(2))->method('addAttribute')->withConsecutive(
85  ['required', 'required'],
86  ['name', 'myName']
87  );
88  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
89  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value1">label1</option>' . \chr(10) . '<option value="value2" selected="selected">label2</option>' . \chr(10));
90  $this->tagBuilder->expects($this->once())->method('render');
91 
92  $this->arguments['options'] = [
93  'value1' => 'label1',
94  'value2' => 'label2'
95  ];
96  $this->arguments['value'] = 'value2';
97  $this->arguments['name'] = 'myName';
98  $this->arguments['required'] = true;
99 
100  $this->injectDependenciesIntoViewHelper($this->viewHelper);
101  $this->viewHelper->setTagBuilder($this->tagBuilder);
102  $this->viewHelper->initializeArgumentsAndRender();
103  }
104 
109  {
110  $this->tagBuilder->expects($this->once())->method('setContent')->with(
111  '<option value="2"></option>' . \chr(10) .
112  '<option value="-1">Bar</option>' . \chr(10) .
113  '<option value="">Baz</option>' . \chr(10) .
114  '<option value="1">Foo</option>' . \chr(10)
115  );
116 
117  $this->arguments['optionValueField'] = 'uid';
118  $this->arguments['optionLabelField'] = 'title';
119  $this->arguments['sortByOptionLabel'] = true;
120  $this->arguments['options'] = [
121  [
122  'uid' => 1,
123  'title' => 'Foo'
124  ],
125  [
126  'uid' => -1,
127  'title' => 'Bar'
128  ],
129  [
130  'title' => 'Baz'
131  ],
132  [
133  'uid' => '2'
134  ],
135  ];
136 
137  $this->injectDependenciesIntoViewHelper($this->viewHelper);
138  $this->viewHelper->setTagBuilder($this->tagBuilder);
139  $this->viewHelper->initializeArgumentsAndRender();
140  }
141 
146  {
147  $this->tagBuilder->expects($this->once())->method('setContent')->with(
148  '<option value="2"></option>' . \chr(10) .
149  '<option value="-1">Bar</option>' . \chr(10) .
150  '<option value="">Baz</option>' . \chr(10) .
151  '<option value="1">Foo</option>' . \chr(10)
152  );
153 
154  $obj1 = new \stdClass();
155  $obj1->uid = 1;
156  $obj1->title = 'Foo';
157 
158  $obj2 = new \stdClass();
159  $obj2->uid = -1;
160  $obj2->title = 'Bar';
161 
162  $obj3 = new \stdClass();
163  $obj3->title = 'Baz';
164 
165  $obj4 = new \stdClass();
166  $obj4->uid = 2;
167 
168  $this->arguments['optionValueField'] = 'uid';
169  $this->arguments['optionLabelField'] = 'title';
170  $this->arguments['sortByOptionLabel'] = true;
171  $this->arguments['options'] = [$obj1, $obj2, $obj3, $obj4];
172 
173  $this->injectDependenciesIntoViewHelper($this->viewHelper);
174  $this->viewHelper->setTagBuilder($this->tagBuilder);
175  $this->viewHelper->initializeArgumentsAndRender();
176  }
177 
182  {
183  $this->tagBuilder->expects($this->once())->method('setContent')->with(
184  '<option value="2"></option>' . \chr(10) .
185  '<option value="-1">Bar</option>' . \chr(10) .
186  '<option value="">Baz</option>' . \chr(10) .
187  '<option value="1">Foo</option>' . \chr(10)
188  );
189 
190  $this->arguments['optionValueField'] = 'uid';
191  $this->arguments['optionLabelField'] = 'title';
192  $this->arguments['sortByOptionLabel'] = true;
193  $this->arguments['options'] = new \ArrayObject([
194  [
195  'uid' => 1,
196  'title' => 'Foo'
197  ],
198  [
199  'uid' => -1,
200  'title' => 'Bar'
201  ],
202  [
203  'title' => 'Baz'
204  ],
205  [
206  'uid' => '2'
207  ],
208  ]);
209 
210  $this->injectDependenciesIntoViewHelper($this->viewHelper);
211  $this->viewHelper->setTagBuilder($this->tagBuilder);
212  $this->viewHelper->initializeArgumentsAndRender();
213  }
214 
219  {
220  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
221  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
222  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value3">label3</option>' . \chr(10) . '<option value="value1">label1</option>' . \chr(10) . '<option value="value2" selected="selected">label2</option>' . \chr(10));
223  $this->tagBuilder->expects($this->once())->method('render');
224 
225  $this->arguments['options'] = [
226  'value3' => 'label3',
227  'value1' => 'label1',
228  'value2' => 'label2'
229  ];
230 
231  $this->arguments['value'] = 'value2';
232  $this->arguments['name'] = 'myName';
233 
234  $this->injectDependenciesIntoViewHelper($this->viewHelper);
235  $this->viewHelper->setTagBuilder($this->tagBuilder);
236  $this->viewHelper->initializeArgumentsAndRender();
237  }
238 
243  {
244  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
245  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
246  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value1">label1</option>' . \chr(10) . '<option value="value2" selected="selected">label2</option>' . \chr(10) . '<option value="value3">label3</option>' . \chr(10));
247  $this->tagBuilder->expects($this->once())->method('render');
248 
249  $this->arguments['options'] = [
250  'value3' => 'label3',
251  'value1' => 'label1',
252  'value2' => 'label2'
253  ];
254 
255  $this->arguments['value'] = 'value2';
256  $this->arguments['name'] = 'myName';
257  $this->arguments['sortByOptionLabel'] = true;
258 
259  $this->injectDependenciesIntoViewHelper($this->viewHelper);
260  $this->viewHelper->setTagBuilder($this->tagBuilder);
261  $this->viewHelper->initializeArgumentsAndRender();
262  }
263 
269  {
270  $locale = 'de_DE.UTF-8';
271  try {
272  $this->setLocale(LC_COLLATE, $locale);
273  $this->setLocale(LC_CTYPE, $locale);
274  $this->setLocale(LC_MONETARY, $locale);
275  $this->setLocale(LC_TIME, $locale);
276  } catch (Exception $e) {
277  $this->markTestSkipped('Locale ' . $locale . ' is not available.');
278  }
279 
280  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
281  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
282  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value1">Bamberg</option>' . \chr(10) . '<option value="value2" selected="selected">Bämm</option>' . \chr(10) . '<option value="value3">Bar</option>' . \chr(10) . '<option value="value4">Bär</option>' . \chr(10) . '<option value="value5">Burg</option>' . \chr(10));
283  $this->tagBuilder->expects($this->once())->method('render');
284  $this->arguments['options'] = [
285  'value4' => 'Bär',
286  'value2' => 'Bämm',
287  'value5' => 'Burg',
288  'value1' => 'Bamberg',
289  'value3' => 'Bar'
290  ];
291  $this->arguments['value'] = 'value2';
292  $this->arguments['name'] = 'myName';
293  $this->arguments['sortByOptionLabel'] = true;
294  $this->injectDependenciesIntoViewHelper($this->viewHelper);
295  $this->viewHelper->setTagBuilder($this->tagBuilder);
296  $this->viewHelper->initializeArgumentsAndRender();
297  }
298 
303  {
304  $this->tagBuilder = new TagBuilder();
305  $this->viewHelper->expects(self::exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
306 
307  $this->arguments['options'] = [
308  'value1' => 'label1',
309  'value2' => 'label2',
310  'value3' => 'label3'
311  ];
312 
313  $this->arguments['value'] = ['value3', 'value1'];
314  $this->arguments['name'] = 'myName';
315  $this->arguments['multiple'] = true;
316 
317  $this->injectDependenciesIntoViewHelper($this->viewHelper);
318  $this->viewHelper->setTagBuilder($this->tagBuilder);
319  $result = $this->viewHelper->initializeArgumentsAndRender();
320  $expected = '<input type="hidden" name="myName" value="" /><select multiple="multiple" name="myName[]"><option value="value1" selected="selected">label1</option>' . \chr(10) . '<option value="value2">label2</option>' . \chr(10) . '<option value="value3" selected="selected">label3</option>' . \chr(10) . '</select>';
321  $this->assertSame($expected, $result);
322  }
323 
328  {
329  $this->tagBuilder = new TagBuilder();
330  $this->viewHelper->expects(self::once())->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
331 
332  $this->arguments['options'] = [];
333  $this->arguments['value'] = ['value3', 'value1'];
334  $this->arguments['name'] = 'myName';
335  $this->arguments['multiple'] = true;
336 
337  $this->injectDependenciesIntoViewHelper($this->viewHelper);
338  $this->viewHelper->setTagBuilder($this->tagBuilder);
339  $result = $this->viewHelper->initializeArgumentsAndRender();
340  $expected = '<input type="hidden" name="myName" value="" /><select multiple="multiple" name="myName[]"></select>';
341  self::assertSame($expected, $result);
342  }
343 
348  {
349  $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
350  $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue(2));
351  $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
352 
353  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName[__identity]');
354  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName[__identity]');
355  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="1">Ingmar</option>' . \chr(10) . '<option value="2" selected="selected">Sebastian</option>' . \chr(10) . '<option value="3">Robert</option>' . \chr(10));
356  $this->tagBuilder->expects($this->once())->method('render');
357 
358  $user_is = new UserDomainClass(1, 'Ingmar', 'Schlecht');
359  $user_sk = new UserDomainClass(2, 'Sebastian', 'Kurfuerst');
360  $user_rl = new UserDomainClass(3, 'Robert', 'Lemke');
361 
362  $this->arguments['options'] = [
363  $user_is,
364  $user_sk,
365  $user_rl
366  ];
367 
368  $this->arguments['value'] = $user_sk;
369  $this->arguments['optionValueField'] = 'id';
370  $this->arguments['optionLabelField'] = 'firstName';
371  $this->arguments['name'] = 'myName';
372  $this->injectDependenciesIntoViewHelper($this->viewHelper);
373  $this->viewHelper->setTagBuilder($this->tagBuilder);
374  $this->viewHelper->initializeArgumentsAndRender();
375  }
376 
381  {
382  $this->tagBuilder = new TagBuilder();
383  $this->viewHelper->expects($this->exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
384 
385  $user_is = new UserDomainClass(1, 'Ingmar', 'Schlecht');
386  $user_sk = new UserDomainClass(2, 'Sebastian', 'Kurfuerst');
387  $user_rl = new UserDomainClass(3, 'Robert', 'Lemke');
388  $this->arguments['options'] = [
389  $user_is,
390  $user_sk,
391  $user_rl
392  ];
393  $this->arguments['value'] = [$user_rl, $user_is];
394  $this->arguments['optionValueField'] = 'id';
395  $this->arguments['optionLabelField'] = 'lastName';
396  $this->arguments['name'] = 'myName';
397  $this->arguments['multiple'] = true;
398 
399  $this->injectDependenciesIntoViewHelper($this->viewHelper);
400  $this->viewHelper->setTagBuilder($this->tagBuilder);
401  $actual = $this->viewHelper->initializeArgumentsAndRender();
402  $expected = '<input type="hidden" name="myName" value="" /><select multiple="multiple" name="myName[]"><option value="1" selected="selected">Schlecht</option>' . \chr(10) .
403  '<option value="2">Kurfuerst</option>' . \chr(10) .
404  '<option value="3" selected="selected">Lemke</option>' . \chr(10) .
405  '</select>';
406 
407  $this->assertSame($expected, $actual);
408  }
409 
414  {
416  $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
417  $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnCallback(
418  function ($object) {
419  return $object->getId();
420  }
421  ));
422  $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
423 
424  $this->tagBuilder = new TagBuilder();
425  $this->viewHelper->expects($this->exactly(3))->method('registerFieldNameForFormTokenGeneration')->with('myName[]');
426 
427  $user_is = new UserDomainClass(1, 'Ingmar', 'Schlecht');
428  $user_sk = new UserDomainClass(2, 'Sebastian', 'Kurfuerst');
429  $user_rl = new UserDomainClass(3, 'Robert', 'Lemke');
430 
431  $this->arguments['options'] = [$user_is, $user_sk, $user_rl];
432  $this->arguments['value'] = [$user_rl, $user_is];
433  $this->arguments['optionLabelField'] = 'lastName';
434  $this->arguments['name'] = 'myName';
435  $this->arguments['multiple'] = true;
436 
437  $this->injectDependenciesIntoViewHelper($this->viewHelper);
438  $this->viewHelper->setTagBuilder($this->tagBuilder);
439  $actual = $this->viewHelper->initializeArgumentsAndRender();
440  $expected = '<input type="hidden" name="myName" value="" />' .
441  '<select multiple="multiple" name="myName[]">' .
442  '<option value="1" selected="selected">Schlecht</option>' . \chr(10) .
443  '<option value="2">Kurfuerst</option>' . \chr(10) .
444  '<option value="3" selected="selected">Lemke</option>' . \chr(10) .
445  '</select>';
446  $this->assertSame($expected, $actual);
447  }
448 
453  {
454  $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
455  $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue('fakeUID'));
456  $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
457 
458  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
459  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
460  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="fakeUID">fakeUID</option>' . \chr(10));
461  $this->tagBuilder->expects($this->once())->method('render');
462 
463  $user = new UserDomainClass(1, 'Ingmar', 'Schlecht');
464 
465  $this->arguments['options'] = [
466  $user
467  ];
468  $this->arguments['name'] = 'myName';
469  $this->injectDependenciesIntoViewHelper($this->viewHelper);
470  $this->viewHelper->setTagBuilder($this->tagBuilder);
471  $this->viewHelper->initializeArgumentsAndRender();
472  }
473 
478  {
479  $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
480  $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue('fakeUID'));
481  $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
482 
483  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
484  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
485  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="fakeUID">toStringResult</option>' . \chr(10));
486  $this->tagBuilder->expects($this->once())->method('render');
487 
488  $user = $this->getMockBuilder(UserDomainClass::class)
489  ->setMethods(['__toString'])
490  ->setConstructorArgs([1, 'Ingmar', 'Schlecht'])
491  ->getMock();
492  $user->expects($this->atLeastOnce())->method('__toString')->will($this->returnValue('toStringResult'));
493 
494  $this->arguments['options'] = [
495  $user
496  ];
497  $this->arguments['name'] = 'myName';
498  $this->injectDependenciesIntoViewHelper($this->viewHelper);
499  $this->viewHelper->setTagBuilder($this->tagBuilder);
500  $this->viewHelper->initializeArgumentsAndRender();
501  }
502 
507  {
508  $mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
509  $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue(null));
510  $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
511 
512  $this->expectException(\‪TYPO3Fluid\Fluid\Core\ViewHelper\Exception::class);
513  $this->expectExceptionCode(1247826696);
514 
515  $user = new UserDomainClass(1, 'Ingmar', 'Schlecht');
516 
517  $this->arguments['options'] = [
518  $user
519  ];
520  $this->arguments['name'] = 'myName';
521  $this->injectDependenciesIntoViewHelper($this->viewHelper);
522  $this->viewHelper->setTagBuilder($this->tagBuilder);
523  $this->viewHelper->initializeArgumentsAndRender();
524  }
525 
529  public function ‪renderCallsSetErrorClassAttribute()
530  {
531  $this->arguments['options'] = [];
532 
533  $this->injectDependenciesIntoViewHelper($this->viewHelper);
534  $this->viewHelper->setTagBuilder($this->tagBuilder);
535  $this->viewHelper->expects($this->once())->method('setErrorClassAttribute');
536  $this->viewHelper->initializeArgumentsAndRender();
537  }
538 
543  {
544  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value1" selected="selected">label1</option>' . \chr(10) . '<option value="value2" selected="selected">label2</option>' . \chr(10) . '<option value="value3" selected="selected">label3</option>' . \chr(10));
545 
546  $this->arguments['options'] = [
547  'value1' => 'label1',
548  'value2' => 'label2',
549  'value3' => 'label3'
550  ];
551  $this->arguments['name'] = 'myName';
552  $this->arguments['multiple'] = true;
553  $this->arguments['selectAllByDefault'] = true;
554 
555  $this->injectDependenciesIntoViewHelper($this->viewHelper);
556  $this->viewHelper->setTagBuilder($this->tagBuilder);
557  $this->viewHelper->initializeArgumentsAndRender();
558  }
559 
563  public function ‪selectAllHasNoEffectIfValueIsSet()
564  {
565  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="value1" selected="selected">label1</option>' . \chr(10) . '<option value="value2" selected="selected">label2</option>' . \chr(10) . '<option value="value3">label3</option>' . \chr(10));
566 
567  $this->arguments['options'] = [
568  'value1' => 'label1',
569  'value2' => 'label2',
570  'value3' => 'label3'
571  ];
572  $this->arguments['value'] = ['value2', 'value1'];
573  $this->arguments['name'] = 'myName';
574  $this->arguments['multiple'] = true;
575  $this->arguments['selectAllByDefault'] = true;
576 
577  $this->injectDependenciesIntoViewHelper($this->viewHelper);
578  $this->viewHelper->setTagBuilder($this->tagBuilder);
579  $this->viewHelper->initializeArgumentsAndRender();
580  }
581 
586  {
587  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
588  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
589  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="">please choose</option>' . \chr(10) . '<option value="value1">label1</option>' . \chr(10) . '<option value="value2">label2</option>' . \chr(10) . '<option value="value3">label3</option>' . \chr(10));
590  $this->tagBuilder->expects($this->once())->method('render');
591  $this->arguments['options'] = [
592  'value1' => 'label1',
593  'value2' => 'label2',
594  'value3' => 'label3'
595  ];
596  $this->arguments['name'] = 'myName';
597  $this->arguments['prependOptionLabel'] = 'please choose';
598  $this->injectDependenciesIntoViewHelper($this->viewHelper);
599  $this->viewHelper->setTagBuilder($this->tagBuilder);
600  $this->viewHelper->initializeArgumentsAndRender();
601  }
602 
607  {
608  $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
609  $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
610  $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="-1">please choose</option>' . \chr(10) . '<option value="value1">label1</option>' . \chr(10) . '<option value="value2">label2</option>' . \chr(10) . '<option value="value3">label3</option>' . \chr(10));
611  $this->tagBuilder->expects($this->once())->method('render');
612  $this->arguments['options'] = [
613  'value1' => 'label1',
614  'value2' => 'label2',
615  'value3' => 'label3'
616  ];
617  $this->arguments['name'] = 'myName';
618  $this->arguments['prependOptionLabel'] = 'please choose';
619  $this->arguments['prependOptionValue'] = '-1';
620  $this->injectDependenciesIntoViewHelper($this->viewHelper);
621  $this->viewHelper->setTagBuilder($this->tagBuilder);
622  $this->viewHelper->initializeArgumentsAndRender();
623  }
624 }
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\optionsContainPrependedItemWithEmptyValueIfPrependOptionLabelIsSet
‪optionsContainPrependedItemWithEmptyValueIfPrependOptionLabelIsSet()
Definition: SelectViewHelperTest.php:584
‪TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
Definition: PersistenceManagerInterface.php:21
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectCorrectlySetsTagName
‪selectCorrectlySetsTagName()
Definition: SelectViewHelperTest.php:46
‪TYPO3Fluid
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest
Definition: SelectViewHelperTest.php:28
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectShouldSetTheRequiredAttribute
‪selectShouldSetTheRequiredAttribute()
Definition: SelectViewHelperTest.php:81
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\OrderOfOptionsIsNotAlteredByDefault
‪OrderOfOptionsIsNotAlteredByDefault()
Definition: SelectViewHelperTest.php:217
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\allOptionsAreSelectedIfSelectAllIsTrue
‪allOptionsAreSelectedIfSelectAllIsTrue()
Definition: SelectViewHelperTest.php:541
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectCreatesExpectedOptionsWithStdClassesAndOptionValueFieldAndOptionLabelFieldSet
‪selectCreatesExpectedOptionsWithStdClassesAndOptionValueFieldAndOptionLabelFieldSet()
Definition: SelectViewHelperTest.php:144
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectWithoutFurtherConfigurationOnDomainObjectsUsesUuidForValueAndLabel
‪selectWithoutFurtherConfigurationOnDomainObjectsUsesUuidForValueAndLabel()
Definition: SelectViewHelperTest.php:451
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\multipleSelectCreatesExpectedOptions
‪multipleSelectCreatesExpectedOptions()
Definition: SelectViewHelperTest.php:301
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\multipleSelectWithoutOptionsCreatesExpectedOptions
‪multipleSelectWithoutOptionsCreatesExpectedOptions()
Definition: SelectViewHelperTest.php:326
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\multipleSelectOnDomainObjectsCreatesExpectedOptionsWithoutOptionValueField
‪multipleSelectOnDomainObjectsCreatesExpectedOptionsWithoutOptionValueField()
Definition: SelectViewHelperTest.php:412
‪TYPO3\CMS\Fluid\ViewHelpers\Form\SelectViewHelper
Definition: SelectViewHelper.php:91
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\optionsAreSortedByLabelIfSortByOptionLabelIsSet
‪optionsAreSortedByLabelIfSortByOptionLabelIsSet()
Definition: SelectViewHelperTest.php:241
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectOnDomainObjectsThrowsExceptionIfNoValueCanBeFound
‪selectOnDomainObjectsThrowsExceptionIfNoValueCanBeFound()
Definition: SelectViewHelperTest.php:505
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectCreatesExpectedOptionsWithArraysAndOptionValueFieldAndOptionLabelFieldSet
‪selectCreatesExpectedOptionsWithArraysAndOptionValueFieldAndOptionLabelFieldSet()
Definition: SelectViewHelperTest.php:107
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form
Definition: AbstractFormFieldViewHelperTest.php:2
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\setUp
‪setUp()
Definition: SelectViewHelperTest.php:33
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\$viewHelper
‪SelectViewHelper $viewHelper
Definition: SelectViewHelperTest.php:31
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\multipleSelectOnDomainObjectsCreatesExpectedOptions
‪multipleSelectOnDomainObjectsCreatesExpectedOptions()
Definition: SelectViewHelperTest.php:379
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectOnDomainObjectsCreatesExpectedOptions
‪selectOnDomainObjectsCreatesExpectedOptions()
Definition: SelectViewHelperTest.php:346
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectAllHasNoEffectIfValueIsSet
‪selectAllHasNoEffectIfValueIsSet()
Definition: SelectViewHelperTest.php:562
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\optionsContainPrependedItemWithCorrectValueIfPrependOptionLabelAndPrependOptionValueAreSet
‪optionsContainPrependedItemWithCorrectValueIfPrependOptionLabelAndPrependOptionValueAreSet()
Definition: SelectViewHelperTest.php:605
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\UserDomainClass
Definition: UserDomainClass.php:21
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\optionsAreSortedByLabelIfSortByOptionLabelIsSetAndLocaleEqualsUtf8
‪optionsAreSortedByLabelIfSortByOptionLabelIsSetAndLocaleEqualsUtf8()
Definition: SelectViewHelperTest.php:267
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\renderCallsSetErrorClassAttribute
‪renderCallsSetErrorClassAttribute()
Definition: SelectViewHelperTest.php:528
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectWithoutFurtherConfigurationOnDomainObjectsUsesToStringForLabelIfAvailable
‪selectWithoutFurtherConfigurationOnDomainObjectsUsesToStringForLabelIfAvailable()
Definition: SelectViewHelperTest.php:476
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectCreatesExpectedOptions
‪selectCreatesExpectedOptions()
Definition: SelectViewHelperTest.php:59
‪TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\SelectViewHelperTest\selectCreatesExpectedOptionsWithArrayObjectsAndOptionValueFieldAndOptionLabelFieldSet
‪selectCreatesExpectedOptionsWithArrayObjectsAndOptionValueFieldAndOptionLabelFieldSet()
Definition: SelectViewHelperTest.php:180