Merge branch '2.8' into 3.1
* 2.8: fixed obsolete getMock() usage fixed obsolete getMock() usage [WebProfilerBundle] Display multiple HTTP headers in WDT do not remove the Twig ExceptionController service removed obsolete condition do not try to register incomplete definitions
This commit is contained in:
commit
7ae26ed5f1
@ -139,7 +139,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getDatabasePlatform')
|
||||
->will($this->returnValue(new MySqlPlatform()));
|
||||
|
||||
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
$registry
|
||||
->expects($this->any())
|
||||
->method('getConnectionNames')
|
||||
@ -152,7 +152,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getConnection')
|
||||
->will($this->returnValue($connection));
|
||||
|
||||
$logger = $this->getMock('Doctrine\DBAL\Logging\DebugStack');
|
||||
$logger = $this->getMockBuilder('Doctrine\DBAL\Logging\DebugStack')->getMock();
|
||||
$logger->queries = $queries;
|
||||
|
||||
$collector = new DoctrineDataCollector($registry);
|
||||
|
@ -18,7 +18,7 @@ class ContainerAwareLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testShouldSetContainerOnContainerAwareFixture()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$loader = new ContainerAwareLoader($container);
|
||||
$fixture = new ContainerAwareFixture();
|
||||
|
||||
|
@ -17,7 +17,7 @@ class DoctrineParserCacheTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFetch()
|
||||
{
|
||||
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
|
||||
$doctrineCacheMock = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
|
||||
$parserCache = new DoctrineParserCache($doctrineCacheMock);
|
||||
|
||||
$doctrineCacheMock->expects($this->once())
|
||||
@ -31,7 +31,7 @@ class DoctrineParserCacheTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testFetchUnexisting()
|
||||
{
|
||||
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
|
||||
$doctrineCacheMock = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
|
||||
$parserCache = new DoctrineParserCache($doctrineCacheMock);
|
||||
|
||||
$doctrineCacheMock
|
||||
@ -44,7 +44,7 @@ class DoctrineParserCacheTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSave()
|
||||
{
|
||||
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
|
||||
$doctrineCacheMock = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
|
||||
$parserCache = new DoctrineParserCache($doctrineCacheMock);
|
||||
|
||||
$expression = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParsedExpression')
|
||||
|
@ -66,14 +66,14 @@ class DoctrineChoiceLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->factory = $this->getMock('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface');
|
||||
$this->om = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
|
||||
$this->repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
|
||||
$this->factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
|
||||
$this->om = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
|
||||
$this->repository = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectRepository')->getMock();
|
||||
$this->class = 'stdClass';
|
||||
$this->idReader = $this->getMockBuilder('Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->objectLoader = $this->getMock('Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface');
|
||||
$this->objectLoader = $this->getMockBuilder('Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface')->getMock();
|
||||
$this->obj1 = (object) array('name' => 'A');
|
||||
$this->obj2 = (object) array('name' => 'B');
|
||||
$this->obj3 = (object) array('name' => 'C');
|
||||
|
@ -86,10 +86,10 @@ class DoctrineOrmTypeGuesserTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getGuesser(ClassMetadata $classMetadata)
|
||||
{
|
||||
$em = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
|
||||
$em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
|
||||
$em->expects($this->once())->method('getClassMetaData')->with('TestEntity')->will($this->returnValue($classMetadata));
|
||||
|
||||
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
$registry->expects($this->once())->method('getManagers')->will($this->returnValue(array($em)));
|
||||
|
||||
return new DoctrineOrmTypeGuesser($registry);
|
||||
|
@ -32,7 +32,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase
|
||||
|
||||
protected function getExtensions()
|
||||
{
|
||||
$manager = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$manager = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
|
||||
$manager->expects($this->any())
|
||||
->method('getManager')
|
||||
|
@ -1274,7 +1274,7 @@ class EntityTypeTest extends TypeTestCase
|
||||
|
||||
protected function createRegistryMock($name, $em)
|
||||
{
|
||||
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
$registry->expects($this->any())
|
||||
->method('getManager')
|
||||
->with($this->equalTo($name))
|
||||
|
@ -20,7 +20,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLog($sql, $params, $logParams)
|
||||
{
|
||||
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
|
||||
|
||||
$dbalLogger = $this
|
||||
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
|
||||
@ -52,7 +52,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLogNonUtf8()
|
||||
{
|
||||
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
|
||||
|
||||
$dbalLogger = $this
|
||||
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
|
||||
@ -75,7 +75,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLogNonUtf8Array()
|
||||
{
|
||||
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
|
||||
|
||||
$dbalLogger = $this
|
||||
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
|
||||
@ -106,7 +106,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLogLongString()
|
||||
{
|
||||
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
|
||||
|
||||
$dbalLogger = $this
|
||||
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
|
||||
@ -134,7 +134,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLogUTF8LongString()
|
||||
{
|
||||
$logger = $this->getMock('Psr\\Log\\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
|
||||
|
||||
$dbalLogger = $this
|
||||
->getMockBuilder('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger')
|
||||
|
@ -150,12 +150,12 @@ class EntityUserProviderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLoadUserByUserNameShouldLoadUserWhenProperInterfaceProvided()
|
||||
{
|
||||
$repository = $this->getMock('\Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface');
|
||||
$repository = $this->getMockBuilder('\Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface')->getMock();
|
||||
$repository->expects($this->once())
|
||||
->method('loadUserByUsername')
|
||||
->with('name')
|
||||
->willReturn(
|
||||
$this->getMock('\Symfony\Component\Security\Core\User\UserInterface')
|
||||
$this->getMockBuilder('\Symfony\Component\Security\Core\User\UserInterface')->getMock()
|
||||
);
|
||||
|
||||
$provider = new EntityUserProvider(
|
||||
@ -171,7 +171,7 @@ class EntityUserProviderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLoadUserByUserNameShouldDeclineInvalidInterface()
|
||||
{
|
||||
$repository = $this->getMock('\Symfony\Component\Security\Core\User\AdvancedUserInterface');
|
||||
$repository = $this->getMockBuilder('\Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock();
|
||||
|
||||
$provider = new EntityUserProvider(
|
||||
$this->getManager($this->getObjectManager($repository)),
|
||||
@ -183,7 +183,7 @@ class EntityUserProviderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getManager($em, $name = null)
|
||||
{
|
||||
$manager = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$manager = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
$manager->expects($this->any())
|
||||
->method('getManager')
|
||||
->with($this->equalTo($name))
|
||||
|
@ -67,7 +67,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
|
||||
|
||||
protected function createRegistryMock(ObjectManager $em = null)
|
||||
{
|
||||
$registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
$registry->expects($this->any())
|
||||
->method('getManager')
|
||||
->with($this->equalTo(self::EM_NAME))
|
||||
@ -96,7 +96,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
|
||||
->will($this->returnValue($repositoryMock))
|
||||
;
|
||||
|
||||
$classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
|
||||
$classMetadata = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\ClassMetadata')->getMock();
|
||||
$classMetadata
|
||||
->expects($this->any())
|
||||
->method('hasField')
|
||||
|
@ -45,7 +45,7 @@ class ConsoleHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testVerbosityMapping($verbosity, $level, $isHandling, array $map = array())
|
||||
{
|
||||
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
||||
$output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock();
|
||||
$output
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getVerbosity')
|
||||
@ -80,7 +80,7 @@ class ConsoleHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testVerbosityChanged()
|
||||
{
|
||||
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
||||
$output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock();
|
||||
$output
|
||||
->expects($this->at(0))
|
||||
->method('getVerbosity')
|
||||
@ -110,7 +110,7 @@ class ConsoleHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testWritingAndFormatting()
|
||||
{
|
||||
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
||||
$output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock();
|
||||
$output
|
||||
->expects($this->any())
|
||||
->method('getVerbosity')
|
||||
@ -165,12 +165,12 @@ class ConsoleHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
$logger->addInfo('After terminate message.');
|
||||
});
|
||||
|
||||
$event = new ConsoleCommandEvent(new Command('foo'), $this->getMock('Symfony\Component\Console\Input\InputInterface'), $output);
|
||||
$event = new ConsoleCommandEvent(new Command('foo'), $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output);
|
||||
$dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
|
||||
$this->assertContains('Before command message.', $out = $output->fetch());
|
||||
$this->assertContains('After command message.', $out);
|
||||
|
||||
$event = new ConsoleTerminateEvent(new Command('foo'), $this->getMock('Symfony\Component\Console\Input\InputInterface'), $output, 0);
|
||||
$event = new ConsoleTerminateEvent(new Command('foo'), $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output, 0);
|
||||
$dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
|
||||
$this->assertContains('Before terminate message.', $out = $output->fetch());
|
||||
$this->assertContains('After terminate message.', $out);
|
||||
|
@ -37,7 +37,7 @@ class RuntimeInstantiatorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testInstantiateProxy()
|
||||
{
|
||||
$instance = new \stdClass();
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$definition = new Definition('stdClass');
|
||||
$instantiator = function () use ($instance) {
|
||||
return $instance;
|
||||
|
@ -45,7 +45,7 @@ class AppVariableTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetSession()
|
||||
{
|
||||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
||||
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
|
||||
$request->method('getSession')->willReturn($session = new Session());
|
||||
|
||||
$this->setRequestStack($request);
|
||||
@ -69,7 +69,7 @@ class AppVariableTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetUser()
|
||||
{
|
||||
$this->setTokenStorage($user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'));
|
||||
$this->setTokenStorage($user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock());
|
||||
|
||||
$this->assertEquals($user, $this->appVariable->getUser());
|
||||
}
|
||||
@ -83,7 +83,7 @@ class AppVariableTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetUserWithNoToken()
|
||||
{
|
||||
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
|
||||
$this->appVariable->setTokenStorage($tokenStorage);
|
||||
|
||||
$this->assertNull($this->appVariable->getUser());
|
||||
@ -131,7 +131,7 @@ class AppVariableTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setRequestStack($request)
|
||||
{
|
||||
$requestStackMock = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
|
||||
$requestStackMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
|
||||
$requestStackMock->method('getCurrentRequest')->willReturn($request);
|
||||
|
||||
$this->appVariable->setRequestStack($requestStackMock);
|
||||
@ -139,10 +139,10 @@ class AppVariableTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setTokenStorage($user)
|
||||
{
|
||||
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
|
||||
$this->appVariable->setTokenStorage($tokenStorage);
|
||||
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
|
||||
$tokenStorage->method('getToken')->willReturn($token);
|
||||
|
||||
$token->method('getUser')->willReturn($user);
|
||||
|
@ -63,7 +63,7 @@ class DumpExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
public function testDump($context, $args, $expectedOutput, $debug = true)
|
||||
{
|
||||
$extension = new DumpExtension(new VarCloner());
|
||||
$twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array(
|
||||
$twig = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array(
|
||||
'debug' => $debug,
|
||||
'cache' => false,
|
||||
'optimizations' => 0,
|
||||
|
@ -39,7 +39,7 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori
|
||||
'bootstrap_3_horizontal_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
|
||||
$this->extension = new FormExtension($renderer);
|
||||
|
||||
|
@ -35,7 +35,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
|
||||
'bootstrap_3_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
|
||||
$this->extension = new FormExtension($renderer);
|
||||
|
||||
|
@ -36,7 +36,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
|
||||
'form_div_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
|
||||
$this->extension = new FormExtension($renderer);
|
||||
|
||||
|
@ -35,7 +35,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
|
||||
'form_table_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
|
||||
$this->extension = new FormExtension($renderer);
|
||||
|
||||
|
@ -51,7 +51,7 @@ class HttpKernelExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getFragmentHandler($return)
|
||||
{
|
||||
$strategy = $this->getMock('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface');
|
||||
$strategy = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface')->getMock();
|
||||
$strategy->expects($this->once())->method('getName')->will($this->returnValue('inline'));
|
||||
$strategy->expects($this->once())->method('render')->will($return);
|
||||
|
||||
|
@ -20,8 +20,8 @@ class RoutingExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testEscaping($template, $mustBeEscaped)
|
||||
{
|
||||
$twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0));
|
||||
$twig->addExtension(new RoutingExtension($this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface')));
|
||||
$twig = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0));
|
||||
$twig->addExtension(new RoutingExtension($this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock()));
|
||||
|
||||
$nodes = $twig->parse($twig->tokenize(new \Twig_Source($template, '')));
|
||||
|
||||
|
@ -53,7 +53,7 @@ class StopwatchExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
protected function getStopwatch($events = array())
|
||||
{
|
||||
$events = is_array($events) ? $events : array($events);
|
||||
$stopwatch = $this->getMock('Symfony\Component\Stopwatch\Stopwatch');
|
||||
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
|
||||
|
||||
$i = -1;
|
||||
foreach ($events as $eventName) {
|
||||
|
@ -19,7 +19,7 @@ class DumpNodeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$node = new DumpNode('bar', null, 7);
|
||||
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
||||
$compiler = new \Twig_Compiler($env);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
@ -43,7 +43,7 @@ EOTXT;
|
||||
{
|
||||
$node = new DumpNode('bar', null, 7);
|
||||
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
||||
$compiler = new \Twig_Compiler($env);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
@ -70,7 +70,7 @@ EOTXT;
|
||||
));
|
||||
$node = new DumpNode('bar', $vars, 7);
|
||||
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
||||
$compiler = new \Twig_Compiler($env);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
@ -98,7 +98,7 @@ EOTXT;
|
||||
));
|
||||
$node = new DumpNode('bar', $vars, 7);
|
||||
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
||||
$compiler = new \Twig_Compiler($env);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
|
@ -41,7 +41,7 @@ class FormThemeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new FormThemeNode($form, $resources, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
$this->assertEquals(
|
||||
sprintf(
|
||||
|
@ -23,7 +23,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_widget', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
$this->assertEquals(
|
||||
sprintf(
|
||||
@ -46,7 +46,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_widget', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
$this->assertEquals(
|
||||
sprintf(
|
||||
@ -66,7 +66,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
$this->assertEquals(
|
||||
sprintf(
|
||||
@ -86,7 +86,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
// "label" => null must not be included in the output!
|
||||
// Otherwise the default label is overwritten with null.
|
||||
@ -108,7 +108,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
// "label" => null must not be included in the output!
|
||||
// Otherwise the default label is overwritten with null.
|
||||
@ -129,7 +129,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
$this->assertEquals(
|
||||
sprintf(
|
||||
@ -153,7 +153,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
// "label" => null must not be included in the output!
|
||||
// Otherwise the default label is overwritten with null.
|
||||
@ -182,7 +182,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
$this->assertEquals(
|
||||
sprintf(
|
||||
@ -210,7 +210,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
// "label" => null must not be included in the output!
|
||||
// Otherwise the default label is overwritten with null.
|
||||
@ -247,7 +247,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$node = new SearchAndRenderBlockNode('form_label', $arguments, 0);
|
||||
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMock('Twig_LoaderInterface')));
|
||||
$compiler = new \Twig_Compiler(new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
||||
|
||||
// "label" => null must not be included in the output!
|
||||
// Otherwise the default label is overwritten with null.
|
||||
|
@ -24,7 +24,7 @@ class TransNodeTest extends \PHPUnit_Framework_TestCase
|
||||
$vars = new \Twig_Node_Expression_Name('foo', 0);
|
||||
$node = new TransNode($body, null, null, $vars);
|
||||
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('strict_variables' => true));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true));
|
||||
$compiler = new \Twig_Compiler($env);
|
||||
|
||||
$this->assertEquals(
|
||||
|
@ -22,7 +22,7 @@ class TranslationDefaultDomainNodeVisitorTest extends \PHPUnit_Framework_TestCas
|
||||
/** @dataProvider getDefaultDomainAssignmentTestData */
|
||||
public function testDefaultDomainAssignment(\Twig_Node $node)
|
||||
{
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$visitor = new TranslationDefaultDomainNodeVisitor();
|
||||
|
||||
// visit trans_default_domain tag
|
||||
@ -48,7 +48,7 @@ class TranslationDefaultDomainNodeVisitorTest extends \PHPUnit_Framework_TestCas
|
||||
/** @dataProvider getDefaultDomainAssignmentTestData */
|
||||
public function testNewModuleWithoutDefaultDomainTag(\Twig_Node $node)
|
||||
{
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$visitor = new TranslationDefaultDomainNodeVisitor();
|
||||
|
||||
// visit trans_default_domain tag
|
||||
|
@ -18,7 +18,7 @@ class TranslationNodeVisitorTest extends \PHPUnit_Framework_TestCase
|
||||
/** @dataProvider getMessagesExtractionTestData */
|
||||
public function testMessagesExtraction(\Twig_Node $node, array $expectedMessages)
|
||||
{
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$visitor = new TranslationNodeVisitor();
|
||||
$visitor->enable();
|
||||
$visitor->enterNode($node, $env);
|
||||
|
@ -21,7 +21,7 @@ class FormThemeTokenParserTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCompile($source, $expected)
|
||||
{
|
||||
$env = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$env = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
||||
$env->addTokenParser(new FormThemeTokenParser());
|
||||
$stream = $env->tokenize(new \Twig_Source($source, ''));
|
||||
$parser = new \Twig_Parser($env);
|
||||
|
@ -22,14 +22,14 @@ class TwigExtractorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExtract($template, $messages)
|
||||
{
|
||||
$loader = $this->getMock('Twig_LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Twig_LoaderInterface')->getMock();
|
||||
$twig = new \Twig_Environment($loader, array(
|
||||
'strict_variables' => true,
|
||||
'debug' => true,
|
||||
'cache' => false,
|
||||
'autoescape' => false,
|
||||
));
|
||||
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
|
||||
$twig->addExtension(new TranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock()));
|
||||
|
||||
$extractor = new TwigExtractor($twig);
|
||||
$extractor->setPrefix('prefix');
|
||||
@ -77,8 +77,8 @@ class TwigExtractorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExtractSyntaxError($resources)
|
||||
{
|
||||
$twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
|
||||
$twig = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
||||
$twig->addExtension(new TranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock()));
|
||||
|
||||
$extractor = new TwigExtractor($twig);
|
||||
|
||||
@ -120,7 +120,7 @@ class TwigExtractorTest extends \PHPUnit_Framework_TestCase
|
||||
'cache' => false,
|
||||
'autoescape' => false,
|
||||
));
|
||||
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
|
||||
$twig->addExtension(new TranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock()));
|
||||
|
||||
$extractor = new TwigExtractor($twig);
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
|
@ -71,7 +71,7 @@ class TwigEngineTest extends \PHPUnit_Framework_TestCase
|
||||
'index' => 'foo',
|
||||
'error' => '{{ foo }',
|
||||
)));
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
|
||||
return new TwigEngine($twig, $parser);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$routeCollection = new RouteCollection();
|
||||
$routeCollection->add('foo', new Route('foo'));
|
||||
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
|
||||
$router
|
||||
->expects($this->any())
|
||||
->method('getRouteCollection')
|
||||
@ -74,7 +74,7 @@ class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('has')
|
||||
|
@ -62,7 +62,7 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
|
||||
$routeCollection = new RouteCollection();
|
||||
$routeCollection->add('foo', new Route('foo'));
|
||||
$requestContext = new RequestContext();
|
||||
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
|
||||
$router
|
||||
->expects($this->any())
|
||||
->method('getRouteCollection')
|
||||
@ -78,7 +78,7 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('has')
|
||||
|
@ -64,7 +64,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testDebugCustomDirectory()
|
||||
{
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel->expects($this->once())
|
||||
->method('getBundle')
|
||||
->with($this->equalTo($this->translationDir))
|
||||
@ -82,7 +82,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDebugInvalidDirectory()
|
||||
{
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel->expects($this->once())
|
||||
->method('getBundle')
|
||||
->with($this->equalTo('dir'))
|
||||
@ -130,7 +130,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getFallbackLocales')
|
||||
->will($this->returnValue(array('en')));
|
||||
|
||||
$extractor = $this->getMock('Symfony\Component\Translation\Extractor\ExtractorInterface');
|
||||
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
|
||||
$extractor
|
||||
->expects($this->any())
|
||||
->method('extract')
|
||||
@ -140,7 +140,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
})
|
||||
);
|
||||
|
||||
$loader = $this->getMock('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader');
|
||||
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
|
||||
$loader
|
||||
->expects($this->any())
|
||||
->method('loadMessages')
|
||||
@ -151,7 +151,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
if (null === $kernel) {
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
@ -166,7 +166,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getRootDir')
|
||||
->will($this->returnValue($this->translationDir));
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
@ -182,7 +182,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getBundle($path)
|
||||
{
|
||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getPath')
|
||||
|
@ -85,7 +85,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getFallbackLocales')
|
||||
->will($this->returnValue(array('en')));
|
||||
|
||||
$extractor = $this->getMock('Symfony\Component\Translation\Extractor\ExtractorInterface');
|
||||
$extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock();
|
||||
$extractor
|
||||
->expects($this->any())
|
||||
->method('extract')
|
||||
@ -95,7 +95,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
})
|
||||
);
|
||||
|
||||
$loader = $this->getMock('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader');
|
||||
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
|
||||
$loader
|
||||
->expects($this->any())
|
||||
->method('loadMessages')
|
||||
@ -105,7 +105,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
})
|
||||
);
|
||||
|
||||
$writer = $this->getMock('Symfony\Component\Translation\Writer\TranslationWriter');
|
||||
$writer = $this->getMockBuilder('Symfony\Component\Translation\Writer\TranslationWriter')->getMock();
|
||||
$writer
|
||||
->expects($this->any())
|
||||
->method('getFormats')
|
||||
@ -114,7 +114,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
if (null === $kernel) {
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
@ -129,7 +129,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getRootDir')
|
||||
->will($this->returnValue($this->translationDir));
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
@ -146,7 +146,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getBundle($path)
|
||||
{
|
||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getPath')
|
||||
|
@ -22,7 +22,7 @@ class ApplicationTest extends TestCase
|
||||
{
|
||||
public function testBundleInterfaceImplementation()
|
||||
{
|
||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||
|
||||
$kernel = $this->getKernel(array($bundle), true);
|
||||
|
||||
@ -117,10 +117,10 @@ class ApplicationTest extends TestCase
|
||||
|
||||
private function getKernel(array $bundles, $useDispatcher = false)
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
|
||||
if ($useDispatcher) {
|
||||
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
|
||||
$dispatcher
|
||||
->expects($this->atLeastOnce())
|
||||
->method('dispatch')
|
||||
@ -145,7 +145,7 @@ class ApplicationTest extends TestCase
|
||||
->will($this->returnValue(array()))
|
||||
;
|
||||
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundles')
|
||||
@ -162,7 +162,7 @@ class ApplicationTest extends TestCase
|
||||
|
||||
private function createBundleMock(array $commands)
|
||||
{
|
||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock();
|
||||
$bundle
|
||||
->expects($this->once())
|
||||
->method('registerCommands')
|
||||
|
@ -147,7 +147,7 @@ class ControllerNameParserTest extends TestCase
|
||||
'FabpotFooBundle' => array($this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'), $this->getBundle('TestBundle\Sensio\FooBundle', 'SensioFooBundle')),
|
||||
);
|
||||
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
@ -178,7 +178,7 @@ class ControllerNameParserTest extends TestCase
|
||||
|
||||
private function getBundle($namespace, $name)
|
||||
{
|
||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||
$bundle->expects($this->any())->method('getName')->will($this->returnValue($name));
|
||||
$bundle->expects($this->any())->method('getNamespace')->will($this->returnValue($namespace));
|
||||
|
||||
|
@ -179,12 +179,12 @@ class ControllerResolverTest extends BaseControllerResolverTest
|
||||
|
||||
protected function createMockParser()
|
||||
{
|
||||
return $this->getMock('Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser', array(), array(), '', false);
|
||||
return $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser')->disableOriginalConstructor()->getMock();
|
||||
}
|
||||
|
||||
protected function createMockContainer()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
return $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,12 @@ class ControllerTest extends TestCase
|
||||
$requestStack = new RequestStack();
|
||||
$requestStack->push($request);
|
||||
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
|
||||
return new Response($request->getRequestFormat().'--'.$request->getLocale());
|
||||
}));
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('get')->will($this->returnValue($requestStack));
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($kernel));
|
||||
|
||||
@ -88,7 +88,7 @@ class ControllerTest extends TestCase
|
||||
*/
|
||||
public function testGetUserWithEmptyContainer()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('has')
|
||||
@ -108,13 +108,13 @@ class ControllerTest extends TestCase
|
||||
*/
|
||||
private function getContainerWithTokenStorage($token = null)
|
||||
{
|
||||
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage');
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage')->getMock();
|
||||
$tokenStorage
|
||||
->expects($this->once())
|
||||
->method('getToken')
|
||||
->will($this->returnValue($token));
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('has')
|
||||
@ -211,10 +211,10 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testIsGranted()
|
||||
{
|
||||
$authorizationChecker = $this->getMock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');
|
||||
$authorizationChecker = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface')->getMock();
|
||||
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(true);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($authorizationChecker));
|
||||
|
||||
@ -229,10 +229,10 @@ class ControllerTest extends TestCase
|
||||
*/
|
||||
public function testdenyAccessUnlessGranted()
|
||||
{
|
||||
$authorizationChecker = $this->getMock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');
|
||||
$authorizationChecker = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface')->getMock();
|
||||
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(false);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($authorizationChecker));
|
||||
|
||||
@ -247,7 +247,7 @@ class ControllerTest extends TestCase
|
||||
$twig = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$twig->expects($this->once())->method('render')->willReturn('bar');
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(false));
|
||||
$container->expects($this->at(1))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(2))->method('get')->will($this->returnValue($twig));
|
||||
@ -263,7 +263,7 @@ class ControllerTest extends TestCase
|
||||
$twig = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$twig->expects($this->once())->method('render')->willReturn('bar');
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(false));
|
||||
$container->expects($this->at(1))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(2))->method('get')->will($this->returnValue($twig));
|
||||
@ -278,7 +278,7 @@ class ControllerTest extends TestCase
|
||||
{
|
||||
$twig = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(false));
|
||||
$container->expects($this->at(1))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(2))->method('get')->will($this->returnValue($twig));
|
||||
@ -291,10 +291,10 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testRedirectToRoute()
|
||||
{
|
||||
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
|
||||
$router->expects($this->once())->method('generate')->willReturn('/foo');
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('get')->will($this->returnValue($router));
|
||||
|
||||
$controller = new TestController();
|
||||
@ -309,10 +309,10 @@ class ControllerTest extends TestCase
|
||||
public function testAddFlash()
|
||||
{
|
||||
$flashBag = new FlashBag();
|
||||
$session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session');
|
||||
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->getMock();
|
||||
$session->expects($this->once())->method('getFlashBag')->willReturn($flashBag);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($session));
|
||||
|
||||
@ -332,10 +332,10 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testIsCsrfTokenValid()
|
||||
{
|
||||
$tokenManager = $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface');
|
||||
$tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
|
||||
$tokenManager->expects($this->once())->method('isTokenValid')->willReturn(true);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($tokenManager));
|
||||
|
||||
@ -347,10 +347,10 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testGenerateUrl()
|
||||
{
|
||||
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
|
||||
$router->expects($this->once())->method('generate')->willReturn('/foo');
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('get')->will($this->returnValue($router));
|
||||
|
||||
$controller = new TestController();
|
||||
@ -371,10 +371,10 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testRenderViewTemplating()
|
||||
{
|
||||
$templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface');
|
||||
$templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
|
||||
$templating->expects($this->once())->method('render')->willReturn('bar');
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->willReturn(true);
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
|
||||
|
||||
@ -386,10 +386,10 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testRenderTemplating()
|
||||
{
|
||||
$templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface');
|
||||
$templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
|
||||
$templating->expects($this->once())->method('renderResponse')->willReturn(new Response('bar'));
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->willReturn(true);
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
|
||||
|
||||
@ -401,9 +401,9 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testStreamTemplating()
|
||||
{
|
||||
$templating = $this->getMock('Symfony\Component\Routing\RouterInterface');
|
||||
$templating = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->willReturn(true);
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($templating));
|
||||
|
||||
@ -422,12 +422,12 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testCreateForm()
|
||||
{
|
||||
$form = $this->getMock('Symfony\Component\Form\FormInterface');
|
||||
$form = $this->getMockBuilder('Symfony\Component\Form\FormInterface')->getMock();
|
||||
|
||||
$formFactory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
||||
$formFactory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
|
||||
$formFactory->expects($this->once())->method('create')->willReturn($form);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('get')->will($this->returnValue($formFactory));
|
||||
|
||||
$controller = new TestController();
|
||||
@ -438,12 +438,12 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testCreateFormBuilder()
|
||||
{
|
||||
$formBuilder = $this->getMock('Symfony\Component\Form\FormBuilderInterface');
|
||||
$formBuilder = $this->getMockBuilder('Symfony\Component\Form\FormBuilderInterface')->getMock();
|
||||
|
||||
$formFactory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
||||
$formFactory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
|
||||
$formFactory->expects($this->once())->method('createBuilder')->willReturn($formBuilder);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('get')->will($this->returnValue($formFactory));
|
||||
|
||||
$controller = new TestController();
|
||||
@ -454,9 +454,9 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testGetDoctrine()
|
||||
{
|
||||
$doctrine = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry');
|
||||
$doctrine = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock();
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container->expects($this->at(0))->method('has')->will($this->returnValue(true));
|
||||
$container->expects($this->at(1))->method('get')->will($this->returnValue($doctrine));
|
||||
|
||||
|
@ -66,14 +66,14 @@ class RedirectControllerTest extends TestCase
|
||||
|
||||
$request->attributes = new ParameterBag($attributes);
|
||||
|
||||
$router = $this->getMock('Symfony\Component\Routing\RouterInterface');
|
||||
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
|
||||
$router
|
||||
->expects($this->once())
|
||||
->method('generate')
|
||||
->with($this->equalTo($route), $this->equalTo($expectedAttributes))
|
||||
->will($this->returnValue($url));
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
|
||||
$container
|
||||
->expects($this->once())
|
||||
@ -230,7 +230,7 @@ class RedirectControllerTest extends TestCase
|
||||
|
||||
private function createRequestObject($scheme, $host, $port, $baseUrl, $queryString = '')
|
||||
{
|
||||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
||||
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
|
||||
$request
|
||||
->expects($this->any())
|
||||
->method('getScheme')
|
||||
@ -257,7 +257,7 @@ class RedirectControllerTest extends TestCase
|
||||
|
||||
private function createRedirectController($httpPort = null, $httpsPort = null)
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
|
||||
if (null !== $httpPort) {
|
||||
$container
|
||||
|
@ -24,11 +24,8 @@ class AddCacheWarmerPassTest extends \PHPUnit_Framework_TestCase
|
||||
'my_cache_warmer_service3' => array(),
|
||||
);
|
||||
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('findTaggedServiceIds', 'getDefinition', 'hasDefinition')
|
||||
);
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition', 'hasDefinition'))->getMock();
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
@ -56,11 +53,8 @@ class AddCacheWarmerPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThatCompilerPassIsIgnoredIfThereIsNoCacheWarmerDefinition()
|
||||
{
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition')
|
||||
);
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
|
||||
|
||||
$container->expects($this->never())->method('findTaggedServiceIds');
|
||||
$container->expects($this->never())->method('getDefinition');
|
||||
@ -76,11 +70,8 @@ class AddCacheWarmerPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThatCacheWarmersMightBeNotDefined()
|
||||
{
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition')
|
||||
);
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
|
@ -20,14 +20,11 @@ class AddConstraintValidatorsPassTest extends \PHPUnit_Framework_TestCase
|
||||
'my_constraint_validator_service2' => array(),
|
||||
);
|
||||
|
||||
$validatorFactoryDefinition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('findTaggedServiceIds', 'getDefinition', 'hasDefinition')
|
||||
);
|
||||
$validatorFactoryDefinition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition', 'hasDefinition'))->getMock();
|
||||
|
||||
$validatorDefinition1 = $this->getMock('Symfony\Component\DependencyInjection\Definition', array('getClass'));
|
||||
$validatorDefinition2 = $this->getMock('Symfony\Component\DependencyInjection\Definition', array('getClass'));
|
||||
$validatorDefinition1 = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->setMethods(array('getClass'))->getMock();
|
||||
$validatorDefinition2 = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->setMethods(array('getClass'))->getMock();
|
||||
|
||||
$validatorDefinition1->expects($this->atLeastOnce())
|
||||
->method('getClass')
|
||||
@ -67,11 +64,8 @@ class AddConstraintValidatorsPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThatCompilerPassIsIgnoredIfThereIsNoConstraintValidatorFactoryDefinition()
|
||||
{
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition')
|
||||
);
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
|
||||
|
||||
$container->expects($this->never())->method('findTaggedServiceIds');
|
||||
$container->expects($this->never())->method('getDefinition');
|
||||
|
@ -24,11 +24,8 @@ class ConfigCachePassTest extends \PHPUnit_Framework_TestCase
|
||||
'checker_3' => array(),
|
||||
);
|
||||
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('findTaggedServiceIds', 'getDefinition', 'hasDefinition')
|
||||
);
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition', 'hasDefinition'))->getMock();
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
@ -52,11 +49,8 @@ class ConfigCachePassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThatCheckersCanBeMissing()
|
||||
{
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('findTaggedServiceIds')
|
||||
);
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock();
|
||||
|
||||
$container->expects($this->atLeastOnce())
|
||||
->method('findTaggedServiceIds')
|
||||
|
@ -17,9 +17,9 @@ class LoggingTranslatorPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testProcess()
|
||||
{
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$parameterBag = $this->getMock('Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface');
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->getMock();
|
||||
$parameterBag = $this->getMockBuilder('Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface')->getMock();
|
||||
|
||||
$container->expects($this->exactly(2))
|
||||
->method('hasAlias')
|
||||
@ -60,7 +60,7 @@ class LoggingTranslatorPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThatCompilerPassIsIgnoredIfThereIsNotLoggerDefinition()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->getMock();
|
||||
$container->expects($this->once())
|
||||
->method('hasAlias')
|
||||
->will($this->returnValue(false));
|
||||
@ -71,7 +71,7 @@ class LoggingTranslatorPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThatCompilerPassIsIgnoredIfThereIsNotTranslatorDefinition()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->getMock();
|
||||
$container->expects($this->at(0))
|
||||
->method('hasAlias')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -75,10 +75,7 @@ class ProfilerPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function createContainerMock($services)
|
||||
{
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'getDefinition', 'findTaggedServiceIds', 'setParameter')
|
||||
);
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'getDefinition', 'findTaggedServiceIds', 'setParameter'))->getMock();
|
||||
$container->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->with($this->equalTo('profiler'))
|
||||
|
@ -30,7 +30,7 @@ class PropertyInfoPassTest extends \PHPUnit_Framework_TestCase
|
||||
new Reference('n3'),
|
||||
);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('findTaggedServiceIds'));
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock();
|
||||
|
||||
$container
|
||||
->expects($this->any())
|
||||
@ -52,7 +52,7 @@ class PropertyInfoPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testReturningEmptyArrayWhenNoService()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('findTaggedServiceIds'));
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock();
|
||||
|
||||
$container
|
||||
->expects($this->any())
|
||||
|
@ -23,7 +23,7 @@ class SerializerPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testThrowExceptionWhenNoNormalizers()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('hasDefinition', 'findTaggedServiceIds'));
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds'))->getMock();
|
||||
|
||||
$container->expects($this->once())
|
||||
->method('hasDefinition')
|
||||
@ -43,11 +43,8 @@ class SerializerPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThrowExceptionWhenNoEncoders()
|
||||
{
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition')
|
||||
);
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
|
||||
|
||||
$container->expects($this->once())
|
||||
->method('hasDefinition')
|
||||
@ -85,7 +82,7 @@ class SerializerPassTest extends \PHPUnit_Framework_TestCase
|
||||
new Reference('n3'),
|
||||
);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('findTaggedServiceIds'));
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock();
|
||||
|
||||
$container->expects($this->any())
|
||||
->method('findTaggedServiceIds')
|
||||
|
@ -18,7 +18,7 @@ class TranslatorPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testValidCollector()
|
||||
{
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$definition->expects($this->at(0))
|
||||
->method('addMethodCall')
|
||||
->with('addLoader', array('xliff', new Reference('xliff')));
|
||||
@ -26,10 +26,7 @@ class TranslatorPassTest extends \PHPUnit_Framework_TestCase
|
||||
->method('addMethodCall')
|
||||
->with('addLoader', array('xlf', new Reference('xliff')));
|
||||
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'getDefinition', 'findTaggedServiceIds', 'findDefinition')
|
||||
);
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'getDefinition', 'findTaggedServiceIds', 'findDefinition'))->getMock();
|
||||
$container->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->will($this->returnValue(true));
|
||||
@ -41,7 +38,7 @@ class TranslatorPassTest extends \PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue(array('xliff' => array(array('alias' => 'xliff', 'legacy-alias' => 'xlf')))));
|
||||
$container->expects($this->once())
|
||||
->method('findDefinition')
|
||||
->will($this->returnValue($this->getMock('Symfony\Component\DependencyInjection\Definition')));
|
||||
->will($this->returnValue($this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock()));
|
||||
$pass = new TranslatorPass();
|
||||
$pass->process($container);
|
||||
}
|
||||
|
@ -19,19 +19,17 @@ class UnusedTagsPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$pass = new UnusedTagsPass();
|
||||
|
||||
$formatter = $this->getMock('Symfony\Component\DependencyInjection\Compiler\LoggingFormatter');
|
||||
$formatter = $this->getMockBuilder('Symfony\Component\DependencyInjection\Compiler\LoggingFormatter')->getMock();
|
||||
$formatter
|
||||
->expects($this->at(0))
|
||||
->method('format')
|
||||
->with($pass, 'Tag "kenrel.event_subscriber" was defined on service(s) "foo", "bar", but was never used. Did you mean "kernel.event_subscriber"?')
|
||||
;
|
||||
|
||||
$compiler = $this->getMock('Symfony\Component\DependencyInjection\Compiler\Compiler');
|
||||
$compiler = $this->getMockBuilder('Symfony\Component\DependencyInjection\Compiler\Compiler')->getMock();
|
||||
$compiler->expects($this->once())->method('getLoggingFormatter')->will($this->returnValue($formatter));
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('findTaggedServiceIds', 'getCompiler', 'findUnusedTags', 'findTags')
|
||||
);
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getCompiler', 'findUnusedTags', 'findTags'))->getMock();
|
||||
$container->expects($this->once())->method('getCompiler')->will($this->returnValue($compiler));
|
||||
$container->expects($this->once())
|
||||
->method('findTags')
|
||||
|
@ -214,7 +214,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
private function getServiceContainer(RouteCollection $routes)
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
|
||||
$loader
|
||||
->expects($this->any())
|
||||
@ -222,7 +222,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue($routes))
|
||||
;
|
||||
|
||||
$sc = $this->getMock('Symfony\\Component\\DependencyInjection\\Container', array('get'));
|
||||
$sc = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')->setMethods(array('get'))->getMock();
|
||||
|
||||
$sc
|
||||
->expects($this->once())
|
||||
|
@ -85,7 +85,7 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getEngineMock($template, $supports)
|
||||
{
|
||||
$engine = $this->getMock('Symfony\Component\Templating\EngineInterface');
|
||||
$engine = $this->getMockBuilder('Symfony\Component\Templating\EngineInterface')->getMock();
|
||||
|
||||
$engine->expects($this->once())
|
||||
->method('supports')
|
||||
@ -97,7 +97,7 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getFrameworkEngineMock($template, $supports)
|
||||
{
|
||||
$engine = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface');
|
||||
$engine = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock();
|
||||
|
||||
$engine->expects($this->once())
|
||||
->method('supports')
|
||||
@ -109,7 +109,7 @@ class DelegatingEngineTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getContainerMock($services)
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
|
||||
$i = 0;
|
||||
foreach ($services as $id => $service) {
|
||||
|
@ -17,7 +17,7 @@ class StopwatchHelperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testDevEnvironment()
|
||||
{
|
||||
$stopwatch = $this->getMock('Symfony\Component\Stopwatch\Stopwatch');
|
||||
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
|
||||
$stopwatch->expects($this->once())
|
||||
->method('start')
|
||||
->with('foo');
|
||||
|
@ -22,7 +22,7 @@ class TemplateNameParserTest extends TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel
|
||||
->expects($this->any())
|
||||
->method('getBundle')
|
||||
|
@ -44,7 +44,7 @@ class TimedPhpEngineTest extends TestCase
|
||||
*/
|
||||
private function getContainer()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\DependencyInjection\Container');
|
||||
return $this->getMockBuilder('Symfony\Component\DependencyInjection\Container')->getMock();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,8 +52,8 @@ class TimedPhpEngineTest extends TestCase
|
||||
*/
|
||||
private function getTemplateNameParser()
|
||||
{
|
||||
$templateReference = $this->getMock('Symfony\Component\Templating\TemplateReferenceInterface');
|
||||
$templateNameParser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$templateReference = $this->getMockBuilder('Symfony\Component\Templating\TemplateReferenceInterface')->getMock();
|
||||
$templateNameParser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$templateNameParser->expects($this->any())
|
||||
->method('parse')
|
||||
->will($this->returnValue($templateReference));
|
||||
@ -111,6 +111,6 @@ class TimedPhpEngineTest extends TestCase
|
||||
*/
|
||||
private function getStopwatch()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\Stopwatch\Stopwatch');
|
||||
return $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
|
||||
|
||||
// do it another time as the cache is primed now
|
||||
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
|
||||
$loader->expects($this->never())->method('load');
|
||||
|
||||
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir));
|
||||
@ -99,7 +99,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testTransWithCachingWithInvalidLocale()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
|
||||
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir), 'loader', '\Symfony\Bundle\FrameworkBundle\Tests\Translation\TranslatorWithInvalidLocale');
|
||||
|
||||
$translator->trans('foo');
|
||||
@ -122,7 +122,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetDefaultLocale()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('getParameter')
|
||||
@ -150,7 +150,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getLoader()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
|
||||
$loader
|
||||
->expects($this->at(0))
|
||||
->method('load')
|
||||
@ -208,7 +208,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getContainer($loader)
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$container
|
||||
->expects($this->any())
|
||||
->method('get')
|
||||
@ -249,7 +249,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
$translator->setFallbackLocales(array('fr'));
|
||||
$translator->warmup($this->tmpDir);
|
||||
|
||||
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
|
||||
$loader
|
||||
->expects($this->never())
|
||||
->method('load');
|
||||
|
@ -21,7 +21,7 @@ class ConstraintValidatorFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$class = get_class($this->getMockForAbstractClass('Symfony\\Component\\Validator\\ConstraintValidator'));
|
||||
|
||||
$constraint = $this->getMock('Symfony\\Component\\Validator\\Constraint');
|
||||
$constraint = $this->getMockBuilder('Symfony\\Component\\Validator\\Constraint')->getMock();
|
||||
$constraint
|
||||
->expects($this->once())
|
||||
->method('validatedBy')
|
||||
@ -46,14 +46,14 @@ class ConstraintValidatorFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
$validator = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\ConstraintValidator');
|
||||
|
||||
// mock ContainerBuilder b/c it implements TaggedContainerInterface
|
||||
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder', array('get'));
|
||||
$container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerBuilder')->setMethods(array('get'))->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('get')
|
||||
->with($service)
|
||||
->will($this->returnValue($validator));
|
||||
|
||||
$constraint = $this->getMock('Symfony\\Component\\Validator\\Constraint');
|
||||
$constraint = $this->getMockBuilder('Symfony\\Component\\Validator\\Constraint')->getMock();
|
||||
$constraint
|
||||
->expects($this->once())
|
||||
->method('validatedBy')
|
||||
@ -68,7 +68,7 @@ class ConstraintValidatorFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetInstanceInvalidValidatorClass()
|
||||
{
|
||||
$constraint = $this->getMock('Symfony\\Component\\Validator\\Constraint');
|
||||
$constraint = $this->getMockBuilder('Symfony\\Component\\Validator\\Constraint')->getMock();
|
||||
$constraint
|
||||
->expects($this->once())
|
||||
->method('validatedBy')
|
||||
|
@ -27,8 +27,10 @@ class ExceptionListenerPass implements CompilerPassInterface
|
||||
return;
|
||||
}
|
||||
|
||||
// register the exception controller only if Twig is enabled
|
||||
if ($container->hasParameter('templating.engines')) {
|
||||
// register the exception controller only if Twig is enabled and required dependencies do exist
|
||||
if (!class_exists('Symfony\Component\Debug\Exception\FlattenException') || !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
|
||||
$container->removeDefinition('twig.exception_listener');
|
||||
} elseif ($container->hasParameter('templating.engines')) {
|
||||
$engines = $container->getParameter('templating.engines');
|
||||
if (!in_array('twig', $engines)) {
|
||||
$container->removeDefinition('twig.exception_listener');
|
||||
|
@ -23,6 +23,25 @@ class ExtensionPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!class_exists('Symfony\Component\Asset\Packages')) {
|
||||
$container->removeDefinition('twig.extension.assets');
|
||||
}
|
||||
|
||||
if (!class_exists('Symfony\Component\ExpressionLanguage\Expression')) {
|
||||
$container->removeDefinition('twig.extension.expression');
|
||||
}
|
||||
|
||||
if (!interface_exists('Symfony\Component\Routing\Generator\UrlGeneratorInterface')) {
|
||||
$container->removeDefinition('twig.extension.routing');
|
||||
}
|
||||
if (!interface_exists('Symfony\Component\Translation\TranslatorInterface')) {
|
||||
$container->removeDefinition('twig.extension.trans');
|
||||
}
|
||||
|
||||
if (!class_exists('Symfony\Component\Yaml\Yaml')) {
|
||||
$container->removeDefinition('twig.extension.yaml');
|
||||
}
|
||||
|
||||
if ($container->has('form.extension')) {
|
||||
$container->getDefinition('twig.extension.form')->addTag('twig.extension');
|
||||
$reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension');
|
||||
|
@ -37,6 +37,18 @@ class TwigExtension extends Extension
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('twig.xml');
|
||||
|
||||
if (class_exists('Symfony\Component\Form\Form')) {
|
||||
$loader->load('form.xml');
|
||||
}
|
||||
|
||||
if (interface_exists('Symfony\Component\Templating\EngineInterface')) {
|
||||
$loader->load('templating.xml');
|
||||
}
|
||||
|
||||
if (!interface_exists('Symfony\Component\Translation\TranslatorInterface')) {
|
||||
$container->removeDefinition('twig.translation.extractor');
|
||||
}
|
||||
|
||||
foreach ($configs as $key => $config) {
|
||||
if (isset($config['globals'])) {
|
||||
foreach ($config['globals'] as $name => $value) {
|
||||
|
20
src/Symfony/Bundle/TwigBundle/Resources/config/form.xml
Normal file
20
src/Symfony/Bundle/TwigBundle/Resources/config/form.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<services>
|
||||
<service id="twig.extension.form" class="%twig.extension.form.class%" public="false">
|
||||
<argument type="service" id="twig.form.renderer" />
|
||||
</service>
|
||||
|
||||
<service id="twig.form.engine" class="%twig.form.engine.class%" public="false">
|
||||
<argument>%twig.form.resources%</argument>
|
||||
</service>
|
||||
|
||||
<service id="twig.form.renderer" class="%twig.form.renderer.class%" public="false">
|
||||
<argument type="service" id="twig.form.engine" />
|
||||
<argument type="service" id="security.csrf.token_manager" on-invalid="null" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<services>
|
||||
<service id="twig.loader.filesystem" class="%twig.loader.filesystem.class%" public="false">
|
||||
<argument type="service" id="templating.locator" />
|
||||
<argument type="service" id="templating.name_parser" />
|
||||
<tag name="twig.loader"/>
|
||||
</service>
|
||||
|
||||
<service id="twig.loader" alias="twig.loader.filesystem" />
|
||||
|
||||
<service id="templating.engine.twig" class="%templating.engine.twig.class%" public="false">
|
||||
<argument type="service" id="twig" />
|
||||
<argument type="service" id="templating.name_parser" />
|
||||
<argument type="service" id="templating.locator" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
@ -27,7 +27,7 @@ class PreviewErrorControllerTest extends TestCase
|
||||
$code = 123;
|
||||
$logicalControllerName = 'foo:bar:baz';
|
||||
|
||||
$kernel = $this->getMock('\Symfony\Component\HttpKernel\HttpKernelInterface');
|
||||
$kernel = $this->getMockBuilder('\Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('handle')
|
||||
|
@ -31,10 +31,7 @@ class TwigLoaderPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->builder = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'findTaggedServiceIds', 'setAlias', 'getDefinition')
|
||||
);
|
||||
$this->builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'setAlias', 'getDefinition'))->getMock();
|
||||
$this->chainLoader = new Definition('loader');
|
||||
$this->pass = new TwigLoaderPass();
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ class FilesystemLoaderTest extends TestCase
|
||||
{
|
||||
public function testGetSourceContext()
|
||||
{
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
$locator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
@ -39,8 +39,8 @@ class FilesystemLoaderTest extends TestCase
|
||||
public function testExists()
|
||||
{
|
||||
// should return true for templates that Twig does not find, but Symfony does
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
$locator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
@ -56,7 +56,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
*/
|
||||
public function testTwigErrorIfLocatorThrowsInvalid()
|
||||
{
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$parser
|
||||
->expects($this->once())
|
||||
->method('parse')
|
||||
@ -64,7 +64,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
->will($this->returnValue(new TemplateReference('', '', 'name', 'format', 'engine')))
|
||||
;
|
||||
|
||||
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
$locator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
@ -80,7 +80,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
*/
|
||||
public function testTwigErrorIfLocatorReturnsFalse()
|
||||
{
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$parser
|
||||
->expects($this->once())
|
||||
->method('parse')
|
||||
@ -88,7 +88,7 @@ class FilesystemLoaderTest extends TestCase
|
||||
->will($this->returnValue(new TemplateReference('', '', 'name', 'format', 'engine')))
|
||||
;
|
||||
|
||||
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
$locator
|
||||
->expects($this->once())
|
||||
->method('locate')
|
||||
@ -105,8 +105,8 @@ class FilesystemLoaderTest extends TestCase
|
||||
*/
|
||||
public function testTwigErrorIfTemplateDoesNotExist()
|
||||
{
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
|
||||
$loader = new FilesystemLoader($locator, $parser);
|
||||
$loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/Resources/views');
|
||||
@ -118,8 +118,8 @@ class FilesystemLoaderTest extends TestCase
|
||||
|
||||
public function testTwigSoftErrorIfTemplateDoesNotExist()
|
||||
{
|
||||
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
|
||||
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
|
||||
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
|
||||
$loader = new FilesystemLoader($locator, $parser);
|
||||
$loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/Resources/views');
|
||||
|
@ -17,7 +17,7 @@ class TemplateIteratorTest extends TestCase
|
||||
{
|
||||
public function testGetIterator()
|
||||
{
|
||||
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
|
||||
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock();
|
||||
$bundle->expects($this->any())->method('getName')->will($this->returnValue('BarBundle'));
|
||||
$bundle->expects($this->any())->method('getPath')->will($this->returnValue(__DIR__.'/Fixtures/templates/BarBundle'));
|
||||
|
||||
|
@ -22,7 +22,7 @@ class ProfilerControllerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testEmptyToken($token)
|
||||
{
|
||||
$urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
|
||||
$urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
|
||||
$twig = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$profiler = $this
|
||||
->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler')
|
||||
@ -46,7 +46,7 @@ class ProfilerControllerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testReturns404onTokenNotFound()
|
||||
{
|
||||
$urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
|
||||
$urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
|
||||
$twig = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$profiler = $this
|
||||
->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler')
|
||||
@ -74,7 +74,7 @@ class ProfilerControllerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSearchResult()
|
||||
{
|
||||
$urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
|
||||
$urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
|
||||
$twig = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$profiler = $this
|
||||
->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler')
|
||||
|
@ -45,7 +45,7 @@ class WebProfilerExtensionTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
|
||||
$this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();
|
||||
|
||||
$this->container = new ContainerBuilder();
|
||||
$this->container->register('router', $this->getMockClass('Symfony\\Component\\Routing\\RouterInterface'));
|
||||
|
@ -246,11 +246,7 @@ class WebDebugToolbarListenerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getRequestMock($isXmlHttpRequest = false, $requestFormat = 'html', $hasSession = true)
|
||||
{
|
||||
$request = $this->getMock(
|
||||
'Symfony\Component\HttpFoundation\Request',
|
||||
array('getSession', 'isXmlHttpRequest', 'getRequestFormat'),
|
||||
array(), '', false
|
||||
);
|
||||
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->setMethods(array('getSession', 'isXmlHttpRequest', 'getRequestFormat'))->disableOriginalConstructor()->getMock();
|
||||
$request->expects($this->any())
|
||||
->method('isXmlHttpRequest')
|
||||
->will($this->returnValue($isXmlHttpRequest));
|
||||
@ -259,7 +255,7 @@ class WebDebugToolbarListenerTest extends \PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue($requestFormat));
|
||||
|
||||
if ($hasSession) {
|
||||
$session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session', array(), array(), '', false);
|
||||
$session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock();
|
||||
$request->expects($this->any())
|
||||
->method('getSession')
|
||||
->will($this->returnValue($session));
|
||||
@ -270,7 +266,7 @@ class WebDebugToolbarListenerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getTwigMock($render = 'WDT')
|
||||
{
|
||||
$templating = $this->getMock('Twig_Environment', array(), array(), '', false);
|
||||
$templating = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$templating->expects($this->any())
|
||||
->method('render')
|
||||
->will($this->returnValue($render));
|
||||
@ -280,11 +276,11 @@ class WebDebugToolbarListenerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getUrlGeneratorMock()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
|
||||
return $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
|
||||
}
|
||||
|
||||
protected function getKernelMock()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\HttpKernel\Kernel', array(), array(), '', false);
|
||||
return $this->getMockBuilder('Symfony\Component\HttpKernel\Kernel')->disableOriginalConstructor()->getMock();
|
||||
}
|
||||
}
|
||||
|
@ -136,9 +136,9 @@ class TemplateManagerTest extends TestCase
|
||||
->will($this->returnValue('loadedTemplate'));
|
||||
|
||||
if (interface_exists('\Twig_SourceContextLoaderInterface')) {
|
||||
$loader = $this->getMock('\Twig_SourceContextLoaderInterface');
|
||||
$loader = $this->getMockBuilder('\Twig_SourceContextLoaderInterface')->getMock();
|
||||
} else {
|
||||
$loader = $this->getMock('\Twig_LoaderInterface');
|
||||
$loader = $this->getMockBuilder('\Twig_LoaderInterface')->getMock();
|
||||
}
|
||||
$this->twigEnvironment->expects($this->any())->method('getLoader')->will($this->returnValue($loader));
|
||||
|
||||
|
@ -17,7 +17,7 @@ class RequestStackContextTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetBasePathEmpty()
|
||||
{
|
||||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
|
||||
$requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
|
||||
$requestStackContext = new RequestStackContext($requestStack);
|
||||
|
||||
$this->assertEmpty($requestStackContext->getBasePath());
|
||||
@ -27,10 +27,10 @@ class RequestStackContextTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$testBasePath = 'test-path';
|
||||
|
||||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
||||
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
|
||||
$request->method('getBasePath')
|
||||
->willReturn($testBasePath);
|
||||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
|
||||
$requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
|
||||
$requestStack->method('getMasterRequest')
|
||||
->willReturn($request);
|
||||
|
||||
@ -41,7 +41,7 @@ class RequestStackContextTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testIsSecureFalse()
|
||||
{
|
||||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
|
||||
$requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
|
||||
$requestStackContext = new RequestStackContext($requestStack);
|
||||
|
||||
$this->assertFalse($requestStackContext->isSecure());
|
||||
@ -49,10 +49,10 @@ class RequestStackContextTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testIsSecureTrue()
|
||||
{
|
||||
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
||||
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
|
||||
$request->method('isSecure')
|
||||
->willReturn(true);
|
||||
$requestStack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack');
|
||||
$requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
|
||||
$requestStack->method('getMasterRequest')
|
||||
->willReturn($request);
|
||||
|
||||
|
@ -20,8 +20,8 @@ class PackagesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetterSetters()
|
||||
{
|
||||
$packages = new Packages();
|
||||
$packages->setDefaultPackage($default = $this->getMock('Symfony\Component\Asset\PackageInterface'));
|
||||
$packages->addPackage('a', $a = $this->getMock('Symfony\Component\Asset\PackageInterface'));
|
||||
$packages->setDefaultPackage($default = $this->getMockBuilder('Symfony\Component\Asset\PackageInterface')->getMock());
|
||||
$packages->addPackage('a', $a = $this->getMockBuilder('Symfony\Component\Asset\PackageInterface')->getMock());
|
||||
|
||||
$this->assertEquals($default, $packages->getPackage());
|
||||
$this->assertEquals($a, $packages->getPackage('a'));
|
||||
|
@ -76,7 +76,7 @@ class PathPackageTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getContext($basePath)
|
||||
{
|
||||
$context = $this->getMock('Symfony\Component\Asset\Context\ContextInterface');
|
||||
$context = $this->getMockBuilder('Symfony\Component\Asset\Context\ContextInterface')->getMock();
|
||||
$context->expects($this->any())->method('getBasePath')->will($this->returnValue($basePath));
|
||||
|
||||
return $context;
|
||||
|
@ -94,7 +94,7 @@ class UrlPackageTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getContext($secure)
|
||||
{
|
||||
$context = $this->getMock('Symfony\Component\Asset\Context\ContextInterface');
|
||||
$context = $this->getMockBuilder('Symfony\Component\Asset\Context\ContextInterface')->getMock();
|
||||
$context->expects($this->any())->method('isSecure')->will($this->returnValue($secure));
|
||||
|
||||
return $context;
|
||||
|
@ -33,12 +33,12 @@ class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSupports()
|
||||
{
|
||||
$loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$loader1 = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader1->expects($this->once())->method('supports')->will($this->returnValue(true));
|
||||
$loader = new DelegatingLoader(new LoaderResolver(array($loader1)));
|
||||
$this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable');
|
||||
|
||||
$loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$loader1 = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader1->expects($this->once())->method('supports')->will($this->returnValue(false));
|
||||
$loader = new DelegatingLoader(new LoaderResolver(array($loader1)));
|
||||
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable');
|
||||
@ -46,7 +46,7 @@ class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLoad()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader->expects($this->once())->method('supports')->will($this->returnValue(true));
|
||||
$loader->expects($this->once())->method('load');
|
||||
$resolver = new LoaderResolver(array($loader));
|
||||
@ -60,7 +60,7 @@ class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader->expects($this->once())->method('supports')->will($this->returnValue(false));
|
||||
$resolver = new LoaderResolver(array($loader));
|
||||
$loader = new DelegatingLoader($resolver);
|
||||
|
@ -18,9 +18,9 @@ class FileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testImportWithFileLocatorDelegation()
|
||||
{
|
||||
$locatorMock = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$locatorMock = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
|
||||
$locatorMockForAdditionalLoader = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
|
||||
$locatorMockForAdditionalLoader = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();
|
||||
$locatorMockForAdditionalLoader->expects($this->any())->method('locate')->will($this->onConsecutiveCalls(
|
||||
array('path/to/file1'), // Default
|
||||
array('path/to/file1', 'path/to/file2'), // First is imported
|
||||
|
@ -18,7 +18,7 @@ class LoaderResolverTest extends \PHPUnit_Framework_TestCase
|
||||
public function testConstructor()
|
||||
{
|
||||
$resolver = new LoaderResolver(array(
|
||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'),
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(),
|
||||
));
|
||||
|
||||
$this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument');
|
||||
@ -26,11 +26,11 @@ class LoaderResolverTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testResolve()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$resolver = new LoaderResolver(array($loader));
|
||||
$this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource');
|
||||
|
||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$loader->expects($this->once())->method('supports')->will($this->returnValue(true));
|
||||
$resolver = new LoaderResolver(array($loader));
|
||||
$this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource');
|
||||
@ -39,7 +39,7 @@ class LoaderResolverTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoaders()
|
||||
{
|
||||
$resolver = new LoaderResolver();
|
||||
$resolver->addLoader($loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'));
|
||||
$resolver->addLoader($loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock());
|
||||
|
||||
$this->assertEquals(array($loader), $resolver->getLoaders(), 'addLoader() adds a loader');
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetSetResolver()
|
||||
{
|
||||
$resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface');
|
||||
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
|
||||
|
||||
$loader = new ProjectLoader1();
|
||||
$loader->setResolver($resolver);
|
||||
@ -27,9 +27,9 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testResolve()
|
||||
{
|
||||
$resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$resolvedLoader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
|
||||
$resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface');
|
||||
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('foo.xml')
|
||||
@ -47,7 +47,7 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testResolveWhenResolverCannotFindLoader()
|
||||
{
|
||||
$resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface');
|
||||
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('FOOBAR')
|
||||
@ -61,13 +61,13 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testImport()
|
||||
{
|
||||
$resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$resolvedLoader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$resolvedLoader->expects($this->once())
|
||||
->method('load')
|
||||
->with('foo')
|
||||
->will($this->returnValue('yes'));
|
||||
|
||||
$resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface');
|
||||
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('foo')
|
||||
@ -81,13 +81,13 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testImportWithType()
|
||||
{
|
||||
$resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
||||
$resolvedLoader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
|
||||
$resolvedLoader->expects($this->once())
|
||||
->method('load')
|
||||
->with('foo', 'bar')
|
||||
->will($this->returnValue('yes'));
|
||||
|
||||
$resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface');
|
||||
$resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock();
|
||||
$resolver->expects($this->once())
|
||||
->method('resolve')
|
||||
->with('foo', 'bar')
|
||||
|
@ -44,7 +44,7 @@ class ResourceCheckerConfigCacheTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCacheIsNotFreshIfEmpty()
|
||||
{
|
||||
$checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface')
|
||||
$checker = $this->getMockBuilder('\Symfony\Component\Config\ResourceCheckerInterface')->getMock()
|
||||
->expects($this->never())->method('supports');
|
||||
|
||||
/* If there is nothing in the cache, it needs to be filled (and thus it's not fresh).
|
||||
@ -75,7 +75,7 @@ class ResourceCheckerConfigCacheTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testIsFreshWithchecker()
|
||||
{
|
||||
$checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface');
|
||||
$checker = $this->getMockBuilder('\Symfony\Component\Config\ResourceCheckerInterface')->getMock();
|
||||
|
||||
$checker->expects($this->once())
|
||||
->method('supports')
|
||||
@ -93,7 +93,7 @@ class ResourceCheckerConfigCacheTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testIsNotFreshWithchecker()
|
||||
{
|
||||
$checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface');
|
||||
$checker = $this->getMockBuilder('\Symfony\Component\Config\ResourceCheckerInterface')->getMock();
|
||||
|
||||
$checker->expects($this->once())
|
||||
->method('supports')
|
||||
@ -111,7 +111,7 @@ class ResourceCheckerConfigCacheTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCacheIsNotFreshWhenUnserializeFails()
|
||||
{
|
||||
$checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface');
|
||||
$checker = $this->getMockBuilder('\Symfony\Component\Config\ResourceCheckerInterface')->getMock();
|
||||
$cache = new ResourceCheckerConfigCache($this->cacheFile, array($checker));
|
||||
$cache->write('foo', array(new FileResource(__FILE__)));
|
||||
|
||||
|
@ -47,7 +47,7 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertContains('XSD file or callable', $e->getMessage());
|
||||
}
|
||||
|
||||
$mock = $this->getMock(__NAMESPACE__.'\Validator');
|
||||
$mock = $this->getMockBuilder(__NAMESPACE__.'\Validator')->getMock();
|
||||
$mock->expects($this->exactly(2))->method('validate')->will($this->onConsecutiveCalls(false, true));
|
||||
|
||||
try {
|
||||
|
@ -273,7 +273,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
|
||||
$exitCode = $command->run(new StringInput(''), new NullOutput());
|
||||
$this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)');
|
||||
|
||||
$command = $this->getMock('TestCommand', array('execute'));
|
||||
$command = $this->getMockBuilder('TestCommand')->setMethods(array('execute'))->getMock();
|
||||
$command->expects($this->once())
|
||||
->method('execute')
|
||||
->will($this->returnValue('2.3'));
|
||||
|
@ -110,7 +110,7 @@ class HelperSetTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getGenericMockHelper($name, HelperSet $helperset = null)
|
||||
{
|
||||
$mock_helper = $this->getMock('\Symfony\Component\Console\Helper\HelperInterface');
|
||||
$mock_helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\HelperInterface')->getMock();
|
||||
$mock_helper->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue($name));
|
||||
|
@ -294,7 +294,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRedrawFrequency()
|
||||
{
|
||||
$bar = $this->getMock('Symfony\Component\Console\Helper\ProgressBar', array('display'), array($this->getOutputStream(), 6));
|
||||
$bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream(), 6))->getMock();
|
||||
$bar->expects($this->exactly(4))->method('display');
|
||||
|
||||
$bar->setRedrawFrequency(2);
|
||||
@ -307,7 +307,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRedrawFrequencyIsAtLeastOneIfZeroGiven()
|
||||
{
|
||||
$bar = $this->getMock('Symfony\Component\Console\Helper\ProgressBar', array('display'), array($this->getOutputStream()));
|
||||
$bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock();
|
||||
|
||||
$bar->expects($this->exactly(2))->method('display');
|
||||
$bar->setRedrawFrequency(0);
|
||||
@ -317,7 +317,7 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRedrawFrequencyIsAtLeastOneIfSmallerOneGiven()
|
||||
{
|
||||
$bar = $this->getMock('Symfony\Component\Console\Helper\ProgressBar', array('display'), array($this->getOutputStream()));
|
||||
$bar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')->setMethods(array('display'))->setConstructorArgs(array($this->getOutputStream()))->getMock();
|
||||
|
||||
$bar->expects($this->exactly(2))->method('display');
|
||||
$bar->setRedrawFrequency(0.9);
|
||||
|
@ -388,7 +388,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
|
||||
' [<info>żółw </info>] bar',
|
||||
' [<info>łabądź</info>] baz',
|
||||
);
|
||||
$output = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
|
||||
$output = $this->getMockBuilder('\Symfony\Component\Console\Output\OutputInterface')->getMock();
|
||||
$output->method('getFormatter')->willReturn(new OutputFormatter());
|
||||
|
||||
$dialog = new QuestionHelper();
|
||||
@ -449,7 +449,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function createInputInterfaceMock($interactive = true)
|
||||
{
|
||||
$mock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
||||
$mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock();
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
|
@ -132,7 +132,7 @@ class SymfonyQuestionHelperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function createInputInterfaceMock($interactive = true)
|
||||
{
|
||||
$mock = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
||||
$mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock();
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
|
@ -100,7 +100,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$exception = new \Exception('foo');
|
||||
|
||||
$handler = $this->getMock('Symfony\Component\Debug\ExceptionHandler', array('sendPhpResponse'));
|
||||
$handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock();
|
||||
$handler
|
||||
->expects($this->exactly(2))
|
||||
->method('sendPhpResponse');
|
||||
@ -118,7 +118,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__);
|
||||
|
||||
$handler = $this->getMock('Symfony\Component\Debug\ExceptionHandler', array('sendPhpResponse'));
|
||||
$handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock();
|
||||
$handler
|
||||
->expects($this->once())
|
||||
->method('sendPhpResponse');
|
||||
|
@ -23,7 +23,7 @@ class ExtensionCompilerPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$this->container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->getMock();
|
||||
$this->pass = new ExtensionCompilerPass();
|
||||
}
|
||||
|
||||
@ -46,10 +46,10 @@ class ExtensionCompilerPassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function createExtensionMock($hasInlineCompile)
|
||||
{
|
||||
return $this->getMock('Symfony\Component\DependencyInjection\\'.(
|
||||
return $this->getMockBuilder('Symfony\Component\DependencyInjection\\'.(
|
||||
$hasInlineCompile
|
||||
? 'Compiler\CompilerPassInterface'
|
||||
: 'Extension\ExtensionInterface'
|
||||
));
|
||||
))->getMock();
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class MergeExtensionConfigurationPassTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$tmpProviders = array();
|
||||
|
||||
$extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface');
|
||||
$extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock();
|
||||
$extension->expects($this->any())
|
||||
->method('getXsdValidationBasePath')
|
||||
->will($this->returnValue(false));
|
||||
@ -37,7 +37,7 @@ class MergeExtensionConfigurationPassTest extends \PHPUnit_Framework_TestCase
|
||||
$tmpProviders = $container->getExpressionLanguageProviders();
|
||||
}));
|
||||
|
||||
$provider = $this->getMock('Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface');
|
||||
$provider = $this->getMockBuilder('Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface')->getMock();
|
||||
$container = new ContainerBuilder(new ParameterBag());
|
||||
$container->registerExtension($extension);
|
||||
$container->prependExtensionConfig('foo', array('bar' => true));
|
||||
|
@ -254,7 +254,7 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->setResourceTracking(false);
|
||||
$builderCompilerPasses = $builder->getCompiler()->getPassConfig()->getPasses();
|
||||
$builder->addCompilerPass($this->getMock('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface'));
|
||||
$builder->addCompilerPass($this->getMockBuilder('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface')->getMock());
|
||||
|
||||
$this->assertCount(count($builder->getCompiler()->getPassConfig()->getPasses()) - 1, $builderCompilerPasses);
|
||||
}
|
||||
@ -608,7 +608,7 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRegisteredButNotLoadedExtension()
|
||||
{
|
||||
$extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface');
|
||||
$extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock();
|
||||
$extension->expects($this->once())->method('getAlias')->will($this->returnValue('project'));
|
||||
$extension->expects($this->never())->method('load');
|
||||
|
||||
@ -620,7 +620,7 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRegisteredAndLoadedExtension()
|
||||
{
|
||||
$extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface');
|
||||
$extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock();
|
||||
$extension->expects($this->exactly(2))->method('getAlias')->will($this->returnValue('project'));
|
||||
$extension->expects($this->once())->method('load')->with(array(array('foo' => 'bar')));
|
||||
|
||||
|
@ -25,7 +25,7 @@ class RealServiceInstantiatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$instantiator = new RealServiceInstantiator();
|
||||
$instance = new \stdClass();
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$callback = function () use ($instance) {
|
||||
return $instance;
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ class RegisterListenersPassTest extends \PHPUnit_Framework_TestCase
|
||||
'my_event_subscriber' => array(0 => array()),
|
||||
);
|
||||
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$definition->expects($this->atLeastOnce())
|
||||
->method('isPublic')
|
||||
->will($this->returnValue(true));
|
||||
@ -37,10 +37,7 @@ class RegisterListenersPassTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getClass')
|
||||
->will($this->returnValue('stdClass'));
|
||||
|
||||
$builder = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition')
|
||||
);
|
||||
$builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
|
||||
$builder->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->will($this->returnValue(true));
|
||||
@ -64,7 +61,7 @@ class RegisterListenersPassTest extends \PHPUnit_Framework_TestCase
|
||||
'my_event_subscriber' => array(0 => array()),
|
||||
);
|
||||
|
||||
$definition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
|
||||
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
|
||||
$definition->expects($this->atLeastOnce())
|
||||
->method('isPublic')
|
||||
->will($this->returnValue(true));
|
||||
@ -72,10 +69,7 @@ class RegisterListenersPassTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getClass')
|
||||
->will($this->returnValue('Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'));
|
||||
|
||||
$builder = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'findDefinition')
|
||||
);
|
||||
$builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'findDefinition'))->getMock();
|
||||
$builder->expects($this->any())
|
||||
->method('hasDefinition')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -31,7 +31,7 @@ class ImmutableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||
$this->innerDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
|
||||
$this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ class ImmutableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testAddSubscriberDisallowed()
|
||||
{
|
||||
$subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface');
|
||||
$subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock();
|
||||
|
||||
$this->dispatcher->addSubscriber($subscriber);
|
||||
}
|
||||
@ -98,7 +98,7 @@ class ImmutableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testRemoveSubscriberDisallowed()
|
||||
{
|
||||
$subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface');
|
||||
$subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock();
|
||||
|
||||
$this->dispatcher->removeSubscriber($subscriber);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class ExpressionLanguageTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCachedParse()
|
||||
{
|
||||
$cacheMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface');
|
||||
$cacheMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
|
||||
$savedParsedExpression = null;
|
||||
$expressionLanguage = new ExpressionLanguage($cacheMock);
|
||||
|
||||
@ -116,7 +116,7 @@ class ExpressionLanguageTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCachingWithDifferentNamesOrder()
|
||||
{
|
||||
$cacheMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface');
|
||||
$cacheMock = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface')->getMock();
|
||||
$expressionLanguage = new ExpressionLanguage($cacheMock);
|
||||
$savedParsedExpressions = array();
|
||||
$cacheMock
|
||||
|
@ -35,7 +35,7 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
|
||||
protected function setUp()
|
||||
{
|
||||
$this->dispatcher = new EventDispatcher();
|
||||
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
||||
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
|
||||
$this->form = $this->createForm();
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function getMockForm($name = 'name')
|
||||
{
|
||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||
$config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
|
||||
$form = $this->getMockBuilder('Symfony\Component\Form\Test\FormInterface')->getMock();
|
||||
$config = $this->getMockBuilder('Symfony\Component\Form\FormConfigInterface')->getMock();
|
||||
|
||||
$form->expects($this->any())
|
||||
->method('getName')
|
||||
@ -89,7 +89,7 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function getDataMapper()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\Form\DataMapperInterface');
|
||||
return $this->getMockBuilder('Symfony\Component\Form\DataMapperInterface')->getMock();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,7 +97,7 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function getDataTransformer()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\Form\DataTransformerInterface');
|
||||
return $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,6 +105,6 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function getFormValidator()
|
||||
{
|
||||
return $this->getMock('Symfony\Component\Form\FormValidatorInterface');
|
||||
return $this->getMockBuilder('Symfony\Component\Form\FormValidatorInterface')->getMock();
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
||||
|
||||
\Locale::setDefault('en');
|
||||
|
||||
$this->csrfTokenManager = $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface');
|
||||
$this->csrfTokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -37,10 +37,7 @@ abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->serverParams = $this->getMock(
|
||||
'Symfony\Component\Form\Util\ServerParams',
|
||||
array('getNormalizedIniPostMaxSize', 'getContentLength')
|
||||
);
|
||||
$this->serverParams = $this->getMockBuilder('Symfony\Component\Form\Util\ServerParams')->setMethods(array('getNormalizedIniPostMaxSize', 'getContentLength'))->getMock();
|
||||
$this->requestHandler = $this->getRequestHandler();
|
||||
$this->factory = Forms::createFormFactoryBuilder()->getFormFactory();
|
||||
$this->request = null;
|
||||
@ -363,7 +360,7 @@ abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getMockForm($name, $method = null, $compound = true)
|
||||
{
|
||||
$config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
|
||||
$config = $this->getMockBuilder('Symfony\Component\Form\FormConfigInterface')->getMock();
|
||||
$config->expects($this->any())
|
||||
->method('getMethod')
|
||||
->will($this->returnValue($method));
|
||||
@ -371,7 +368,7 @@ abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
->method('getCompound')
|
||||
->will($this->returnValue($compound));
|
||||
|
||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||
$form = $this->getMockBuilder('Symfony\Component\Form\Test\FormInterface')->getMock();
|
||||
$form->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue($name));
|
||||
|
@ -25,8 +25,8 @@ class ButtonTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
||||
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
|
||||
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->decoratedFactory = $this->getMock('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface');
|
||||
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
|
||||
$this->factory = new CachingFactoryDecorator($this->decoratedFactory);
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateFromLoaderSameLoader()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
$list = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -171,8 +171,8 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateFromLoaderDifferentLoader()
|
||||
{
|
||||
$loader1 = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader2 = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader1 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
$loader2 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
$list1 = new \stdClass();
|
||||
$list2 = new \stdClass();
|
||||
|
||||
@ -191,7 +191,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateFromLoaderSameValueClosure()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
$list = new \stdClass();
|
||||
$closure = function () {};
|
||||
|
||||
@ -206,7 +206,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateFromLoaderDifferentValueClosure()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
$list1 = new \stdClass();
|
||||
$list2 = new \stdClass();
|
||||
$closure1 = function () {};
|
||||
@ -228,7 +228,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCreateViewSamePreferredChoices()
|
||||
{
|
||||
$preferred = array('a');
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -244,7 +244,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$preferred1 = array('a');
|
||||
$preferred2 = array('b');
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view1 = new \stdClass();
|
||||
$view2 = new \stdClass();
|
||||
|
||||
@ -264,7 +264,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCreateViewSamePreferredChoicesClosure()
|
||||
{
|
||||
$preferred = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -280,7 +280,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$preferred1 = function () {};
|
||||
$preferred2 = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view1 = new \stdClass();
|
||||
$view2 = new \stdClass();
|
||||
|
||||
@ -300,7 +300,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCreateViewSameLabelClosure()
|
||||
{
|
||||
$labels = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -316,7 +316,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$labels1 = function () {};
|
||||
$labels2 = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view1 = new \stdClass();
|
||||
$view2 = new \stdClass();
|
||||
|
||||
@ -336,7 +336,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCreateViewSameIndexClosure()
|
||||
{
|
||||
$index = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -352,7 +352,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$index1 = function () {};
|
||||
$index2 = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view1 = new \stdClass();
|
||||
$view2 = new \stdClass();
|
||||
|
||||
@ -372,7 +372,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCreateViewSameGroupByClosure()
|
||||
{
|
||||
$groupBy = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -388,7 +388,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$groupBy1 = function () {};
|
||||
$groupBy2 = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view1 = new \stdClass();
|
||||
$view2 = new \stdClass();
|
||||
|
||||
@ -408,7 +408,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCreateViewSameAttributes()
|
||||
{
|
||||
$attr = array('class' => 'foobar');
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -424,7 +424,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$attr1 = array('class' => 'foobar1');
|
||||
$attr2 = array('class' => 'foobar2');
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view1 = new \stdClass();
|
||||
$view2 = new \stdClass();
|
||||
|
||||
@ -444,7 +444,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCreateViewSameAttributesClosure()
|
||||
{
|
||||
$attr = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view = new \stdClass();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
@ -460,7 +460,7 @@ class CachingFactoryDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$attr1 = function () {};
|
||||
$attr2 = function () {};
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
$view1 = new \stdClass();
|
||||
$view2 = new \stdClass();
|
||||
|
||||
|
@ -31,7 +31,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->decoratedFactory = $this->getMock('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface');
|
||||
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
|
||||
$this->factory = new PropertyAccessDecorator($this->decoratedFactory);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateFromLoaderPropertyPath()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
@ -125,7 +125,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
// https://github.com/symfony/symfony/issues/5494
|
||||
public function testCreateFromChoiceLoaderAssumeNullIfValuePropertyPathUnreadable()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
@ -139,7 +139,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateFromLoaderPropertyPathInstance()
|
||||
{
|
||||
$loader = $this->getMock('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createListFromLoader')
|
||||
@ -153,7 +153,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewPreferredChoicesAsPropertyPath()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -188,7 +188,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewPreferredChoicesAsPropertyPathInstance()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -206,7 +206,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
// https://github.com/symfony/symfony/issues/5494
|
||||
public function testCreateViewAssumeNullIfPreferredChoicesPropertyPathUnreadable()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -223,7 +223,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewLabelsAsPropertyPath()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -260,7 +260,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewLabelsAsPropertyPathInstance()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -278,7 +278,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewIndicesAsPropertyPath()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -317,7 +317,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewIndicesAsPropertyPathInstance()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -336,7 +336,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewGroupsAsPropertyPath()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -377,7 +377,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewGroupsAsPropertyPathInstance()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -398,7 +398,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
// https://github.com/symfony/symfony/issues/5494
|
||||
public function testCreateViewAssumeNullIfGroupsPropertyPathUnreadable()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -418,7 +418,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewAttrAsPropertyPath()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
@ -461,7 +461,7 @@ class PropertyAccessDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testCreateViewAttrAsPropertyPathInstance()
|
||||
{
|
||||
$list = $this->getMock('Symfony\Component\Form\ChoiceList\ChoiceListInterface');
|
||||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
|
||||
|
||||
$this->decoratedFactory->expects($this->once())
|
||||
->method('createView')
|
||||
|
@ -877,7 +877,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
// Basic cases are covered in SimpleFormTest
|
||||
public function testCreateViewWithChildren()
|
||||
{
|
||||
$type = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
|
||||
$type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock();
|
||||
$options = array('a' => 'Foo', 'b' => 'Bar');
|
||||
$field1 = $this->getMockForm('foo');
|
||||
$field2 = $this->getMockForm('bar');
|
||||
|
@ -34,8 +34,8 @@ class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
|
||||
$this->propertyAccessor = $this->getMock('Symfony\Component\PropertyAccess\PropertyAccessorInterface');
|
||||
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
|
||||
$this->propertyAccessor = $this->getMockBuilder('Symfony\Component\PropertyAccess\PropertyAccessorInterface')->getMock();
|
||||
$this->mapper = new PropertyPathMapper($this->propertyAccessor);
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,7 @@ class BaseDateTimeTransformerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testConstructFailsIfInputTimezoneIsInvalid()
|
||||
{
|
||||
$this->getMock(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer',
|
||||
array(),
|
||||
array('this_timezone_does_not_exist')
|
||||
);
|
||||
$this->getMockBuilder('Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer')->setConstructorArgs(array('this_timezone_does_not_exist'))->getMock();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -32,10 +28,6 @@ class BaseDateTimeTransformerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testConstructFailsIfOutputTimezoneIsInvalid()
|
||||
{
|
||||
$this->getMock(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer',
|
||||
array(),
|
||||
array(null, 'that_timezone_does_not_exist')
|
||||
);
|
||||
$this->getMockBuilder('Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer')->setConstructorArgs(array(null, 'that_timezone_does_not_exist'))->getMock();
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user