Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangut committed Oct 1, 2019
1 parent 602db73 commit ce95a6b
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 83 deletions.
24 changes: 17 additions & 7 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# language: php

build:
dependencies:
before:
- 'composer self-update'
- 'composer update --prefer-stable --prefer-source --no-interaction --no-progress --no-suggest'
cache:
directories:
- vendor/
nodes:
analysis:
project_setup:
override: true
tests:
override: [php-scrutinizer-run]

filter:
paths: [src/*]
excluded_paths: [tests/*, vendor/*]

before_commands:
- 'composer self-update'
- 'composer update --prefer-stable --prefer-source --no-interaction --no-scripts --no-progress --no-suggest'

coding_style:
php:
upper_lower_casing:
Expand All @@ -17,8 +28,8 @@ coding_style:
true_false_null: lower
spaces:
around_operators:
concatenation: true
negation: false
concatenation: true
negation: false
other:
after_type_cast: true

Expand All @@ -34,7 +45,6 @@ tools:
enabled: true
config:
ruleset: 'unusedcode,naming,design,controversial,codesize'

php_cpd: true
php_loc: true
php_pdepend: true
Expand Down
20 changes: 11 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ env:
- COMPOSER_FLAGS="--prefer-stable --prefer-dist"

php:
- 7.2
- 7.3
- 7.4snapshot
- nightly

matrix:
Expand All @@ -22,25 +24,25 @@ matrix:
- php: 7.1
env:
- COMPOSER_FLAGS="--prefer-lowest --prefer-stable --prefer-dist"
- php: 7.2
- php: 7.1
env:
- TEST_VERSION=true
- COMPOSER_FLAGS="--prefer-stable --prefer-dist"
allow_failures:
- php: nightly

before_install:
- if [[ -z $TEST_VERSION && -f "/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini" ]]; then phpenv config-rm xdebug.ini; fi
- composer global require hirak/prestissimo
- composer self-update --stable --no-progress
- if [[ -z $TEST_VERSION && -f "/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini" ]]; then phpenv config-rm xdebug.ini; fi
- composer global require hirak/prestissimo
- composer self-update --stable --no-progress

install:
- travis_retry composer update $COMPOSER_FLAGS --no-interaction --no-scripts --no-progress
- if [[ $TEST_VERSION ]]; then travis_retry composer require php-coveralls/php-coveralls $COMPOSER_FLAGS --no-interaction --no-scripts --no-progress ; fi
- travis_retry composer update $COMPOSER_FLAGS --no-interaction --no-progress
- if [[ $TEST_VERSION ]]; then travis_retry composer require php-coveralls/php-coveralls $COMPOSER_FLAGS --no-interaction --no-scripts --no-progress ; fi

script:
- if [[ $TEST_VERSION ]]; then composer qa && composer report-phpunit-clover ; fi
- if [[ -z $TEST_VERSION ]]; then composer test-phpunit ; fi
- if [[ $TEST_VERSION ]]; then composer qa && composer report-phpunit-clover ; fi
- if [[ -z $TEST_VERSION ]]; then composer test-phpunit ; fi

after_script:
- if [[ $TEST_VERSION ]]; then travis_retry php vendor/bin/php-coveralls --verbose ; fi
- if [[ $TEST_VERSION ]]; then travis_retry php vendor/bin/php-coveralls --verbose ; fi
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,24 @@
"prefer-stable": true,
"require": {
"php": "^7.1",
"phpgears/cqrs": "~0.2",
"phpgears/cqrs": "~0.3",
"symfony/messenger": "^4.3"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.1",
"friendsofphp/php-cs-fixer": "^2.0",
"infection/infection": "^0.9",
"phpmd/phpmd": "^2.0",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-deprecation-rules": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11",
"phpunit/phpunit": "^6.0|^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "~0.11.12",
"phpstan/phpstan-deprecation-rules": "~0.11.2",
"phpstan/phpstan-strict-rules": "~0.11.1",
"phpunit/phpunit": "^7.0|^8.0",
"povils/phpmnd": "^2.0",
"roave/security-advisories": "dev-master",
"sebastian/phpcpd": "^3.0|^4.0",
"squizlabs/php_codesniffer": "^2.0",
"thecodingmachine/phpstan-strict-rules": "^0.11"
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.0",
"thecodingmachine/phpstan-strict-rules": "~0.11.2"
},
"suggest": {
},
Expand Down
5 changes: 0 additions & 5 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon

parameters:
level: max
paths:
Expand Down
4 changes: 2 additions & 2 deletions tests/Messenger/CommandBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public function testHandling(): void
$messengerMock = $this->getMockBuilder(MessageBusInterface::class)
->disableOriginalConstructor()
->getMock();
$messengerMock->expects($this->once())
$messengerMock->expects(static::once())
->method('dispatch')
->will($this->returnValue(new Envelope(new \stdClass())));
->will(static::returnValue(new Envelope(new \stdClass())));
/* @var MessageBusInterface $messengerMock */

(new CommandBus($messengerMock))->handle(CommandStub::instance());
Expand Down
27 changes: 14 additions & 13 deletions tests/Messenger/CommandHandlerLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Gears\CQRS\Symfony\Messenger\Tests;

use Gears\CQRS\Exception\InvalidCommandException;
use Gears\CQRS\Exception\InvalidCommandHandlerException;
use Gears\CQRS\Symfony\Messenger\CommandHandlerLocator;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\CommandHandlerStub;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\CommandStub;
Expand All @@ -25,25 +27,23 @@
*/
class CommandHandlerLocatorTest extends TestCase
{
/**
* @expectedException \Gears\CQRS\Exception\InvalidCommandException
* @expectedExceptionMessage Command must implement Gears\CQRS\Command interface, stdClass given
*/
public function testInvalidCommand(): void
{
$this->expectException(InvalidCommandException::class);
$this->expectExceptionMessage('Command must implement Gears\CQRS\Command interface, stdClass given');

$envelope = new Envelope(new \stdClass());

foreach ((new CommandHandlerLocator([]))->getHandlers($envelope) as $handler) {
continue;
}
}

/**
* @expectedException \Gears\CQRS\Exception\InvalidCommandHandlerException
* @expectedExceptionMessage Only one command handler allowed, 2 given
*/
public function testInvalidCommandHandlersCount(): void
{
$this->expectException(InvalidCommandHandlerException::class);
$this->expectExceptionMessage('Only one command handler allowed, 2 given');

$commandMap = [CommandStub::class => ['', '']];
$envelope = new Envelope(new \stdClass());

Expand All @@ -52,12 +52,13 @@ public function testInvalidCommandHandlersCount(): void
}
}

/**
* @expectedException \Gears\CQRS\Exception\InvalidCommandHandlerException
* @expectedExceptionMessage Command handler must implement Gears\CQRS\CommandHandler interface, string given
*/
public function testInvalidCommandHandler(): void
{
$this->expectException(InvalidCommandHandlerException::class);
$this->expectExceptionMessage(
'Command handler must implement Gears\CQRS\CommandHandler interface, string given'
);

$commandMap = [CommandStub::class => ['']];
$envelope = new Envelope(CommandStub::instance());

Expand All @@ -73,7 +74,7 @@ public function testCommandHandler(): void
$envelope = new Envelope(CommandStub::instance());

foreach ((new CommandHandlerLocator($commandMap))->getHandlers($envelope) as $handler) {
$this->assertInstanceOf(HandlerDescriptor::class, $handler);
static::assertInstanceOf(HandlerDescriptor::class, $handler);
}
}
}
20 changes: 11 additions & 9 deletions tests/Messenger/ContainerAwareCommandHandlerLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Gears\CQRS\Symfony\Messenger\Tests;

