[2.8] fix mocks
This commit is contained in:
parent
a8843132b8
commit
7dff706da1
2
phpunit
2
phpunit
@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Please update when phpunit needs to be reinstalled with fresh deps:
|
// Please update when phpunit needs to be reinstalled with fresh deps:
|
||||||
// Cache-Id-Version: 2016-03-23 14:50 UTC
|
// Cache-Id-Version: 2016-03-25 09:45 UTC
|
||||||
|
|
||||||
use Symfony\Component\Process\ProcessUtils;
|
use Symfony\Component\Process\ProcessUtils;
|
||||||
|
|
||||||
|
@ -19,6 +19,13 @@ use Symfony\Bundle\TwigBundle\Tests\TestCase;
|
|||||||
*/
|
*/
|
||||||
class LegacyAssetsExtensionTest extends TestCase
|
class LegacyAssetsExtensionTest extends TestCase
|
||||||
{
|
{
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
if (!class_exists('Symfony\Component\Templating\Helper\CoreAssetsHelper')) {
|
||||||
|
$this->markTestSkipped('The CoreAssetsHelper class does only exist with symfony/templating < 3.0 installed.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideGetAssetUrlArguments
|
* @dataProvider provideGetAssetUrlArguments
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +21,7 @@ use Symfony\Component\Form\SubmitButtonBuilder;
|
|||||||
use Symfony\Component\Validator\Constraints\NotNull;
|
use Symfony\Component\Validator\Constraints\NotNull;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
use Symfony\Component\Validator\Constraints\Valid;
|
use Symfony\Component\Validator\Constraints\Valid;
|
||||||
|
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||||
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
|
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
|
||||||
use Symfony\Component\Validator\Validation;
|
use Symfony\Component\Validator\Validation;
|
||||||
|
|
||||||
@ -629,8 +630,11 @@ class FormValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
|
|
||||||
$context->expects($this->never())
|
$context->expects($this->never())
|
||||||
->method('addViolation');
|
->method('addViolation');
|
||||||
|
|
||||||
|
if ($context instanceof ExecutionContextInterface) {
|
||||||
$context->expects($this->never())
|
$context->expects($this->never())
|
||||||
->method('addViolationAt');
|
->method('addViolationAt');
|
||||||
|
}
|
||||||
|
|
||||||
$this->validator->initialize($context);
|
$this->validator->initialize($context);
|
||||||
$this->validator->validate($form, new Form());
|
$this->validator->validate($form, new Form());
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\Form\Tests\Extension\Validator;
|
namespace Symfony\Component\Form\Tests\Extension\Validator;
|
||||||
|
|
||||||
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
|
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
|
||||||
|
use Symfony\Component\Validator\ValidatorInterface;
|
||||||
|
|
||||||
class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
|
class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -38,9 +39,11 @@ class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
|
|||||||
->method('addPropertyConstraint')
|
->method('addPropertyConstraint')
|
||||||
->with('children', $this->isInstanceOf('Symfony\Component\Validator\Constraints\Valid'));
|
->with('children', $this->isInstanceOf('Symfony\Component\Validator\Constraints\Valid'));
|
||||||
|
|
||||||
|
if ($validator instanceof ValidatorInterface) {
|
||||||
$validator
|
$validator
|
||||||
->expects($this->never())
|
->expects($this->never())
|
||||||
->method('getMetadataFactory');
|
->method('getMetadataFactory');
|
||||||
|
}
|
||||||
|
|
||||||
$extension = new ValidatorExtension($validator);
|
$extension = new ValidatorExtension($validator);
|
||||||
$guesser = $extension->loadTypeGuesser();
|
$guesser = $extension->loadTypeGuesser();
|
||||||
|
@ -66,10 +66,7 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testStreamRequiresStreamingEngine()
|
public function testStreamRequiresStreamingEngine()
|
||||||
{
|
{
|
||||||
$engine = $this->getEngineMock('template.php', true);
|
$delegatingEngine = new DelegatingEngine(array(new TestEngine()));
|
||||||
$engine->expects($this->never())->method('stream');
|
|
||||||
|
|
||||||
$delegatingEngine = new DelegatingEngine(array($engine));
|
|
||||||
$delegatingEngine->stream('template.php', array('foo' => 'bar'));
|
$delegatingEngine->stream('template.php', array('foo' => 'bar'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,3 +152,23 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
|||||||
interface MyStreamingEngine extends StreamingEngineInterface, EngineInterface
|
interface MyStreamingEngine extends StreamingEngineInterface, EngineInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TestEngine implements EngineInterface
|
||||||
|
{
|
||||||
|
public function render($name, array $parameters = array())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exists($name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function supports($name)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stream()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user