bug #16033 [Form] made the tests compatible with 3.0 (fabpot)

This PR was merged into the 2.8 branch.

Discussion
----------

[Form] made the tests compatible with 3.0

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

795da85 [Form] made the tests compatible with 3.0
This commit is contained in:
Fabien Potencier 2015-10-01 07:58:36 +02:00
commit fdb2073253
5 changed files with 6 additions and 8 deletions

View File

@ -17,7 +17,7 @@ use Symfony\Component\Form\Guess\TypeGuess;
use Symfony\Component\Form\Guess\ValueGuess;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
class ValidatorTypeGuesser implements FormTypeGuesserInterface
{

View File

@ -56,7 +56,7 @@ class ValidationListenerTest extends \PHPUnit_Framework_TestCase
{
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$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->listener = new ValidationListener($this->validator, $this->violationMapper);
$this->message = 'Message';

View File

@ -20,11 +20,9 @@ abstract class TypeTestCase extends BaseTypeTestCase
protected function setUp()
{
$this->validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
$metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
$this->validator->expects($this->once())->method('getMetadataFactory')->will($this->returnValue($metadataFactory));
$this->validator = $this->getMock('Symfony\Component\Validator\Validator\ValidatorInterface');
$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();
}

View File

@ -53,7 +53,7 @@ class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
*/
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');
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')
->disableOriginalConstructor()

View File

@ -51,7 +51,7 @@ class ValidatorTypeGuesserTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$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())
->method('getMetadataFor')
->with(self::TEST_CLASS)