Skip to content

Commit

Permalink
Merge 093914e into 1702fd5
Browse files Browse the repository at this point in the history
  • Loading branch information
peter279k committed Jan 15, 2020
2 parents 1702fd5 + 093914e commit 25666d3
Show file tree
Hide file tree
Showing 21 changed files with 131 additions and 91 deletions.
17 changes: 7 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,26 @@ branches:
matrix:
fast_finish: true
include:
- php: 7.4
- php: 7.3
- php: 7.2
- php: 7.1
- php: 7.0
- php: 5.6
- php: 5.5
dist: trusty
- php: 5.5
- php: 7.1
dist: trusty
env: SYMFONY_VERSION=2.7.*
- php: 5.5
- php: 7.1
dist: trusty
env: SYMFONY_VERSION=2.8.*
- php: 5.5
- php: 7.1
dist: trusty
env: SYMFONY_VERSION=3.0.*
- php: 5.5
- php: 7.1
dist: trusty
env: PREDIS_VERSION=1.0.*
- php: 5.5
- php: 7.1
dist: trusty
env: PREDIS_VERSION=1.1.*
- php: 5.6
- php: 7.2
env: PUBSUB_PREDIS_VERSION=2.0.*

before_install:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
}
},
"require": {
"php": ">=5.5.0"
"php": ">=7.1.0"
},
"require-dev": {
"psr/container": "~1.0",
"psr/log": "~1.0",
"symfony/dependency-injection": "~2.3|~3.0",
"symfony/serializer": "~2.3|~3.0",
"predis/predis": "~1.0|~1.1",
"phpunit/phpunit": "^4.8.36",
"phpunit/phpunit": "^7.0|^8.2",
"scrutinizer/ocular": "~1.3",
"php-coveralls/php-coveralls": "^1.0"
}
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Queue/Pull/MemoryUniquePullCommandQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function publish(Command $command)
$index = array_search($command, $this->commands);

