use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigBuilder;
use Symfony\Component\Form\FormEvent;
class TrimListenerTest extends TestCase
{ public function testTrim() { $data = ' Foo! ';
$form =
new Form(new FormConfigBuilder('name', null,
new EventDispatcher()));
$event =
new FormEvent($form,
$data);
$filter =
new TrimListener();
$filter->
preSubmit($event);
$this->
assertEquals('Foo!',
$event->
getData());
} public function testTrimSkipNonStrings() { $data = 1234;