From 257b9298f817f81d50900593640e8735647970da Mon Sep 17 00:00:00 2001 From: Mario Blazek Date: Fri, 29 Sep 2017 15:20:07 +0200 Subject: [PATCH] Use PHPUnit v5.7 (#14) * Proxy tests updated * PurgeClient tests updated * SignalSlot tests updated * use PHPUnit v57 and dependency-injection-test v1.0 --- composer.json | 4 ++-- tests/Proxy/TagAwareStoreTest.php | 7 ++++--- tests/PurgeClient/FOSPurgeClientTest.php | 8 ++++---- tests/PurgeClient/LocalPurgeClientTest.php | 6 +++--- tests/SignalSlot/AbstractSlotTest.php | 6 +++--- tests/SignalSlot/PublishVersionSlotTest.php | 3 ++- tests/SignalSlot/RemoveTranslationSlotTest.php | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index af445233..fecfe39c 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ "symfony/symfony": "^2.7 | ^3.1" }, "require-dev": { - "phpunit/phpunit": "^4.7.0", - "matthiasnoback/symfony-dependency-injection-test": "0.*", + "phpunit/phpunit": "^5.7", + "matthiasnoback/symfony-dependency-injection-test": "~1.0", "phpspec/phpspec": "^3.2", "memio/spec-gen": "^0.6" }, diff --git a/tests/Proxy/TagAwareStoreTest.php b/tests/Proxy/TagAwareStoreTest.php index a0e85780..7b5ab14c 100644 --- a/tests/Proxy/TagAwareStoreTest.php +++ b/tests/Proxy/TagAwareStoreTest.php @@ -10,9 +10,10 @@ use EzSystems\PlatformHttpCacheBundle\Proxy\TagAwareStore; use Symfony\Component\HttpFoundation\Request; -use PHPUnit_Framework_TestCase; +use Symfony\Component\Filesystem\Filesystem; +use PHPUnit\Framework\TestCase; -class TagAwareStoreTest extends PHPUnit_Framework_TestCase +class TagAwareStoreTest extends TestCase { /** * @var \EzSystems\PlatformHttpCacheBundle\Proxy\TagAwareStore @@ -74,7 +75,7 @@ public function testGetPathDeadProcess() */ private function getFilesystemMock() { - return $this->getMock('Symfony\\Component\\Filesystem\\Filesystem'); + return $this->createMock(Filesystem::class); } public function testPurgeByRequestSingleLocation() diff --git a/tests/PurgeClient/FOSPurgeClientTest.php b/tests/PurgeClient/FOSPurgeClientTest.php index 159641d0..812eb4a4 100644 --- a/tests/PurgeClient/FOSPurgeClientTest.php +++ b/tests/PurgeClient/FOSPurgeClientTest.php @@ -11,10 +11,10 @@ use EzSystems\PlatformHttpCacheBundle\PurgeClient\FOSPurgeClient; use FOS\HttpCache\ProxyClient\ProxyClientInterface; use FOS\HttpCacheBundle\CacheManager; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -class FOSPurgeClientTest extends PHPUnit_Framework_TestCase +class FOSPurgeClientTest extends TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -32,8 +32,8 @@ protected function setUp() $this->cacheManager = $this->getMockBuilder(CacheManager::class) ->setConstructorArgs( array( - $this->getMock(ProxyClientInterface::class), - $this->getMock( + $this->createMock(ProxyClientInterface::class), + $this->createMock( UrlGeneratorInterface::class ), ) diff --git a/tests/PurgeClient/LocalPurgeClientTest.php b/tests/PurgeClient/LocalPurgeClientTest.php index a6d571f8..81205ed9 100644 --- a/tests/PurgeClient/LocalPurgeClientTest.php +++ b/tests/PurgeClient/LocalPurgeClientTest.php @@ -22,10 +22,10 @@ function time() use EzSystems\PlatformHttpCacheBundle\RequestAwarePurger; use EzSystems\PlatformHttpCacheBundle\PurgeClient\LocalPurgeClient; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; -class LocalPurgeClientTest extends PHPUnit_Framework_TestCase +class LocalPurgeClientTest extends TestCase { public function testPurge() { @@ -33,7 +33,7 @@ public function testPurge() $expectedBanRequest = Request::create('http://localhost', 'PURGE'); $expectedBanRequest->headers->set('key', 'location-123 location-456 location-789'); - $cacheStore = $this->getMock(RequestAwarePurger::class); + $cacheStore = $this->createMock(RequestAwarePurger::class); $cacheStore ->expects($this->once()) ->method('purgeByRequest') diff --git a/tests/SignalSlot/AbstractSlotTest.php b/tests/SignalSlot/AbstractSlotTest.php index e15eea7e..13e09d87 100644 --- a/tests/SignalSlot/AbstractSlotTest.php +++ b/tests/SignalSlot/AbstractSlotTest.php @@ -9,9 +9,9 @@ namespace EzSystems\PlatformHttpCacheBundle\Tests\SignalSlot; use EzSystems\PlatformHttpCacheBundle\PurgeClient\PurgeClientInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; -abstract class AbstractSlotTest extends PHPUnit_Framework_TestCase +abstract class AbstractSlotTest extends TestCase { /** @var \EzSystems\PlatformHttpCacheBundle\SignalSlot\AbstractSlot */ protected $slot; @@ -23,7 +23,7 @@ abstract class AbstractSlotTest extends PHPUnit_Framework_TestCase public function setUp() { - $this->purgeClientMock = $this->getMock(PurgeClientInterface::class); + $this->purgeClientMock = $this->createMock(PurgeClientInterface::class); $this->slot = $this->createSlot(); $this->signal = $this->createSignal(); } diff --git a/tests/SignalSlot/PublishVersionSlotTest.php b/tests/SignalSlot/PublishVersionSlotTest.php index e4fd60a8..ee803b77 100644 --- a/tests/SignalSlot/PublishVersionSlotTest.php +++ b/tests/SignalSlot/PublishVersionSlotTest.php @@ -10,6 +10,7 @@ use eZ\Publish\Core\SignalSlot\Signal\ContentService\PublishVersionSignal; use eZ\Publish\SPI\Persistence\Content\Location; +use eZ\Publish\SPI\Persistence\Content\Location\Handler; class PublishVersionSlotTest extends AbstractContentSlotTest { @@ -38,7 +39,7 @@ protected function createSlot() { $class = $this->getSlotClass(); if ($this->spiLocationHandlerMock === null) { - $this->spiLocationHandlerMock = $this->getMock('eZ\Publish\SPI\Persistence\Content\Location\Handler'); + $this->spiLocationHandlerMock = $this->createMock(Handler::class); } return new $class($this->purgeClientMock, $this->spiLocationHandlerMock); diff --git a/tests/SignalSlot/RemoveTranslationSlotTest.php b/tests/SignalSlot/RemoveTranslationSlotTest.php index ae4fce9f..10a2731a 100644 --- a/tests/SignalSlot/RemoveTranslationSlotTest.php +++ b/tests/SignalSlot/RemoveTranslationSlotTest.php @@ -36,7 +36,7 @@ public static function setUpBeforeClass() public function setUp() { - $this->locationHandlerMock = $this->getMock(LocationHandler::class); + $this->locationHandlerMock = $this->createMock(LocationHandler::class); parent::setUp(); }