Beispiel #1
0
 /**
  * @test
  */
 public function selectAllHasNoEffectIfValueIsSet()
 {
     $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));
     $this->arguments['options'] = array('value1' => 'label1', 'value2' => 'label2', 'value3' => 'label3');
     $this->arguments['value'] = array('value2', 'value1');
     $this->arguments['name'] = 'myName';
     $this->arguments['multiple'] = 'multiple';
     $this->arguments['selectAllByDefault'] = TRUE;
     $this->injectDependenciesIntoViewHelper($this->viewHelper);
     $this->viewHelper->initialize();
     $this->viewHelper->render();
 }
 /**
  * @test
  */
 public function prependedOptionLabelIsTranslatedIfTranslateArgumentIsSet()
 {
     $this->tagBuilder->expects($this->once())->method('addAttribute')->with('name', 'myName');
     $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('myName');
     $this->tagBuilder->expects($this->once())->method('setContent')->with('<option value="">translated label</option>' . chr(10));
     $this->tagBuilder->expects($this->once())->method('render');
     $this->arguments['options'] = array();
     $this->arguments['name'] = 'myName';
     $this->arguments['prependOptionLabel'] = 'select';
     $this->arguments['translate'] = array('by' => 'id', 'using' => 'label');
     $mockTranslator = $this->getMock('TYPO3\\Flow\\I18n\\Translator');
     $mockTranslator->expects($this->at(0))->method('translateById')->with('select', array(), NULL, NULL, 'Main', '')->will($this->returnValue('translated label'));
     $this->viewHelper->_set('translator', $mockTranslator);
     $this->injectDependenciesIntoViewHelper($this->viewHelper);
     $this->viewHelper->initialize();
     $this->viewHelper->render();
 }
 /**
  * Initialize arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('disableOptions', 'array', 'Array whose values specify keys of the "options" argument which should get disabled.', FALSE);
 }