$html =
$this->
renderStart($form->
createView(),
[ 'attr' =>
['class' => 'foobar'
],
]);
$this->
assertSame('<form name="form" method="get" action="http://example.com/directory" class="foobar form-horizontal">',
$html);
} public function testCheckboxRow() { $form =
$this->factory->
createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType'
);
$view =
$form->
createView();
$html =
$this->
renderRow($view,
['label' => 'foo'
]);
$this->
assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2
);
} public function testCheckboxRowWithHelp() { $form =
$this->factory->
createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType'
);
$html =
$this->
renderRow($form->
createView(),
['label' => 'foo', 'help' => 'really helpful text'
]);
$this->
assertMatchesXpath($html,
'/div
[@class="form-group"]
[
./div[@class="col-sm-2" or @class="col-sm-10"]
/following-sibling::div[@class="col-sm-2" or @class="col-sm-10"]
[
./span[text() = "[trans]really helpful text[/trans]"]
]
]
'