use Gears\CQRS\Exception\InvalidCommandHandlerException;
use Gears\CQRS\Symfony\Messenger\ContainerAwareCommandHandlerLocator;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\CommandHandlerStub;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\CommandStub;
Expand All @@ -26,19 +27,20 @@
*/
class ContainerAwareCommandHandlerLocatorTest extends TestCase
{
/**
* @expectedException \Gears\CQRS\Exception\InvalidCommandHandlerException
* @expectedExceptionMessage Command handler must implement Gears\CQRS\CommandHandler interface, string given
*/
public function testInvalidCommandHandler(): void
{
$this->expectException(InvalidCommandHandlerException::class);
$this->expectExceptionMessage(
'Command handler must implement Gears\CQRS\CommandHandler interface, string given'
);

$container = $this->getMockBuilder(ContainerInterface::class)
->disableOriginalConstructor()
->getMock();
$container->expects($this->once())
$container->expects(static::once())
->method('get')
->with('handler')
->will($this->returnValue(''));
->will(static::returnValue(''));
/* @var ContainerInterface $container */

$commandMap = [CommandStub::class => ['handler']];
Expand All @@ -57,18 +59,18 @@ public function testCommandHandler(): void
$container = $this->getMockBuilder(ContainerInterface::class)
->disableOriginalConstructor()
->getMock();
$container->expects($this->once())
$container->expects(static::once())
->method('get')
->with('handler')
->will($this->returnValue($commandHandler));
->will(static::returnValue($commandHandler));
/* @var ContainerInterface $container */

$commandMap = [CommandStub::class => ['handler']];
$locator = new ContainerAwareCommandHandlerLocator($container, $commandMap);
$envelope = new Envelope(CommandStub::instance());

foreach ($locator->getHandlers($envelope) as $handler) {
$this->assertInstanceOf(HandlerDescriptor::class, $handler);
static::assertInstanceOf(HandlerDescriptor::class, $handler);
}
}
}
18 changes: 9 additions & 9 deletions tests/Messenger/ContainerAwareQueryHandlerLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Gears\CQRS\Symfony\Messenger\Tests;

