* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests; abstract class AbstractBootstrap3HorizontalLayoutTest extends AbstractBootstrap3LayoutTest { public function testLabelOnForm() { $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType'); $view = $form->createView(); $this->renderWidget($view, array('label' => 'foo')); $html = $this->renderLabel($view); $this->assertMatchesXpath($html, '/label [@class="col-sm-2 control-label required"] [.="[trans]Name[/trans]"] ' ); } public function testLabelDoesNotRenderFieldAttributes() { $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType'); $html = $this->renderLabel($form->createView(), null, array( 'attr' => array( 'class' => 'my&class', ), )); $this->assertMatchesXpath($html, '/label [@for="name"] [@class="col-sm-2 control-label required"] ' ); } public function testLabelWithCustomAttributesPassedDirectly() { $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType'); $html = $this->renderLabel($form->createView(), null, array( 'label_attr' => array( 'class' => 'my&class', ), )); $this->assertMatchesXpath($html, '/label [@for="name"] [@class="my&class col-sm-2 control-label required"] ' ); } public function testLabelWithCustomTextAndCustomAttributesPassedDirectly() { $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType'); $html = $this->renderLabel($form->createView(), 'Custom label', array( 'label_attr' => array( 'class' => 'my&class', ), )); $this->assertMatchesXpath($html, '/label [@for="name"] [@class="my&class col-sm-2 control-label required"] [.="[trans]Custom label[/trans]"] ' ); } public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly() { $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array( 'label' => 'Custom label', )); $html = $this->renderLabel($form->createView(), null, array( 'label_attr' => array( 'class' => 'my&class', ), )); $this->assertMatchesXpath($html, '/label [@for="name"] [@class="my&class col-sm-2 control-label required"] [.="[trans]Custom label[/trans]"] ' ); } public function testStartTag() { $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( 'method' => 'get', 'action' => 'http://example.com/directory', )); $html = $this->renderStart($form->createView()); $this->assertSame('
', $html); } public function testStartTagWithOverriddenVars() { $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( 'method' => 'put', 'action' => 'http://example.com/directory', )); $html = $this->renderStart($form->createView(), array( 'method' => 'post', 'action' => 'http://foo.com/directory', )); $this->assertSame('', $html); } public function testStartTagForMultipartForm() { $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( 'method' => 'get', 'action' => 'http://example.com/directory', )) ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType') ->getForm(); $html = $this->renderStart($form->createView()); $this->assertSame('', $html); } public function testStartTagWithExtraAttributes() { $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( 'method' => 'get', 'action' => 'http://example.com/directory', )); $html = $this->renderStart($form->createView(), array( 'attr' => array('class' => 'foobar'), )); $this->assertSame('', $html); } public function testCheckboxRow() { $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType'); $view = $form->createView(); $html = $this->renderRow($view, array('label' => 'foo')); $this->assertMatchesXpath($html, '/div[@class="form-group"]/div[@class="col-sm-2" or @class="col-sm-10"]', 2); } } __halt_compiler();----SIGNATURE:----FJPhlZLrDjE0MUqZn5VrqazwznZV2G112T8y6zybUD8AzD/ebzrm8H+S4ro9nU1J93trYKPnVNrK6uvrc1L8GpbXvhouB8WSYKeEqbIqHRqLj5kodhl/1sEPvDCn8EdC4w7eU5ArEL01fqaGRKl4KXzz0D84+bRy5cp3WSrPqkX19fwUcyuaOg7izjFihD0d/fd0SsXYeVG33BMkEAVY1qk9OkUuXcGscT4vIZzmedO3FEaAZv2yBWmiLqzm9pRwb0Spn9h+fsE65DAmchuTSY9eP2YnGGdi67YDuzOZ9eQSSZzaPc7pdFoyjOSeyEqIDbURCEx85tU91bUVvIDUkVDkxWFYb1SWirCivERO+cOB6q/T3O/w1Z8/rezLq6GjLiPBlnn8tzH963Z2/i2qbcmJvZH3iPpix4iXwoTDt7Lapx00hoDrycFMyvyNjxe9/ISKRvUZX0oikv1fIDQMs27qZOcUUpnyqVFQOPxlaqOwGRnNlkqXTU0CfCOMgoZBcF2NI1TOxFhPuJBehlxXHgf8FsWDSjBhkJTBVdwfxIOpMyYa2ViujkORCZGVnMWaPJM1pywifCXzeofJ+98FgkxBO244gnN0f+M9DS4pFevys+4rXEIdmnfrfBEPCnrWIDFrShL/pPtZbXjsmHrhHHf0Gkxw0/X1vqwBaibGesg=----ATTACHMENT:----NTU5ODAxMTEwODIzOTc2OCA4MTA3OTY4MjM3MjY1Mzk3IDQwNDc5NzYzODAyNDkxMzU=