Merge branch '3.2'
* 3.2: fixed obsolete getMock() usage fixed obsolete getMock() usage 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
6126018b9f
@ -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();
|
||||
|
||||
|
@ -20,7 +20,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())
|
||||
@ -34,7 +34,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
|
||||
@ -47,7 +47,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');
|
||||
@ -117,7 +117,7 @@ class DoctrineChoiceLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLegacyLoadChoiceList()
|
||||
{
|
||||
$factory = $this->getMock('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface');
|
||||
$factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
|
||||
$loader = new DoctrineChoiceLoader(
|
||||
$factory,
|
||||
$this->om,
|
||||
|
@ -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);
|
||||
|
@ -31,7 +31,7 @@ class MergeDoctrineCollectionListenerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->collection = new ArrayCollection(array('test'));
|
||||
$this->dispatcher = new EventDispatcher();
|
||||
$this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
|
||||
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
|
||||
$this->form = $this->getBuilder()
|
||||
->getForm();
|
||||
}
|
||||
|
@ -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))
|
||||
|
@ -71,7 +71,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))
|
||||
@ -100,7 +100,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')
|
||||
@ -59,7 +59,7 @@ class ConsoleHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
// check that the handler actually outputs the record if it handles it
|
||||
$levelName = Logger::getLevelName($level);
|
||||
|
||||
$realOutput = $this->getMock('Symfony\Component\Console\Output\Output', array('doWrite'));
|
||||
$realOutput = $this->getMockBuilder('Symfony\Component\Console\Output\Output')->setMethods(array('doWrite'))->getMock();
|
||||
$realOutput->setVerbosity($verbosity);
|
||||
$realOutput
|
||||
->expects($isHandling ? $this->once() : $this->never())
|
||||
@ -103,7 +103,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')
|
||||
@ -133,7 +133,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')
|
||||
@ -188,12 +188,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,10 +69,10 @@ class AppVariableTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetToken()
|
||||
{
|
||||
$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);
|
||||
|
||||
$this->assertEquals($token, $this->appVariable->getToken());
|
||||
@ -80,7 +80,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());
|
||||
}
|
||||
@ -94,7 +94,7 @@ class AppVariableTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetTokenWithNoToken()
|
||||
{
|
||||
$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->getToken());
|
||||
@ -102,7 +102,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());
|
||||
@ -158,7 +158,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);
|
||||
@ -166,10 +166,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);
|
||||
|
@ -64,7 +64,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,
|
||||
@ -120,7 +120,7 @@ class DumpExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
'</pre><script>Sfdump("%s")</script>'
|
||||
);
|
||||
$extension = new DumpExtension(new VarCloner(), $dumper);
|
||||
$twig = new \Twig_Environment($this->getMock('Twig_LoaderInterface'), array(
|
||||
$twig = new \Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array(
|
||||
'debug' => true,
|
||||
'cache' => false,
|
||||
'optimizations' => 0,
|
||||
|
@ -47,7 +47,7 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori
|
||||
'bootstrap_3_horizontal_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
), $environment);
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
$this->registerTwigRuntimeLoader($environment, $this->renderer);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
|
||||
'bootstrap_3_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
), $environment);
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
$this->registerTwigRuntimeLoader($environment, $this->renderer);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
|
||||
'form_div_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
), $environment);
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
$this->registerTwigRuntimeLoader($environment, $this->renderer);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
|
||||
'form_table_layout.html.twig',
|
||||
'custom_widgets.html.twig',
|
||||
), $environment);
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
|
||||
$this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock());
|
||||
$this->registerTwigRuntimeLoader($environment, $this->renderer);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,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);
|
||||
|
||||
@ -74,7 +74,7 @@ class HttpKernelExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));
|
||||
$twig->addExtension(new HttpKernelExtension());
|
||||
|
||||
$loader = $this->getMock('Twig_RuntimeLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Twig_RuntimeLoaderInterface')->getMock();
|
||||
$loader->expects($this->any())->method('load')->will($this->returnValueMap(array(
|
||||
array('Symfony\Bridge\Twig\Extension\HttpKernelRuntime', new HttpKernelRuntime($renderer)),
|
||||
)));
|
||||
|
@ -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, '')));
|
||||
|
||||
|
@ -17,7 +17,7 @@ trait RuntimeLoaderProvider
|
||||
{
|
||||
protected function registerTwigRuntimeLoader(\Twig_Environment $environment, TwigRenderer $renderer)
|
||||
{
|
||||
$loader = $this->getMock('Twig_RuntimeLoaderInterface');
|
||||
$loader = $this->getMockBuilder('Twig_RuntimeLoaderInterface')->getMock();
|
||||
$loader->expects($this->any())->method('load')->will($this->returnValueMap(array(
|
||||
array('Symfony\Bridge\Twig\Form\TwigRenderer', $renderer),
|
||||
)));
|
||||
|
@ -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')
|
||||
|
@ -100,7 +100,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')
|
||||
@ -112,7 +112,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')
|
||||
@ -122,7 +122,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')
|
||||
@ -131,7 +131,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')
|
||||
@ -146,7 +146,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')
|
||||
@ -163,7 +163,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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,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));
|
||||
|
||||
@ -91,7 +91,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')
|
||||
@ -111,13 +111,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')
|
||||
@ -135,7 +135,7 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testJson()
|
||||
{
|
||||
$container = $this->getMock(ContainerInterface::class);
|
||||
$container = $this->getMockBuilder(ContainerInterface::class)->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('has')
|
||||
@ -152,14 +152,14 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testJsonWithSerializer()
|
||||
{
|
||||
$container = $this->getMock(ContainerInterface::class);
|
||||
$container = $this->getMockBuilder(ContainerInterface::class)->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('has')
|
||||
->with('serializer')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$serializer = $this->getMock(SerializerInterface::class);
|
||||
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
|
||||
$serializer
|
||||
->expects($this->once())
|
||||
->method('serialize')
|
||||
@ -182,14 +182,14 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testJsonWithSerializerContextOverride()
|
||||
{
|
||||
$container = $this->getMock(ContainerInterface::class);
|
||||
$container = $this->getMockBuilder(ContainerInterface::class)->getMock();
|
||||
$container
|
||||
->expects($this->once())
|
||||
->method('has')
|
||||
->with('serializer')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$serializer = $this->getMock(SerializerInterface::class);
|
||||
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
|
||||
$serializer
|
||||
->expects($this->once())
|
||||
->method('serialize')
|
||||
@ -215,8 +215,8 @@ class ControllerTest extends TestCase
|
||||
public function testFile()
|
||||
{
|
||||
/* @var ContainerInterface $container */
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$container->set('kernel', $kernel);
|
||||
|
||||
$controller = new TestController();
|
||||
@ -235,7 +235,7 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testFileAsInline()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$controller = new TestController();
|
||||
$controller->setContainer($container);
|
||||
|
||||
@ -253,7 +253,7 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testFileWithOwnFileName()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$controller = new TestController();
|
||||
$controller->setContainer($container);
|
||||
|
||||
@ -272,7 +272,7 @@ class ControllerTest extends TestCase
|
||||
|
||||
public function testFileWithOwnFileNameAsInline()
|
||||
{
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
$controller = new TestController();
|
||||
$controller->setContainer($container);
|
||||
|
||||
@ -334,10 +334,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));
|
||||
|
||||
@ -352,10 +352,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));
|
||||
|
||||
@ -370,7 +370,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));
|
||||
@ -386,7 +386,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));
|
||||
@ -401,7 +401,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));
|
||||
@ -414,10 +414,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();
|
||||
@ -432,10 +432,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));
|
||||
|
||||
@ -455,10 +455,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));
|
||||
|
||||
@ -470,10 +470,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();
|
||||
@ -494,10 +494,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));
|
||||
|
||||
@ -509,10 +509,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));
|
||||
|
||||
@ -524,9 +524,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));
|
||||
|
||||
@ -545,12 +545,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();
|
||||
@ -561,12 +561,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();
|
||||
@ -577,9 +577,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(0 => 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(0 => 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')
|
||||
@ -52,10 +49,7 @@ class ConfigCachePassTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testThatCheckersCanBeMissing()
|
||||
{
|
||||
$container = $this->getMock(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
array('findTaggedServiceIds')
|
||||
);
|
||||
$container = $this->getMockBuilder('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')
|
||||
|
@ -228,7 +228,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())
|
||||
@ -236,7 +236,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) {
|
||||
|
@ -59,7 +59,7 @@ class GlobalVariablesTest extends TestCase
|
||||
|
||||
public function testGetUserNoToken()
|
||||
{
|
||||
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
|
||||
$this->container->set('security.token_storage', $tokenStorage);
|
||||
$this->assertNull($this->globals->getUser());
|
||||
}
|
||||
@ -69,8 +69,8 @@ class GlobalVariablesTest extends TestCase
|
||||
*/
|
||||
public function testGetUser($user, $expectedUser)
|
||||
{
|
||||
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
|
||||
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
|
||||
|
||||
$this->container->set('security.token_storage', $tokenStorage);
|
||||
|
||||
@ -89,9 +89,9 @@ class GlobalVariablesTest extends TestCase
|
||||
|
||||
public function getUserProvider()
|
||||
{
|
||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
|
||||
$std = new \stdClass();
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
|
||||
|
||||
return array(
|
||||
array($user, $user),
|
||||
|
@ -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')
|
||||
|
@ -33,8 +33,8 @@ class SecurityUserValueResolverTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testResolveNoUser()
|
||||
{
|
||||
$mock = $this->getMock(UserInterface::class);
|
||||
$token = $this->getMock(TokenInterface::class);
|
||||
$mock = $this->getMockBuilder(UserInterface::class)->getMock();
|
||||
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
|
||||
$tokenStorage = new TokenStorage();
|
||||
$tokenStorage->setToken($token);
|
||||
|
||||
@ -55,8 +55,8 @@ class SecurityUserValueResolverTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testResolve()
|
||||
{
|
||||
$user = $this->getMock(UserInterface::class);
|
||||
$token = $this->getMock(TokenInterface::class);
|
||||
$user = $this->getMockBuilder(UserInterface::class)->getMock();
|
||||
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
|
||||
$token->expects($this->any())->method('getUser')->willReturn($user);
|
||||
$tokenStorage = new TokenStorage();
|
||||
$tokenStorage->setToken($token);
|
||||
@ -70,8 +70,8 @@ class SecurityUserValueResolverTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testIntegration()
|
||||
{
|
||||
$user = $this->getMock(UserInterface::class);
|
||||
$token = $this->getMock(TokenInterface::class);
|
||||
$user = $this->getMockBuilder(UserInterface::class)->getMock();
|
||||
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
|
||||
$token->expects($this->any())->method('getUser')->willReturn($user);
|
||||
$tokenStorage = new TokenStorage();
|
||||
$tokenStorage->setToken($token);
|
||||
@ -82,7 +82,7 @@ class SecurityUserValueResolverTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testIntegrationNoUser()
|
||||
{
|
||||
$token = $this->getMock(TokenInterface::class);
|
||||
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
|
||||
$tokenStorage = new TokenStorage();
|
||||
$tokenStorage->setToken($token);
|
||||
|
||||
|
@ -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');
|
||||
|
@ -27,6 +27,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'));
|
||||
|
||||
|
@ -23,7 +23,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')
|
||||
@ -151,10 +151,10 @@ class ProfilerControllerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function createController($profiler, $twig, $withCSP)
|
||||
{
|
||||
$urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
|
||||
$urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
|
||||
|
||||
if ($withCSP) {
|
||||
$nonceGenerator = $this->getMock('Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator');
|
||||
$nonceGenerator = $this->getMockBuilder('Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator')->getMock();
|
||||
|
||||
return new ProfilerController($urlGenerator, $profiler, $twig, array(), 'normal', new ContentSecurityPolicyHandler($nonceGenerator));
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class ContentSecurityPolicyHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function mockNonceGenerator($value)
|
||||
{
|
||||
$generator = $this->getMock('Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator');
|
||||
$generator = $this->getMockBuilder('Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator')->getMock();
|
||||
|
||||
$generator->expects($this->any())
|
||||
->method('generate')
|
||||
|
@ -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'));
|
||||
|
@ -247,11 +247,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));
|
||||
@ -262,7 +258,7 @@ class WebDebugToolbarListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$request->headers = new HeaderBag();
|
||||
|
||||
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));
|
||||
@ -273,7 +269,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));
|
||||
@ -283,11 +279,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 {
|
||||
|
@ -466,7 +466,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces()
|
||||
{
|
||||
$application = $this->getMock('Symfony\Component\Console\Application', array('getNamespaces'));
|
||||
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('getNamespaces'))->getMock();
|
||||
$application->expects($this->once())
|
||||
->method('getNamespaces')
|
||||
->will($this->returnValue(array('foo:sublong', 'bar:sub')));
|
||||
@ -713,7 +713,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$exception = new \Exception('', 4);
|
||||
|
||||
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
|
||||
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock();
|
||||
$application->setAutoExit(false);
|
||||
$application->expects($this->once())
|
||||
->method('doRun')
|
||||
@ -728,7 +728,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$exception = new \Exception('', 0);
|
||||
|
||||
$application = $this->getMock('Symfony\Component\Console\Application', array('doRun'));
|
||||
$application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(array('doRun'))->getMock();
|
||||
$application->setAutoExit(false);
|
||||
$application->expects($this->once())
|
||||
->method('doRun')
|
||||
|
@ -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'));
|
||||
|
@ -17,7 +17,7 @@ abstract class AbstractQuestionHelperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function createStreamableInputInterfaceMock($stream = null, $interactive = true)
|
||||
{
|
||||
$mock = $this->getMock(StreamableInputInterface::class);
|
||||
$mock = $this->getMockBuilder(StreamableInputInterface::class)->getMock();
|
||||
$mock->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->will($this->returnValue($interactive));
|
||||
|
@ -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));
|
||||
|
@ -380,7 +380,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
' [<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();
|
||||
@ -730,7 +730,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
' [<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();
|
||||
@ -788,7 +788,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
|
||||
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));
|
||||
|
@ -130,7 +130,7 @@ class SymfonyQuestionHelperTest extends AbstractQuestionHelperTest
|
||||
|
||||
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));
|
||||
|
@ -121,7 +121,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
try {
|
||||
$handler = ErrorHandler::register();
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$handler->setDefaultLogger($logger, E_NOTICE);
|
||||
$handler->setDefaultLogger($logger, array(E_USER_NOTICE => LogLevel::CRITICAL));
|
||||
@ -195,7 +195,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$warnArgCheck = function ($logLevel, $message, $context) {
|
||||
$this->assertEquals('info', $logLevel);
|
||||
@ -220,7 +220,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$logArgCheck = function ($level, $message, $context) {
|
||||
$this->assertEquals('Notice: Undefined variable: undefVar', $message);
|
||||
@ -284,7 +284,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame('User Deprecated: Foo deprecation', $exception->getMessage());
|
||||
};
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('log')
|
||||
@ -303,7 +303,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$exception = new \Exception('foo');
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$logArgCheck = function ($level, $message, $context) {
|
||||
$this->assertSame('Uncaught Exception: foo', $message);
|
||||
@ -343,7 +343,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
$handler = ErrorHandler::register();
|
||||
$handler->screamAt(E_USER_WARNING);
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$logger
|
||||
->expects($this->exactly(2))
|
||||
@ -409,7 +409,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$bootLogger->log(LogLevel::WARNING, 'Foo message', array('exception' => $exception));
|
||||
|
||||
$mockLogger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$mockLogger->expects($this->once())
|
||||
->method('log')
|
||||
->with(LogLevel::WARNING, 'Foo message', array('exception' => $exception));
|
||||
@ -429,7 +429,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
'line' => 123,
|
||||
);
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$logArgCheck = function ($level, $message, $context) {
|
||||
$this->assertEquals('Fatal Parse Error: foo', $message);
|
||||
@ -480,7 +480,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
try {
|
||||
$handler = ErrorHandler::register();
|
||||
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('log')
|
||||
|
@ -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));
|
||||
|
@ -23,10 +23,10 @@ class PassConfigTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$config = new PassConfig();
|
||||
|
||||
$pass1 = $this->getMock(CompilerPassInterface::class);
|
||||
$pass1 = $this->getMockBuilder(CompilerPassInterface::class)->getMock();
|
||||
$config->addPass($pass1, PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
|
||||
|
||||
$pass2 = $this->getMock(CompilerPassInterface::class);
|
||||
$pass2 = $this->getMockBuilder(CompilerPassInterface::class)->getMock();
|
||||
$config->addPass($pass2, PassConfig::TYPE_BEFORE_OPTIMIZATION, 30);
|
||||
|
||||
$this->assertSame(array($pass2, $pass1), $config->getBeforeOptimizationPasses());
|
||||
|
@ -293,8 +293,8 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->setResourceTracking(false);
|
||||
$defaultPasses = $builder->getCompiler()->getPassConfig()->getPasses();
|
||||
$builder->addCompilerPass($pass1 = $this->getMock('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface'), PassConfig::TYPE_BEFORE_OPTIMIZATION, -5);
|
||||
$builder->addCompilerPass($pass2 = $this->getMock('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface'), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
|
||||
$builder->addCompilerPass($pass1 = $this->getMockBuilder('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface')->getMock(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -5);
|
||||
$builder->addCompilerPass($pass2 = $this->getMockBuilder('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface')->getMock(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
|
||||
|
||||
$passes = $builder->getCompiler()->getPassConfig()->getPasses();
|
||||
$this->assertCount(count($passes) - 2, $defaultPasses);
|
||||
@ -669,7 +669,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');
|
||||
|
||||
@ -681,7 +681,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 ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
{
|
||||
$event = new Event();
|
||||
|
||||
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
|
||||
$service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
|
||||
|
||||
$service
|
||||
->expects($this->once())
|
||||
@ -50,7 +50,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
{
|
||||
$event = new Event();
|
||||
|
||||
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\SubscriberService');
|
||||
$service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\SubscriberService')->getMock();
|
||||
|
||||
$service
|
||||
->expects($this->once())
|
||||
@ -85,7 +85,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
{
|
||||
$event = new Event();
|
||||
|
||||
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
|
||||
$service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
|
||||
|
||||
$service
|
||||
->expects($this->once())
|
||||
@ -107,7 +107,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
{
|
||||
$event = new Event();
|
||||
|
||||
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
|
||||
$service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
|
||||
|
||||
$container = new Container();
|
||||
$container->set('service.listener', $service);
|
||||
@ -130,7 +130,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
|
||||
public function testGetListenersOnLazyLoad()
|
||||
{
|
||||
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
|
||||
$service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
|
||||
|
||||
$container = new Container();
|
||||
$container->set('service.listener', $service);
|
||||
@ -147,7 +147,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
|
||||
public function testRemoveAfterDispatch()
|
||||
{
|
||||
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
|
||||
$service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
|
||||
|
||||
$container = new Container();
|
||||
$container->set('service.listener', $service);
|
||||
@ -162,7 +162,7 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
|
||||
public function testRemoveBeforeDispatch()
|
||||
{
|
||||
$service = $this->getMock('Symfony\Component\EventDispatcher\Tests\Service');
|
||||
$service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
|
||||
|
||||
$container = new Container();
|
||||
$container->set('service.listener', $service);
|
||||
|
@ -126,7 +126,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLogger()
|
||||
{
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
||||
@ -141,7 +141,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testLoggerWithStoppedEvent()
|
||||
{
|
||||
$logger = $this->getMock('Psr\Log\LoggerInterface');
|
||||
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
|
||||
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user