PasswordFieldTest.php 1023 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Symfony\Tests\Component\Form;
  3. /*
  4. * This file is part of the Symfony framework.
  5. *
  6. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. use Symfony\Component\Form\PasswordField;
  12. class PasswordFieldTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testGetDisplayedData()
  15. {
  16. $field = new PasswordField('name');
  17. $field->setData('before');
  18. $this->assertSame('', $field->getDisplayedData());
  19. $field->bind('after');
  20. $this->assertSame('', $field->getDisplayedData());
  21. }
  22. public function testGetDisplayedDataWithAlwaysEmptyDisabled()
  23. {
  24. $field = new PasswordField('name', array('always_empty' => false));
  25. $field->setData('before');
  26. $this->assertSame('', $field->getDisplayedData());
  27. $field->bind('after');
  28. $this->assertSame('after', $field->getDisplayedData());
  29. }
  30. }