[template] fixed test failure introduted from #8585

This commit is contained in:
bronze1man 2013-07-27 12:44:48 +08:00
parent 3dec4dd2e6
commit 4b7c3b9cb2
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<?php $method = strtoupper($method) ?> <?php $method = strtoupper($method) ?>
<?php $form_method = $method === 'GET' || $method === 'POST' ? $method : 'POST' ?> <?php $form_method = $method === 'GET' || $method === 'POST' ? $method : 'POST' ?>
<form method="<?php echo strtolower($form_method) ?>" action="<?php echo $action ?>"<?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>> <form name="<?php echo $form->vars['name'] ?>" method="<?php echo strtolower($form_method) ?>" action="<?php echo $action ?>"<?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
<?php if ($form_method !== $method): ?> <?php if ($form_method !== $method): ?>
<input type="hidden" name="_method" value="<?php echo $method ?>" /> <input type="hidden" name="_method" value="<?php echo $method ?>" />
<?php endif ?> <?php endif ?>

View File

@ -1811,7 +1811,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
$html = $this->renderStart($form->createView()); $html = $this->renderStart($form->createView());
$this->assertSame('<form method="get" action="http://example.com/directory">', $html); $this->assertSame('<form name="form" method="get" action="http://example.com/directory">', $html);
} }
public function testStartTagForPutRequest() public function testStartTagForPutRequest()
@ -1843,7 +1843,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
'action' => 'http://foo.com/directory' 'action' => 'http://foo.com/directory'
)); ));
$this->assertSame('<form method="post" action="http://foo.com/directory">', $html); $this->assertSame('<form name="form" method="post" action="http://foo.com/directory">', $html);
} }
public function testStartTagForMultipartForm() public function testStartTagForMultipartForm()
@ -1857,7 +1857,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
$html = $this->renderStart($form->createView()); $html = $this->renderStart($form->createView());
$this->assertSame('<form method="get" action="http://example.com/directory" enctype="multipart/form-data">', $html); $this->assertSame('<form name="form" method="get" action="http://example.com/directory" enctype="multipart/form-data">', $html);
} }
public function testStartTagWithExtraAttributes() public function testStartTagWithExtraAttributes()
@ -1871,6 +1871,6 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
'attr' => array('class' => 'foobar'), 'attr' => array('class' => 'foobar'),
)); ));
$this->assertSame('<form method="get" action="http://example.com/directory" class="foobar">', $html); $this->assertSame('<form name="form" method="get" action="http://example.com/directory" class="foobar">', $html);
} }
} }