diff --git a/.gitignore b/.gitignore index 28c9c12..7b1d552 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .php_cs.cache composer.lock vendor/ +coverage/ diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..9c99739 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,10 @@ +filter: + paths: [src/] + +checks: + php: + code_rating: true + duplication: true + +tools: + external_code_coverage: true diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a66657f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,48 @@ +language: php + +sudo: false + +cache: + directories: + - $HOME/.composer/cache + +php: + - 5.6 + - 7.0 + - 7.1 + - 7.2 + +branches: + only: + - master + +env: + global: + - COMMAND="composer test" + +matrix: + fast_finish: true + include: + - php: 5.6 + env: + - COMPOSER_FLAGS="--prefer-stable --prefer-lowest" + - COVERAGE=true + - COMMAND="composer code-coverage" + - php: 7.2 + env: + - CS_FIX=true + - COMMAND="composer cs-fix" + +before_install: + - travis_retry composer self-update + - if [[ "$CS_FIX" = true ]]; then phpenv config-rm xdebug.ini || true; fi + +install: + - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction + +script: + - travis_wait $COMMAND + +after_success: + - if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi + - if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover coverage/coverage.xml; fi diff --git a/README.md b/README.md index a916ded..b165ce4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # RedirectionIO Proxy for Symfony +[![Latest Version](https://img.shields.io/github/release/redirectionio/proxy-symfony.svg)](https://github.com/redirectionio/proxy-symfony) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE) [![Build Status](https://img.shields.io/travis/redirectionio/proxy-symfony/master.svg)](https://travis-ci.org/redirectionio/proxy-symfony) [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/redirectionio/proxy-symfony.svg)](https://scrutinizer-ci.com/g/redirectionio/proxy-symfony) diff --git a/Tests/EventListener/RequestResponseListenerTest.php b/Tests/EventListener/RequestResponseListenerTest.php index ed601eb..21ebb8b 100644 --- a/Tests/EventListener/RequestResponseListenerTest.php +++ b/Tests/EventListener/RequestResponseListenerTest.php @@ -83,8 +83,8 @@ private static function startAgent($port = 3100) } // find fake_agent location - $parentFolder = substr(__DIR__, -27, -20); - $fakeAgent = ('symfony' === $parentFolder) ? + $parentFolder = substr(__DIR__, -28, -19); + $fakeAgent = ('/symfony/' === $parentFolder) ? __DIR__ . '/../../../sdk/src/Resources/fake_agent.php' : './vendor/redirectionio/proxy-sdk/src/Resources/fake_agent.php'; diff --git a/composer.json b/composer.json index 973e949..519b0a5 100644 --- a/composer.json +++ b/composer.json @@ -18,30 +18,27 @@ } ], "require": { - "redirectionio/proxy-sdk": "dev-master" + "redirectionio/proxy-sdk": "^1.0" }, "require-dev": { - "symfony/http-foundation": "^4.0", - "symfony/http-kernel": "^4.0", + "friendsofphp/php-cs-fixer": "^2.10", + "symfony/http-foundation": "^3.4", + "symfony/http-kernel": "^3.4", "symfony/phpunit-bridge": "^3.4@beta", "symfony/process": "^3.3" }, "autoload": { "psr-4": { - "RedirectionIO\\Client\\SymfonyBundle\\": "" + "RedirectionIO\\Client\\SymfonyBundle\\": "src/" } }, - "repositories": [ - { - "type": "path", - "url": "../sdk" - } - ], "config": { "sort-packages": true }, "scripts": { - "test": "vendor/bin/simple-phpunit" + "test": "vendor/bin/simple-phpunit", + "cs-fix": "vendor/bin/php-cs-fixer fix --config=.php_cs --dry-run --diff", + "code-coverage": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=coverage/coverage.xml --coverage-html=coverage/html" }, "extra": { "branch-alias": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b3c3227..a766be1 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,7 +20,7 @@ - ./ + ./src/EventListener/RequestResponseListener.php ./Tests ./vendor diff --git a/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php similarity index 100% rename from DependencyInjection/Configuration.php rename to src/DependencyInjection/Configuration.php diff --git a/DependencyInjection/RedirectionIOClientSymfonyExtension.php b/src/DependencyInjection/RedirectionIOClientSymfonyExtension.php similarity index 100% rename from DependencyInjection/RedirectionIOClientSymfonyExtension.php rename to src/DependencyInjection/RedirectionIOClientSymfonyExtension.php diff --git a/EventListener/RequestResponseListener.php b/src/EventListener/RequestResponseListener.php similarity index 100% rename from EventListener/RequestResponseListener.php rename to src/EventListener/RequestResponseListener.php diff --git a/Resources/config/routing.xml b/src/Resources/config/routing.xml similarity index 100% rename from Resources/config/routing.xml rename to src/Resources/config/routing.xml diff --git a/Resources/config/services.xml b/src/Resources/config/services.xml similarity index 100% rename from Resources/config/services.xml rename to src/Resources/config/services.xml