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
2010-08-20 23:09:55 +02:00

49 lines
1.4 KiB
PHP

<?php
namespace Symfony\Tests\Component\Form;
use Symfony\Component\Form\PasswordField;
class PasswordFieldTest extends \PHPUnit_Framework_TestCase
{
public function testRender()
{
$field = new PasswordField('name');
$field->setData('asdf');
$html = '<input id="name" name="name" value="" type="password" class="foobar" />';
$this->assertEquals($html, $field->render(array('class' => 'foobar')));
}
// when the user made an error in the form, display the value in the field
public function testRenderAfterBinding()
{
$field = new PasswordField('name');
$field->bind('asdf');
$html = '<input id="name" name="name" value="asdf" type="password" />';
$this->assertEquals($html, $field->render());
}
public function testRenderNotAlwaysEmpty()
{
$field = new PasswordField('name', array('always_empty' => false));
$field->setData('asdf');
$html = '<input id="name" name="name" value="asdf" type="password" />';
$this->assertEquals($html, $field->render());
}
public function testRenderNotAlwaysEmptyAfterBinding()
{
$field = new PasswordField('name', array('always_empty' => false));
$field->bind('asdf');
$html = '<input id="name" name="name" value="asdf" type="password" />';
$this->assertEquals($html, $field->render());
}
}