// remove exists command and publish it again
if ($index !== false) {
if (false !== $index) {
unset($this->commands[$index]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function unsubscribe(callable $handler)
{
$index = array_search($handler, $this->handlers);

if ($index === false) {
if (false === $index) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function unsubscribe(callable $handler)
{
$index = array_search($handler, $this->handlers);

if ($index === false) {
if (false === $index) {
return false;
}

Expand Down
19 changes: 11 additions & 8 deletions tests/Command/Bus/HandlerLocatedCommandBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
use GpsLab\Component\Command\Bus\HandlerLocatedCommandBus;
use GpsLab\Component\Command\Command;
use GpsLab\Component\Command\Handler\Locator\CommandHandlerLocator;
use GpsLab\Component\Command\Exception\HandlerNotFoundException;
use PHPUnit\Framework\TestCase;

class HandlerLocatedCommandBusTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|CommandHandlerLocator
* @var \PHPUnit\Framework\MockObject\MockObject|CommandHandlerLocator
*/
private $locator;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Command
* @var \PHPUnit\Framework\MockObject\MockObject|Command
*/
private $command;

Expand All @@ -32,10 +33,13 @@ class HandlerLocatedCommandBusTest extends TestCase
*/
private $bus;

protected function setUp()
protected function setUp(): void
{
$this->command = $this->getMock(Command::class);
$this->locator = $this->getMock(CommandHandlerLocator::class);
$this->command = $this->getMockBuilder(Command::class);
$this->command = $this->command->getMock();

$this->locator = $this->getMockBuilder(CommandHandlerLocator::class);
$this->locator = $this->locator->getMock();
$this->bus = new HandlerLocatedCommandBus($this->locator);
}

Expand All @@ -57,11 +61,10 @@ public function testHandle()
$this->assertEquals($this->command, $handled_command);
}

/**
* @expectedException \GpsLab\Component\Command\Exception\HandlerNotFoundException
*/
public function testNoHandler()
{
$this->expectException(HandlerNotFoundException::class);

$this->locator
->expects($this->once())
->method('findHandler')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
class ContainerCommandHandlerLocatorTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|ContainerInterface
*/
private $container;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Command
* @var \PHPUnit\Framework\MockObject\MockObject|Command
*/
private $command;

Expand All @@ -39,13 +39,16 @@ class ContainerCommandHandlerLocatorTest extends TestCase
*/
private $locator;

protected function setUp()
protected function setUp(): void
{
$this->command = $this->getMock(Command::class);
$this->command = $this->getMockBuilder(Command::class);
$this->command = $this->command->getMock();

$this->handler = function (Command $command) {
$this->assertEquals($command, $this->command);
};
$this->container = $this->getMock(ContainerInterface::class);
$this->container = $this->getMockBuilder(ContainerInterface::class);
$this->container = $this->container->getMock();

$this->locator = new ContainerCommandHandlerLocator($this->container);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class DirectBindingCommandHandlerLocatorTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|Command
* @var \PHPUnit\Framework\MockObject\MockObject|Command
*/
private $command;

Expand All @@ -31,9 +31,11 @@ class DirectBindingCommandHandlerLocatorTest extends TestCase
*/
private $locator;

protected function setUp()
protected function setUp(): void
{
$this->command = $this->getMock(Command::class);
$this->command = $this->getMockBuilder(Command::class);
$this->command = $this->command->getMock();

$this->handler = function (Command $command) {
$this->assertEquals($command, $this->command);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
class SymfonyContainerCommandHandlerLocatorTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|ContainerInterface
*/
private $container;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Command
* @var \PHPUnit\Framework\MockObject\MockObject|Command
*/
private $command;

Expand All @@ -39,13 +39,16 @@ class SymfonyContainerCommandHandlerLocatorTest extends TestCase
*/
private $locator;

protected function setUp()
protected function setUp(): void
{
$this->command = $this->getMock(Command::class);
$this->command = $this->getMockBuilder(Command::class);
$this->command = $this->command->getMock();

$this->handler = function (Command $command) {
$this->assertEquals($command, $this->command);
};
$this->container = $this->getMock(ContainerInterface::class);
$this->container = $this->getMockBuilder(ContainerInterface::class);
$this->container = $this->container->getMock();

$this->locator = new SymfonyContainerCommandHandlerLocator();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/Queue/Pull/MemoryPullCommandQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MemoryPullCommandQueueTest extends TestCase
*/
private $queue;

protected function setUp()
protected function setUp(): void
{
$this->queue = new MemoryPullCommandQueue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MemoryUniquePullCommandQueueTest extends TestCase
*/
private $queue;

protected function setUp()
protected function setUp(): void
{
$this->queue = new MemoryUniquePullCommandQueue();
}
Expand Down
20 changes: 13 additions & 7 deletions tests/Command/Queue/Pull/PredisPullCommandQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
class PredisPullCommandQueueTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|Client
* @var \PHPUnit\Framework_MockObject\MockObject|Client
*/
private $client;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Serializer
* @var \PHPUnit\Framework\MockObject\MockObject|Serializer
*/
private $serializer;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|LoggerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|LoggerInterface
*/
private $logger;

Expand All @@ -45,11 +45,17 @@ class PredisPullCommandQueueTest extends TestCase
*/
private $queue_name = 'commands';

protected function setUp()
protected function setUp(): void
{
$this->client = $this->getMock(Client::class);
$this->serializer = $this->getMock(Serializer::class);
$this->logger = $this->getMock(LoggerInterface::class);
$this->client = $this->getMockBuilder(Client::class);
$this->client = $this->client->getMock();

$this->serializer = $this->getMockBuilder(Serializer::class);
$this->serializer = $this->serializer->getMock();

$this->logger = $this->getMockBuilder(LoggerInterface::class);
$this->logger = $this->logger->getMock();

$this->queue = new PredisPullCommandQueue($this->client, $this->serializer, $this->logger, $this->queue_name);
}

Expand Down
20 changes: 13 additions & 7 deletions tests/Command/Queue/Pull/PredisUniquePullCommandQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
class PredisUniquePullCommandQueueTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|Client
* @var \PHPUnit\Framework\MockObject\MockObject|Client
*/
private $client;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Serializer
* @var \PHPUnit\Framework\MockObject\MockObject|Serializer
*/
private $serializer;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|LoggerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|LoggerInterface
*/
private $logger;

Expand All @@ -45,11 +45,17 @@ class PredisUniquePullCommandQueueTest extends TestCase
*/
private $queue_name = 'unique_commands';

protected function setUp()
protected function setUp(): void
{
$this->client = $this->getMock(Client::class);
$this->serializer = $this->getMock(Serializer::class);
$this->logger = $this->getMock(LoggerInterface::class);
$this->client = $this->getMockBuilder(Client::class);
$this->client = $this->client->getMock();

$this->serializer = $this->getMockBuilder(Serializer::class);
$this->serializer = $this->serializer->getMock();

$this->logger = $this->getMockBuilder(LoggerInterface::class);
$this->logger = $this->logger->getMock();

$this->queue = new PredisUniquePullCommandQueue(
$this->client,
$this->serializer,
Expand Down
7 changes: 4 additions & 3 deletions tests/Command/Queue/Serializer/SymfonySerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
class SymfonySerializerTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|SerializerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|SerializerInterface
*/
private $serializer;

protected function setUp()
protected function setUp(): void
{
$this->serializer = $this->getMock(SerializerInterface::class);
$this->serializer = $this->getMockBuilder(SerializerInterface::class);
$this->serializer = $this->serializer->getMock();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class ExecutingSubscribeCommandQueueTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|Command
* @var \PHPUnit\Framework\MockObject\MockObject|Command
*/
private $command;

Expand All @@ -26,9 +26,11 @@ class ExecutingSubscribeCommandQueueTest extends TestCase
*/
private $queue;

protected function setUp()
protected function setUp(): void
{
$this->command = $this->getMock(Command::class);
$this->command = $this->getMockBuilder(Command::class);
$this->command = $this->command->getMock();

$this->queue = new ExecutingSubscribeCommandQueue();
}

Expand Down

0 comments on commit 25666d3

Please sign in to comment.