Hello, every body
I have following FormType and I want to test it, but I don't know the best 
way to test it.
Could any one please help me.
With best regards

class SomeType extends AbstractType
> {
>     public function buildForm(FormBuilderInterface $builder, array 
> $options)
>     {
>         $builder->
>             add('price');
>     }
>
>     public function setDefaultOptions(OptionsResolverInterface $resolver)
>     {
>         $resolver->setDefaults(array(
>             'data_class' => 'Bundles\MyBundle\Form\Model\Data',
>             'intention'  => 'enable_barcode',
>         ));
>     }
>
>     public function getName()
>     {
>         return 'price';
>     }
> }
>

Class of data is some thing like this:

> namepspace Bundles\MyBundle\Form\Model;
> class Data
> {
>     /**
>      * @Assert\Range(
>      *      min = "100",
>      *      max = "100000",
>      *      minMessage = "...",
>      *      maxMessage = "..."
>      * )
>      */
>     public $price;
> }
>

I wrote some test like this, but Assert\Range is not applied to form.
I think annotation is not load, so I try to add ValidatorExtension but I 
got trouble with, and my problem is not solved

>     function test...()
>     {
>         $field = $this->factory->createNamed('name', 'price');
>         $field->bind(
>                 array(
>                     'price'         => 'hello',
>         ));
>
>         $data = $field->getData();
>
        $this->assertTrue($field->isValid()); // But field is not valid!!
>
    }
>



Thanks for your help.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to