Commit b26ffa6e authored by Fabien Potencier's avatar Fabien Potencier

minor #1417 removed usage of obsolete PHPUnit method (fabpot)

This PR was merged into the 1.3 branch.

Discussion
----------

removed usage of obsolete PHPUnit method

Commits
-------

12a8c99c removed obsolete dep
b10ec528 removed usage of obsolete PHPUnit method
parents f017f55a 12a8c99c
...@@ -478,7 +478,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase ...@@ -478,7 +478,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
public function testRegisterShouldReturnSelf() public function testRegisterShouldReturnSelf()
{ {
$app = new Application(); $app = new Application();
$provider = $this->getMock('Silex\ServiceProviderInterface'); $provider = $this->getMockBuilder('Silex\ServiceProviderInterface')->getMock();
$this->assertSame($app, $app->register($provider)); $this->assertSame($app, $app->register($provider));
} }
......
...@@ -31,7 +31,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase ...@@ -31,7 +31,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase
{ {
public function testRequestListener() public function testRequestListener()
{ {
$logger = $this->getMock('Psr\\Log\\LoggerInterface'); $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger $logger
->expects($this->once()) ->expects($this->once())
->method('info') ->method('info')
...@@ -41,7 +41,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase ...@@ -41,7 +41,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new LogListener($logger)); $dispatcher->addSubscriber(new LogListener($logger));
$kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface'); $kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->getMock();
$dispatcher->dispatch(KernelEvents::REQUEST, new GetResponseEvent($kernel, Request::create('/subrequest'), HttpKernelInterface::SUB_REQUEST), 'Skip sub requests'); $dispatcher->dispatch(KernelEvents::REQUEST, new GetResponseEvent($kernel, Request::create('/subrequest'), HttpKernelInterface::SUB_REQUEST), 'Skip sub requests');
...@@ -50,7 +50,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase ...@@ -50,7 +50,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase
public function testResponseListener() public function testResponseListener()
{ {
$logger = $this->getMock('Psr\\Log\\LoggerInterface'); $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger $logger
->expects($this->once()) ->expects($this->once())
->method('info') ->method('info')
...@@ -60,7 +60,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase ...@@ -60,7 +60,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new LogListener($logger)); $dispatcher->addSubscriber(new LogListener($logger));
$kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface'); $kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->getMock();
$dispatcher->dispatch(KernelEvents::RESPONSE, new FilterResponseEvent($kernel, Request::create('/foo'), HttpKernelInterface::SUB_REQUEST, Response::create('subrequest', 200)), 'Skip sub requests'); $dispatcher->dispatch(KernelEvents::RESPONSE, new FilterResponseEvent($kernel, Request::create('/foo'), HttpKernelInterface::SUB_REQUEST, Response::create('subrequest', 200)), 'Skip sub requests');
...@@ -69,7 +69,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase ...@@ -69,7 +69,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase
public function testExceptionListener() public function testExceptionListener()
{ {
$logger = $this->getMock('Psr\\Log\\LoggerInterface'); $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
$logger $logger
->expects($this->once()) ->expects($this->once())
->method('critical') ->method('critical')
...@@ -85,7 +85,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase ...@@ -85,7 +85,7 @@ class LogListenerTest extends \PHPUnit_Framework_TestCase
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new LogListener($logger)); $dispatcher->addSubscriber(new LogListener($logger));
$kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface'); $kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->getMock();
$dispatcher->dispatch(KernelEvents::EXCEPTION, new GetResponseForExceptionEvent($kernel, Request::create('/foo'), HttpKernelInterface::SUB_REQUEST, new \RuntimeException('Fatal error'))); $dispatcher->dispatch(KernelEvents::EXCEPTION, new GetResponseForExceptionEvent($kernel, Request::create('/foo'), HttpKernelInterface::SUB_REQUEST, new \RuntimeException('Fatal error')));
......
...@@ -26,7 +26,7 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase ...@@ -26,7 +26,7 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase
public function testUserMatcherIsCreatedLazily() public function testUserMatcherIsCreatedLazily()
{ {
$callCounter = 0; $callCounter = 0;
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
$matcher = new LazyUrlMatcher(function () use ($urlMatcher, &$callCounter) { $matcher = new LazyUrlMatcher(function () use ($urlMatcher, &$callCounter) {
++$callCounter; ++$callCounter;
...@@ -57,7 +57,7 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase ...@@ -57,7 +57,7 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase
*/ */
public function testMatchIsProxy() public function testMatchIsProxy()
{ {
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
$urlMatcher->expects($this->once()) $urlMatcher->expects($this->once())
->method('match') ->method('match')
->with('path') ->with('path')
...@@ -76,8 +76,8 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase ...@@ -76,8 +76,8 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase
*/ */
public function testSetContextIsProxy() public function testSetContextIsProxy()
{ {
$context = $this->getMock('Symfony\Component\Routing\RequestContext'); $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock();
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
$urlMatcher->expects($this->once()) $urlMatcher->expects($this->once())
->method('setContext') ->method('setContext')
->with($context); ->with($context);
...@@ -93,8 +93,8 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase ...@@ -93,8 +93,8 @@ class LazyUrlMatcherTest extends \PHPUnit_Framework_TestCase
*/ */
public function testGetContextIsProxy() public function testGetContextIsProxy()
{ {
$context = $this->getMock('Symfony\Component\Routing\RequestContext'); $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock();
$urlMatcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface'); $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
$urlMatcher->expects($this->once()) $urlMatcher->expects($this->once())
->method('getContext') ->method('getContext')
->will($this->returnValue($context)); ->will($this->returnValue($context));
......
...@@ -75,7 +75,7 @@ class TwigServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -75,7 +75,7 @@ class TwigServiceProviderTest extends \PHPUnit_Framework_TestCase
$app->register(new TwigServiceProvider(), array( $app->register(new TwigServiceProvider(), array(
'twig.templates' => array('foo' => 'foo'), 'twig.templates' => array('foo' => 'foo'),
)); ));
$loader = $this->getMock('\Twig_LoaderInterface'); $loader = $this->getMockBuilder('\Twig_LoaderInterface')->getMock();
$loader->expects($this->never())->method('getSource'); $loader->expects($this->never())->method('getSource');
$app['twig.loader.filesystem'] = $app->share(function ($app) use ($loader) { $app['twig.loader.filesystem'] = $app->share(function ($app) use ($loader) {
return $loader; return $loader;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment