This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Component/Form/PasswordFieldTest.php
Bernhard Schussek cd64046811 [Form] Changed semantics of "always_empty" option in PasswordField
If the option is true, the password is never written into the input field's value. If it is false, it is only written into the input field's value after submitting a form with errors.

The default value for "always_empty" is true.
2010-12-18 08:06:15 +01:00

41 lines
1023 B
PHP

<?php
namespace Symfony\Tests\Component\Form;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
use Symfony\Component\Form\PasswordField;
class PasswordFieldTest extends \PHPUnit_Framework_TestCase
{
public function testGetDisplayedData()
{
$field = new PasswordField('name');
$field->setData('before');
$this->assertSame('', $field->getDisplayedData());
$field->bind('after');
$this->assertSame('', $field->getDisplayedData());
}
public function testGetDisplayedDataWithAlwaysEmptyDisabled()
{
$field = new PasswordField('name', array('always_empty' => false));
$field->setData('before');
$this->assertSame('', $field->getDisplayedData());
$field->bind('after');
$this->assertSame('after', $field->getDisplayedData());
}
}