[Form] made the tests compatible with 3.0
This commit is contained in:
parent
bb4a5116e1
commit
795da85f9d
@ -17,7 +17,7 @@ use Symfony\Component\Form\Guess\TypeGuess;
|
|||||||
use Symfony\Component\Form\Guess\ValueGuess;
|
use Symfony\Component\Form\Guess\ValueGuess;
|
||||||
use Symfony\Component\Validator\Constraint;
|
use Symfony\Component\Validator\Constraint;
|
||||||
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
|
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
|
||||||
use Symfony\Component\Validator\MetadataFactoryInterface;
|
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
|
||||||
|
|
||||||
class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ class ValidationListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||||
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
||||||
$this->validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
|
$this->validator = $this->getMock('Symfony\Component\Validator\Validator\ValidatorInterface');
|
||||||
$this->violationMapper = $this->getMock('Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface');
|
$this->violationMapper = $this->getMock('Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface');
|
||||||
$this->listener = new ValidationListener($this->validator, $this->violationMapper);
|
$this->listener = new ValidationListener($this->validator, $this->violationMapper);
|
||||||
$this->message = 'Message';
|
$this->message = 'Message';
|
||||||
|
@ -20,11 +20,9 @@ abstract class TypeTestCase extends BaseTypeTestCase
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
|
$this->validator = $this->getMock('Symfony\Component\Validator\Validator\ValidatorInterface');
|
||||||
$metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
|
|
||||||
$this->validator->expects($this->once())->method('getMetadataFactory')->will($this->returnValue($metadataFactory));
|
|
||||||
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
|
||||||
$metadataFactory->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata));
|
$this->validator->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata));
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function test2Dot4ValidationApi()
|
public function test2Dot4ValidationApi()
|
||||||
{
|
{
|
||||||
$factory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
|
$factory = $this->getMock('Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface');
|
||||||
$validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
|
$validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
|
||||||
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')
|
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -51,7 +51,7 @@ class ValidatorTypeGuesserTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->metadata = new ClassMetadata(self::TEST_CLASS);
|
$this->metadata = new ClassMetadata(self::TEST_CLASS);
|
||||||
$this->metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
|
$this->metadataFactory = $this->getMock('Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface');
|
||||||
$this->metadataFactory->expects($this->any())
|
$this->metadataFactory->expects($this->any())
|
||||||
->method('getMetadataFor')
|
->method('getMetadataFor')
|
||||||
->with(self::TEST_CLASS)
|
->with(self::TEST_CLASS)
|
||||||
|
Reference in New Issue
Block a user