Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions form/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ allows you to return a list of extensions to register::
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Validator\ValidatorInterface;

class TestedTypeTest extends TypeTestCase
Expand All @@ -190,6 +191,9 @@ allows you to return a list of extensions to register::
$validator
->method('validate')
->will($this->returnValue(new ConstraintViolationList()));
$validator
->method('getMetadataFor')
->will($this->returnValue(new ClassMetadata('Symfony\Component\Form\Form')));

return array(
new ValidatorExtension($validator),
Expand Down