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 a59e611 commit c2e9e61
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 66 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
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@
"require": {
"php": "^7.1",
"league/tactician": "^1.0",
"phpgears/cqrs": "~0.2"
"phpgears/cqrs": "~0.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
8 changes: 0 additions & 8 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
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:
- src
ignoreErrors:
- '/^Method Gears\\CQRS\\Tactician\\QueryInflector::inflect\(\) has parameter \$handler with no typehint specified\.$/'
- '/^Method Gears\\CQRS\\Tactician\\CommandInflector::inflect\(\) has parameter \$handler with no typehint specified\.$/'
5 changes: 4 additions & 1 deletion src/CommandInflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
final class CommandInflector implements MethodNameInflector
{
/**
* {@inheritdoc}
* Return the method name to call on the command handler and return it.
*
* @param mixed $command
* @param mixed $handler
*
* @throws InvalidCommandException
* @throws InvalidCommandHandlerException
Expand Down
5 changes: 4 additions & 1 deletion src/QueryInflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
final class QueryInflector implements MethodNameInflector
{
/**
* {@inheritdoc}
* Return the method name to call on the command handler and return it.
*
* @param mixed $command
* @param mixed $handler
*
* @throws InvalidQueryException
* @throws InvalidQueryHandlerException
Expand Down
2 changes: 1 addition & 1 deletion tests/Tactician/CommandBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testHandling(): void
$tacticianMock = $this->getMockBuilder(TacticianBus::class)
->disableOriginalConstructor()
->getMock();
$tacticianMock->expects($this->once())
$tacticianMock->expects(static::once())
->method('handle');
/* @var TacticianBus $tacticianMock */

Expand Down
4 changes: 2 additions & 2 deletions tests/Tactician/CommandHandlerMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public function testHandling(): void
$locatorMock = $this->getMockBuilder(HandlerLocator::class)
->disableOriginalConstructor()
->getMock();
$locatorMock->expects($this->once())
$locatorMock->expects(static::once())
->method('getHandlerForCommand')
->will($this->returnValue(new CommandHandlerStub()));
->will(static::returnValue(new CommandHandlerStub()));
/* @var HandlerLocator $locatorMock */

(new CommandHandlerMiddleware($locatorMock))->execute(CommandStub::instance(), 'strlen');
Expand Down
20 changes: 11 additions & 9 deletions tests/Tactician/CommandInflectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Gears\CQRS\Tactician\Tests;

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

(new CommandInflector())->inflect('', '');
}

/**
* @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'
);

(new CommandInflector())->inflect(CommandStub::instance(), '');
}

Expand All @@ -46,6 +48,6 @@ public function testInflect(): void
$inflected = (new CommandInflector())
->inflect(CommandStub::instance(), new CommandHandlerStub());

$this->assertSame('handle', $inflected);
static::assertSame('handle', $inflected);
}
}
18 changes: 10 additions & 8 deletions tests/Tactician/QueryBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Gears\CQRS\Tactician\Tests;

use Gears\CQRS\Exception\QueryReturnException;
use Gears\CQRS\Tactician\QueryBus;
use Gears\CQRS\Tactician\Tests\Stub\DTOStub;
use Gears\CQRS\Tactician\Tests\Stub\QueryStub;
Expand All @@ -29,26 +30,27 @@ public function testHandling(): void
$tacticianMock = $this->getMockBuilder(TacticianBus::class)
->disableOriginalConstructor()
->getMock();
$tacticianMock->expects($this->once())
$tacticianMock->expects(static::once())
->method('handle')
->will($this->returnValue(DTOStub::instance()));
->will(static::returnValue(DTOStub::instance()));
/* @var TacticianBus $tacticianMock */

(new QueryBus($tacticianMock))->handle(QueryStub::instance());
}

/**
* @expectedException \Gears\CQRS\Exception\QueryReturnException
* @expectedExceptionMessageRegExp /^Query handler for .+\\QueryStub should return an instance of Gears\\DTO\\DTO$/
*/
public function testInvalidReturn(): void
{
$this->expectException(QueryReturnException::class);
$this->expectExceptionMessageRegExp(
'/^Query handler for .+\\\QueryStub should return an instance of Gears\\\DTO\\\DTO$/'
);

$tacticianMock = $this->getMockBuilder(TacticianBus::class)
->disableOriginalConstructor()
->getMock();
$tacticianMock->expects($this->once())
$tacticianMock->expects(static::once())
->method('handle')
->will($this->returnValue(false));
->will(static::returnValue(false));
/* @var TacticianBus $tacticianMock */

(new QueryBus($tacticianMock))->handle(QueryStub::instance());
Expand Down
4 changes: 2 additions & 2 deletions tests/Tactician/QueryHandlerMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public function testHandling(): void
$locatorMock = $this->getMockBuilder(HandlerLocator::class)
->disableOriginalConstructor()
->getMock();
$locatorMock->expects($this->once())
$locatorMock->expects(static::once())
->method('getHandlerForCommand')
->will($this->returnValue(new QueryHandlerStub()));
->will(static::returnValue(new QueryHandlerStub()));
/* @var HandlerLocator $locatorMock */

(new QueryHandlerMiddleware($locatorMock))->execute(QueryStub::instance(), 'strlen');
Expand Down
18 changes: 9 additions & 9 deletions tests/Tactician/QueryInflectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Gears\CQRS\Tactician\Tests;

use Gears\CQRS\Exception\InvalidQueryException;
use Gears\CQRS\Exception\InvalidQueryHandlerException;
use Gears\CQRS\Tactician\QueryInflector;
use Gears\CQRS\Tactician\Tests\Stub\QueryHandlerStub;
use Gears\CQRS\Tactician\Tests\Stub\QueryStub;
Expand All @@ -23,21 +25,19 @@
*/
class QueryInflectorTest extends TestCase
{
/**
* @expectedException \Gears\CQRS\Exception\InvalidQueryException
* @expectedExceptionMessage Query must implement Gears\CQRS\Query interface, string given
*/
public function testInvalidCommand(): void
{
$this->expectException(InvalidQueryException::class);
$this->expectExceptionMessage('Query must implement Gears\CQRS\Query interface, string given');

(new QueryInflector())->inflect('', '');
}

/**
* @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');

(new QueryInflector())->inflect(QueryStub::instance(), '');
}

Expand All @@ -46,6 +46,6 @@ public function testInflect(): void
$inflected = (new QueryInflector())
->inflect(QueryStub::instance(), new QueryHandlerStub());

$this->assertSame('handle', $inflected);
static::assertSame('handle', $inflected);
}
}

0 comments on commit c2e9e61

Please sign in to comment.