Файл: symfony-2.7/src/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php
Строк: 66
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SymfonyComponentFormTestsExtensionValidatorType;
use SymfonyComponentFormTestTypeTestCase as BaseTypeTestCase;
use SymfonyComponentFormExtensionValidatorValidatorExtension;
abstract class TypeTestCase extends BaseTypeTestCase
{
protected $validator;
protected function setUp()
{
$this->validator = $this->getMock('SymfonyComponentValidatorValidatorInterface');
$metadataFactory = $this->getMock('SymfonyComponentValidatorMetadataFactoryInterface');
$this->validator->expects($this->once())->method('getMetadataFactory')->will($this->returnValue($metadataFactory));
$metadata = $this->getMockBuilder('SymfonyComponentValidatorMappingClassMetadata')->disableOriginalConstructor()->getMock();
$metadataFactory->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata));
parent::setUp();
}
protected function tearDown()
{
$this->validator = null;
parent::tearDown();
}
protected function getExtensions()
{
return array_merge(parent::getExtensions(), array(
new ValidatorExtension($this->validator),
));
}
}