Skip to content

Commit

Permalink
Use PHPUnit v5.7 (#14)
Browse files Browse the repository at this point in the history
* Proxy tests updated

* PurgeClient tests updated

* SignalSlot tests updated

* use PHPUnit v57 and dependency-injection-test v1.0
  • Loading branch information
MarioBlazek authored and andrerom committed Sep 29, 2017
1 parent 9dbb93b commit 257b929
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
7 changes: 4 additions & 3 deletions tests/Proxy/TagAwareStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions tests/PurgeClient/FOSPurgeClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
),
)
Expand Down
6 changes: 3 additions & 3 deletions tests/PurgeClient/LocalPurgeClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ 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()
{
$locationIds = array(123, 456, 789);
$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')
Expand Down
6 changes: 3 additions & 3 deletions tests/SignalSlot/AbstractSlotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/SignalSlot/PublishVersionSlotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/SignalSlot/RemoveTranslationSlotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 257b929

Please sign in to comment.