From ca0be96d90ee078adebb5b737bf486663cf9d2fa Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 19 Dec 2016 10:02:29 +0100 Subject: [PATCH] fixed obsolete getMock() usage --- Tests/Context/RequestStackContextTest.php | 12 ++++++------ Tests/PackagesTest.php | 4 ++-- Tests/PathPackageTest.php | 2 +- Tests/UrlPackageTest.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Tests/Context/RequestStackContextTest.php b/Tests/Context/RequestStackContextTest.php index 07f75c9..dea77a5 100644 --- a/Tests/Context/RequestStackContextTest.php +++ b/Tests/Context/RequestStackContextTest.php @@ -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 @@ public function testGetBasePathSet() { $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 @@ public function testGetBasePathSet() 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 @@ public function testIsSecureFalse() 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); diff --git a/Tests/PackagesTest.php b/Tests/PackagesTest.php index 0a78a8b..bb515f2 100644 --- a/Tests/PackagesTest.php +++ b/Tests/PackagesTest.php @@ -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')); diff --git a/Tests/PathPackageTest.php b/Tests/PathPackageTest.php index ff5b0a0..1f0883a 100644 --- a/Tests/PathPackageTest.php +++ b/Tests/PathPackageTest.php @@ -76,7 +76,7 @@ public function getContextConfigs() 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; diff --git a/Tests/UrlPackageTest.php b/Tests/UrlPackageTest.php index 327876a..588e998 100644 --- a/Tests/UrlPackageTest.php +++ b/Tests/UrlPackageTest.php @@ -94,7 +94,7 @@ public function testWrongBaseUrl() 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;