From 167706d2e23409ab1185271f6b8729636f03f322 Mon Sep 17 00:00:00 2001 From: Thomas Vargiu Date: Fri, 1 Feb 2019 13:27:18 +0100 Subject: [PATCH 1/5] Updated dependencies --- .gitignore | 3 +- .php_cs | 56 ++++++++++-------------------- composer.json | 11 +++--- phpunit.xml.dist | 1 - tests/Container/CliFactoryTest.php | 2 +- tests/ModuleTest.php | 4 +-- 6 files changed, 29 insertions(+), 48 deletions(-) diff --git a/.gitignore b/.gitignore index dbbe959..8a571ca 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ composer.lock .project .settings vendor - +.phpunit.result.cache +.php_cs.cache \ No newline at end of file diff --git a/.php_cs b/.php_cs index 4b7b398..1ae7995 100644 --- a/.php_cs +++ b/.php_cs @@ -1,39 +1,21 @@ in('bin') - ->in('src') - ->in('tests'); -$config = Symfony\CS\Config\Config::create(); -$config->level(null); -$config->fixers( - array( - 'braces', - 'duplicate_semicolon', - 'elseif', - 'empty_return', - 'encoding', - 'eof_ending', - 'function_call_space', - 'function_declaration', - 'indentation', - 'join_function', - 'line_after_namespace', - 'linefeed', - 'lowercase_keywords', - 'parenthesis', - 'multiple_use', - 'method_argument_space', - 'object_operator', - 'php_closing_tag', - 'remove_lines_between_uses', - 'short_array_syntax', - 'short_tag', - 'standardize_not_equal', - 'trailing_spaces', - 'unused_use', - 'visibility', - 'whitespacy_lines', - ) -); -$config->finder($finder); + +$config = PhpCsFixer\Config::create(); +$config->setRules([ + '@PSR2' => true, +]); + +$finder = PhpCsFixer\Finder::create(); + +/* + * You can set manually these paths: + */ +$finder->in([ + 'bin', + 'src', + 'tests' +]); + +$config->setFinder($finder); + return $config; diff --git a/composer.json b/composer.json index 123b658..4146d7f 100644 --- a/composer.json +++ b/composer.json @@ -15,15 +15,14 @@ "php": "^7.0", "prolic/humus-amqp" : "^1.0", "container-interop/container-interop": "^1.1", - "sandrokeil/interop-config": "^1.0", - "symfony/console": "^2.5|^3.0", + "sandrokeil/interop-config": "^2.0", + "symfony/console": "^3.0|^4.0", "zendframework/zend-modulemanager": "^2.7" }, "require-dev": { - "phpunit/phpunit": "^5.4", - "phpspec/prophecy": "^1.6", - "friendsofphp/php-cs-fixer": "^1.11.5", - "satooshi/php-coveralls": "^1.0" + "phpunit/phpunit": "^6.0 || ^7.0 || ^8.0", + "friendsofphp/php-cs-fixer": "^2.14", + "php-coveralls/php-coveralls": "^2.1" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e01362b..8a0d104 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ stopOnFailure="false" processIsolation="false" backupGlobals="false" - syntaxCheck="true" > ./tests diff --git a/tests/Container/CliFactoryTest.php b/tests/Container/CliFactoryTest.php index 621abf2..9e5351b 100644 --- a/tests/Container/CliFactoryTest.php +++ b/tests/Container/CliFactoryTest.php @@ -24,7 +24,7 @@ use HumusAmqpModule\Container\CliFactory; use Interop\Container\ContainerInterface; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; /** diff --git a/tests/ModuleTest.php b/tests/ModuleTest.php index f3fe2d0..ab44380 100644 --- a/tests/ModuleTest.php +++ b/tests/ModuleTest.php @@ -23,7 +23,7 @@ namespace HumusAmqpModuleTest; use HumusAmqpModule\Module; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; /** * Class ModuleTest @@ -38,7 +38,7 @@ public function it_gets_config() { $module = new Module(); $config = $module->getConfig(); - $this->assertInternalType('array', $config); + $this->assertIsArray($config); $this->assertSame($config, unserialize(serialize($config))); } } From a6edf1c5601c644b284881f4a021edd55b6d9295 Mon Sep 17 00:00:00 2001 From: Thomas Vargiu Date: Fri, 1 Feb 2019 13:28:08 +0100 Subject: [PATCH 2/5] PHPCS --- src/Container/CliFactory.php | 2 +- src/Module.php | 2 +- tests/Container/CliFactoryTest.php | 2 +- tests/ModuleTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Container/CliFactory.php b/src/Container/CliFactory.php index 73bcb5f..a890152 100644 --- a/src/Container/CliFactory.php +++ b/src/Container/CliFactory.php @@ -18,7 +18,7 @@ * and is licensed under the MIT license. */ -declare (strict_types=1); +declare(strict_types=1); namespace HumusAmqpModule\Container; diff --git a/src/Module.php b/src/Module.php index b0b199c..3306aca 100644 --- a/src/Module.php +++ b/src/Module.php @@ -18,7 +18,7 @@ * and is licensed under the MIT license. */ -declare (strict_types=1); +declare(strict_types=1); namespace HumusAmqpModule; diff --git a/tests/Container/CliFactoryTest.php b/tests/Container/CliFactoryTest.php index 9e5351b..5cbb0e8 100644 --- a/tests/Container/CliFactoryTest.php +++ b/tests/Container/CliFactoryTest.php @@ -18,7 +18,7 @@ * and is licensed under the MIT license. */ -declare (strict_types=1); +declare(strict_types=1); namespace HumusAmqpModuleTest\Container; diff --git a/tests/ModuleTest.php b/tests/ModuleTest.php index ab44380..b4e026a 100644 --- a/tests/ModuleTest.php +++ b/tests/ModuleTest.php @@ -18,7 +18,7 @@ * and is licensed under the MIT license. */ -declare (strict_types=1); +declare(strict_types=1); namespace HumusAmqpModuleTest; From 30e9945a59370b4d948dbeb75dcedc29a4c3647d Mon Sep 17 00:00:00 2001 From: Thomas Vargiu Date: Fri, 1 Feb 2019 13:33:43 +0100 Subject: [PATCH 3/5] CI build --- .travis.yml | 57 +++++++++++++++++++++++--------------------- composer.json | 2 +- tests/ModuleTest.php | 2 +- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5f1dd2d..402be70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,30 @@ -language: php - -sudo: false - -php: - - 7.0 - -env: - matrix: - - DEPENDENCIES="" - - DEPENDENCIES="--prefer-lowest --prefer-stable" - -cache: - directories: - - $HOME/.composer/cache - -before_script: - - phpenv config-rm xdebug.ini - - composer self-update - - composer update --prefer-dist $DEPENDENCIES - -script: - - php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml - - ./vendor/bin/php-cs-fixer fix -v --diff --dry-run - -after_success: - - php vendor/bin/coveralls -v +language: php + +sudo: false + +php: + - 7.0 + - 7.1 + - 7.2 + - 7.3 + +env: + matrix: + - DEPENDENCIES="" + - DEPENDENCIES="--prefer-lowest --prefer-stable" + +cache: + directories: + - $HOME/.composer/cache + +before_script: + - phpenv config-rm xdebug.ini + - composer self-update + - composer update --prefer-dist $DEPENDENCIES + +script: + - php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml + - ./vendor/bin/php-cs-fixer fix -v --diff --dry-run + +after_success: + - travis_retry php vendor/bin/php-coveralls -v diff --git a/composer.json b/composer.json index 4146d7f..4a6c3f7 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "zendframework/zend-modulemanager": "^2.7" }, "require-dev": { - "phpunit/phpunit": "^6.0 || ^7.0 || ^8.0", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0", "friendsofphp/php-cs-fixer": "^2.14", "php-coveralls/php-coveralls": "^2.1" }, diff --git a/tests/ModuleTest.php b/tests/ModuleTest.php index b4e026a..a204366 100644 --- a/tests/ModuleTest.php +++ b/tests/ModuleTest.php @@ -38,7 +38,7 @@ public function it_gets_config() { $module = new Module(); $config = $module->getConfig(); - $this->assertIsArray($config); + $this->assertInternalType('array', $config); $this->assertSame($config, unserialize(serialize($config))); } } From 89a3600e555c34c4fc91ccd9101b1d998e020aeb Mon Sep 17 00:00:00 2001 From: Thomas Vargiu Date: Fri, 1 Feb 2019 13:59:52 +0100 Subject: [PATCH 4/5] Fix dependency compatibility --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4a6c3f7..6f355c3 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "php": "^7.0", "prolic/humus-amqp" : "^1.0", "container-interop/container-interop": "^1.1", - "sandrokeil/interop-config": "^2.0", + "sandrokeil/interop-config": "^1.0 || ^2.0", "symfony/console": "^3.0|^4.0", "zendframework/zend-modulemanager": "^2.7" }, From 8c3594df0aa4c150e077b32232dcd27f6d366bc6 Mon Sep 17 00:00:00 2001 From: Thomas Vargiu Date: Fri, 1 Feb 2019 14:26:09 +0100 Subject: [PATCH 5/5] Fixed test for phpunit 8.0 --- tests/ModuleTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/ModuleTest.php b/tests/ModuleTest.php index a204366..7265d0d 100644 --- a/tests/ModuleTest.php +++ b/tests/ModuleTest.php @@ -38,7 +38,12 @@ public function it_gets_config() { $module = new Module(); $config = $module->getConfig(); - $this->assertInternalType('array', $config); + if (\method_exists($this, 'assertIsArray')) { + $this->assertIsArray($config); + } else { + $this->assertInternalType('array', $config); + } + $this->assertSame($config, unserialize(serialize($config))); } }