Created
March 21, 2017 11:00
-
-
Save shmaltorhbooks/de88f4aa43f636409ba862e2389cefbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types = 1); | |
namespace Tests\AppBundle\Form; | |
use Symfony\Component\Form\Extension\Core\CoreExtension; | |
use Symfony\Component\Form\Extension\Validator\ValidatorExtension; | |
use Symfony\Component\Form\Test\TypeTestCase as TestCase; | |
use Symfony\Component\Validator\ConstraintViolationList; | |
use Symfony\Component\Validator\Mapping\ClassMetadata; | |
use Symfony\Component\Validator\Validator\ValidatorInterface; | |
/** | |
* @description Add 'constraints' option to FormsTests | |
*/ | |
class FormTypeTypeTest extends TestCase | |
{ | |
protected function getExtensions() | |
{ | |
/** @var ValidatorInterface|\PHPUnit_Framework_MockObject_MockObject $validator */ | |
$validator = $this->createMock(ValidatorInterface::class); | |
$validator | |
->method('validate') | |
->will($this->returnValue(new ConstraintViolationList())); | |
$validator | |
->method('getMetadataFor') | |
->will($this->returnValue(new ClassMetadata('Symfony\Component\Form\Form'))); | |
return [ | |
new ValidatorExtension($validator), | |
new CoreExtension() | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment