[Form] Update password type trimming to false

This commit is contained in:
Eric GELOEN 2012-11-13 19:41:37 +01:00
parent 7bfe13c912
commit 97f6a1b4d9
3 changed files with 14 additions and 0 deletions

View File

@ -31,3 +31,7 @@
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))->all();
```
### Form
* The PasswordType is now not trimmed by default.

View File

@ -35,6 +35,7 @@ class PasswordType extends AbstractType
{
$resolver->setDefaults(array(
'always_empty' => true,
'trim' => false,
));
}

View File

@ -39,4 +39,13 @@ class PasswordTypeTest extends TypeTestCase
$this->assertSame('pAs5w0rd', $view->vars['value']);
}
public function testNotTrimmed()
{
$form = $this->factory->create('password', null);
$form->bind(' pAs5w0rd ');
$data = $form->getData();
$this->assertSame(' pAs5w0rd ', $data);
}
}