/** @test */
 public function it_should_render_a_multiple_select_element()
 {
     $categories = new Select('categories', [100 => 'Electronics', 200 => 'Video games']);
     $categories->enableMultipleSelection();
     $categories->setValue([100, 200]);
     $html = $this->renderer->renderElement($categories->buildView(), ['class' => 'js-chained']);
     $this->assertEquals('<select name="categories[]" multiple class="js-chained form-control" multiple><option value="100" selected>Electronics</option><option value="200" selected>Video games</option></select>', $html);
 }
 function it_should_render_an_element_with_choices(FormTheme $theme, Template $template)
 {
     $htmlAttributes = ['class' => 'js-highlighted'];
     $languages = new Select('languages');
     $languages->setChoices(['PHP' => 'PHP', 'CSH' => 'C#', 'JAV' => 'Java', 'SCL' => 'Scala']);
     $languages->setValue('PHP');
     $languagesView = $languages->buildView();
     $theme->loadTemplateFor($languagesView->block)->willReturn($template);
     $theme->blocks()->willReturn([]);
     $this->renderElement($languagesView, $htmlAttributes);
     $template->displayBlock($languagesView->block, ['element' => $languagesView, 'attr' => $languagesView->attributes + $htmlAttributes, 'value' => $languagesView->value, 'options' => [], 'choices' => $languagesView->choices], [])->shouldHaveBeenCalled();
 }