Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tactician v2 #115

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/bootstrap.php export-ignore
/CHANGELOG.md export-ignore
/LICENSE export-ignore
/phpunit.xml.dist export-ignore
Expand Down
57 changes: 28 additions & 29 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
filter:
excluded_paths: [Tests/*]
excluded_paths: [tests/*]

build:
nodes:
analysis:
environment:
php:
version: 7.2
cache:
disabled: false
directories:
- ~/.composer/cache
project_setup:
override: true
tests:
override:
- php-scrutinizer-run
- phpcs-run
dependencies:
override:
- composer install --no-interaction --prefer-dist

checks:
php:
code_rating: true
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 600
runs: 3
php_analyzer: true
php_code_coverage: false
php_code_sniffer:
config:
standard: PSR2
filter:
paths: ['./']
php_loc:
enabled: true
excluded_dirs: [vendor, Tests]
php_cpd:
enabled: true
excluded_dirs: [vendor, Tests]
timeout: 900

build_failure_conditions:
- 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed
- 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection
81 changes: 38 additions & 43 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,47 @@
language: php

sudo: false

cache:
directories:
- "$HOME/.composer/cache"

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- nightly

cache:
directories:
- "$HOME/.composer/cache"

env:
matrix:
- DOCTRINE="true"
- DOCTRINE="false"
- SYMFONY_VERSION="2.8.*"
- SYMFONY_VERSION="3.3.*"
- SYMFONY_VERSION="3.4.*"
- SYMFONY_VERSION="4.0.*"
- SYMFONY_VERSION="4.1.*"
- SYMFONY_VERSION="4.2.*"

matrix:
- DEPENDENCIES=
- DEPENDENCIES=--prefer-lowest

install:
composer update --no-interaction --prefer-stable --prefer-dist $DEPENDENCIES

script: vendor/bin/phpunit

stages:
- Validate composer.json
- Code Quality
- Test

jobs:
allow_failures:
- php: nightly

include:
- php: 7.0
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
- php: 7.0
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DOCTRINE="false"
exclude:
- php: 7.0
env: SYMFONY_VERSION="4.0.*"
- php: 7.0
env: SYMFONY_VERSION="4.1.*"
- php: 7.0
env: SYMFONY_VERSION="4.2.*"

before_install:
- composer self-update || true
- if [ "$DOCTRINE" == "false" ]; then composer remove league/tactician-doctrine --dev --no-update; fi
- if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi

install: composer update $COMPOSER_FLAGS --prefer-dist --no-interaction

script: ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- stage: Code Quality
- name: PHPStan
php: 7.2
script: vendor/bin/phpstan analyse
- stage: Test
- name: Coverage
php: 7.2
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
script:
- ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
after_script:
- wget https://github.com/scrutinizer-ci/ocular/releases/download/1.5.2/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Symfony2 Bundle for the Tactician library
Open a command console, enter your project directory and execute the
following command to download the latest stable release for this bundle:

```bash
$ composer require league/tactician-bundle
```sh
composer require league/tactician-bundle
```

This command requires you to have Composer installed globally, as explained
Expand Down
10 changes: 0 additions & 10 deletions bootstrap.php

This file was deleted.

62 changes: 22 additions & 40 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,8 @@
"description" : "Bundle to integrate Tactician with Symfony projects",
"type" : "symfony-bundle",
"authors" : [
{
"name": "Rafael Dohms",
"homepage": "http://doh.ms"
},
{
"name": "Richard Tuin",
"homepage": "http://www.rtuin.nl/"
},
{
"name" : "Xander Smalbil",
"email" : "[email protected]"
},
{
"name": "Ross Tuck",
"email": "[email protected]"
}
{ "name": "Ross Tuck", "email": "[email protected]" },
{ "name": "Contributors", "homepage": "https://github.com/thephpleague/tactician-bundle/graphs/contributors" }
],
"keywords" : [
"tactician",
Expand All @@ -29,21 +15,26 @@
"MIT"
],
"require" : {
"php": ">=7.0",
"league/tactician": "^1.0",
"league/tactician-logger": "^0.10.0",
"league/tactician-container": "^2.0",
"symfony/config": "^2.8|^3.3|^4.0",
"symfony/dependency-injection": "^2.8|^3.3|^4.0",
"symfony/http-kernel": "^2.8|^3.3|^4.0",
"symfony/yaml": "^2.8|^3.3|^4.0"
"php": "^7.2",
"league/tactician": "dev-master as 1.1.16",
"symfony/config": "^4.4",
"symfony/dependency-injection": "^4.4",
"symfony/http-kernel": "^4.4",
"symfony/yaml": "^4.4"
},
"require-dev": {
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"mockery/mockery": "^1.2",
"phpstan/phpstan": "^0.11.19",
"phpstan/phpstan-phpunit": "^0.11.2",
"phpstan/phpstan-strict-rules": "^0.11.1",
"phpunit/phpunit": "^8",
"symfony/console": "^4.4",
"symfony/framework-bundle": "^4.4"
},
"minimum-stability": "beta",
"suggest": {
"symfony/console": "For debugging command-to-handler routing using the tactician:debug console command",
"symfony/validator": "For command validator middleware",
"symfony/security": "For command security middleware",
"league/tactician-doctrine": "For doctrine transaction middleware"
"symfony/console": "For debugging command-to-handler routing using the tactician:debug console command"
},
"autoload" : {
"psr-4" : {
Expand All @@ -60,16 +51,7 @@
"dev-master": "1.0-dev"
}
},
"require-dev": {
"phpunit/phpunit": "~6.1",
"mockery/mockery": "~1.0",
"symfony/console": "^2.8|^3.3|^4.0",
"symfony/security": "^2.8|^3.3|^4.0",
"symfony/validator": "^2.8|^3.3|^4.0",
"league/tactician-doctrine": "^1.1.1",
"symfony/framework-bundle": "^2.8.15|^3.3|^4.0",
"symfony/security-bundle": "^2.8|^3.3|^4.0",
"matthiasnoback/symfony-config-test": "^3.0",
"matthiasnoback/symfony-dependency-injection-test": "^2.1"
"config": {
"sort-packages": true
}
}
10 changes: 10 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
parameters:
level: max
paths:
- %currentWorkingDirectory%/src
- %currentWorkingDirectory%/tests

includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
37 changes: 11 additions & 26 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
beStrictAboutTestsThatDoNotTestAnything="false"
stopOnFailure="false">
bootstrap="tests/bootstrap.php"
executionOrder="random"
>
<testsuites>
<testsuite name="unit">
<directory>tests/</directory>
<exclude>tests/Integration</exclude>
</testsuite>

<testsuite name="integration">
<directory>tests/Integration</directory>
<testsuite name="Main Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<server name="SHELL_VERBOSITY" value="-1"/>
</php>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
12 changes: 7 additions & 5 deletions src/Command/DebugCommand.php → src/Console/DebugCommand.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
declare(strict_types=1);

namespace League\Tactician\Bundle\Command;
namespace League\Tactician\Bundle\Console;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class DebugCommand extends Command
final class DebugCommand extends Command
{
/**
* @var array
Expand All @@ -22,12 +22,12 @@ public function __construct(array $mappings)
$this->mappings = $mappings;
}

protected function configure()
protected function configure() : void
{
$this->setName('debug:tactician');
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output) : int
{
$io = new SymfonyStyle($input, $output);

Expand All @@ -44,9 +44,11 @@ public function execute(InputInterface $input, OutputInterface $output)
$io->warning("No registered commands for bus $busId");
}
}

return 0;
}

private function mappingToRows(array $map)
private function mappingToRows(array $map) : array
{
$rows = [];
foreach ($map as $commandName => $handlerService) {
Expand Down
Loading