コード例 #1
0
 function it_should_render_a_form_row(BlockOptions $blockOptions, FormTheme $theme, Template $template)
 {
     $username = new Text('username');
     $username->setValue('john.doe');
     $username->setMessages(['User "john.doe" does not exist.']);
     $options = ['attr' => ['class' => 'inline-element'], 'label' => 'Username', 'label_attr' => ['class' => 'inline-label']];
     $usernameView = $username->buildView();
     $processedOptions = ['element' => $usernameView, 'isValid' => $usernameView->isValid, 'attr' => $usernameView->attributes + $options['attr'], 'options' => [], 'label' => $options['label'], 'label_attr' => $options['label_attr']];
     $theme->loadTemplateFor($usernameView->rowBlock)->willReturn($template);
     $theme->blocks()->willReturn([]);
     $blockOptions->process($usernameView, $options)->willReturn($processedOptions);
     $this->renderRow($usernameView, $options);
     $template->displayBlock($usernameView->rowBlock, $processedOptions, [])->shouldHaveBeenCalled();
 }
コード例 #2
0
 /**
  * @param $value
  */
 public function setValue($value)
 {
     $this->amount->setValue($value);
     $this->value = ['amount' => $this->amount->value(), 'currency' => $this->currency];
 }