use Gears\CQRS\Exception\InvalidQueryHandlerException;
use Gears\CQRS\Symfony\Messenger\ContainerAwareQueryHandlerLocator;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\QueryHandlerStub;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\QueryStub;
Expand All @@ -26,19 +27,18 @@
*/
class ContainerAwareQueryHandlerLocatorTest extends TestCase
{
/**
* @expectedException \Gears\CQRS\Exception\InvalidQueryHandlerException
* @expectedExceptionMessage Query handler must implement Gears\CQRS\QueryHandler interface, string given
*/
public function testInvalidCommandHandler(): void
{
$this->expectException(InvalidQueryHandlerException::class);
$this->expectExceptionMessage('Query handler must implement Gears\CQRS\QueryHandler interface, string given');

$container = $this->getMockBuilder(ContainerInterface::class)
->disableOriginalConstructor()
->getMock();
$container->expects($this->once())
$container->expects(static::once())
->method('get')
->with('handler')
->will($this->returnValue(''));
->will(static::returnValue(''));
/* @var ContainerInterface $container */

$queryMap = [QueryStub::class => ['handler']];
Expand All @@ -57,18 +57,18 @@ public function testQueryHandler(): void
$container = $this->getMockBuilder(ContainerInterface::class)
->disableOriginalConstructor()
->getMock();
$container->expects($this->once())
$container->expects(static::once())
->method('get')
->with('handler')
->will($this->returnValue($queryHandler));
->will(static::returnValue($queryHandler));
/* @var ContainerInterface $container */

$queryMap = [QueryStub::class => ['handler']];
$locator = new ContainerAwareQueryHandlerLocator($container, $queryMap);
$envelope = new Envelope(QueryStub::instance());

foreach ($locator->getHandlers($envelope) as $handler) {
$this->assertInstanceOf(HandlerDescriptor::class, $handler);
static::assertInstanceOf(HandlerDescriptor::class, $handler);
}
}
}
18 changes: 10 additions & 8 deletions tests/Messenger/QueryBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Gears\CQRS\Symfony\Messenger\Tests;

use Gears\CQRS\Exception\QueryReturnException;
use Gears\CQRS\Symfony\Messenger\QueryBus;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\DTOStub;
use Gears\CQRS\Symfony\Messenger\Tests\Stub\QueryStub;
Expand All @@ -27,12 +28,13 @@
*/
class QueryBusTest extends TestCase
{
/**
* @expectedException \Gears\CQRS\Exception\QueryReturnException
* @expectedExceptionMessageRegExp /^Query handler for .+\\QueryStub should return an instance of Gears\\DTO\\DTO/
*/
public function testInvalidQueryResponse(): void
{
$this->expectException(QueryReturnException::class);
$this->expectExceptionMessageRegExp(
'/^Query handler for .+\\\QueryStub should return an instance of Gears\\\DTO\\\DTO/'
);

$callable = function ($class) {
return $class;
};
Expand All @@ -42,9 +44,9 @@ public function testInvalidQueryResponse(): void
$messengerMock = $this->getMockBuilder(MessageBusInterface::class)
->disableOriginalConstructor()
->getMock();
$messengerMock->expects($this->once())
$messengerMock->expects(static::once())
->method('dispatch')
->will($this->returnValue($returnEnvelope));
->will(static::returnValue($returnEnvelope));
/* @var MessageBusInterface $messengerMock */

(new QueryBus($messengerMock))->handle(QueryStub::instance());
Expand All @@ -61,9 +63,9 @@ public function testHandling(): void
$messengerMock = $this->getMockBuilder(MessageBusInterface::class)
->disableOriginalConstructor()
->getMock();
$messengerMock->expects($this->once())
$messengerMock->expects(static::once())
->method('dispatch')
->will($this->returnValue($returnEnvelope));
->will(static::returnValue($returnEnvelope));
/* @var MessageBusInterface $messengerMock */

(new QueryBus($messengerMock))->handle(QueryStub::instance());
Expand Down
Loading

0 comments on commit ce95a6b

Please sign in to comment.