From 261a674a8a8aeb20bcd3d4115abbb3d49882df8e Mon Sep 17 00:00:00 2001 From: Mponos George Date: Sun, 5 Jul 2020 15:19:33 +0300 Subject: [PATCH] update travis (#36) * update travis * Fix minimum allowed guzzle version * Fix travis * Make tests compatible with version 9 --- .travis.yml | 17 ++- composer.json | 10 +- phpcs.xml.dist | 129 ++++++++++++++++-- phpstan.neon | 3 + tests/Handler/MultiRecordArrayHandlerTest.php | 18 +-- 5 files changed, 142 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab46174..ef45407 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,19 @@ language: php -php: - - 7.2 - - 7.3 - - 7.4 +matrix: + include: + - php: 7.2 + dist: bionic + - php: 7.2 + dist: bionic + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" + - php: 7.3 + dist: bionic + - php: 7.4 + dist: bionic before_script: - - composer install --prefer-dist --no-interaction + - composer update $COMPOSER_FLAGS --prefer-dist --no-interaction script: - php vendor/bin/phpunit --coverage-clover=clover.xml diff --git a/composer.json b/composer.json index feb0b61..2107999 100644 --- a/composer.json +++ b/composer.json @@ -28,22 +28,22 @@ "require": { "php": ">=7.2", "ext-json": "*", - "guzzlehttp/guzzle": "6.*", + "guzzlehttp/guzzle": "^6.1", "psr/log": "^1.1" }, "require-dev": { - "phpstan/phpstan": "~0.12.30", + "phpstan/phpstan": "~0.12.32", "phpstan/phpstan-phpunit": "^0.12.11", "phpstan/phpstan-strict-rules": "^0.12.2", - "phpunit/phpunit": "~8.5.8", - "webthink/codesniffer": "2.*" + "phpunit/phpunit": "^8.5.8 || ^9.2.5", + "squizlabs/php_codesniffer": "^3.5.5" }, "suggest": { "monolog/monolog": "A PSR-3 logger to send your logs to files, sockets and various web services" }, "scripts": { "test": "php vendor/bin/phpunit", - "phpcs": "php vendor/bin/phpcs ./src ./tests", + "phpcs": "php vendor/bin/phpcs ./src ./tests -n", "phpcbf": "php vendor/bin/phpcbf ./src ./tests" }, "extra": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 1d14eeb..64852b7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -5,20 +5,127 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - /tests/ + + + + + + + + + - + + + + + + - - + - + + + + + + + + + + + + + 5 + diff --git a/phpstan.neon b/phpstan.neon index 0a1813b..36cf413 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,9 +4,12 @@ includes: parameters: level: 8 checkMissingIterableValueType: false + reportUnmatchedIgnoredErrors: false paths: - src - tests + ignoreErrors: + - '#Parameter \#3 \$transferTime of class GuzzleHttp\\TransferStats constructor expects null, float given.#' rules: - PHPStan\Rules\BooleansInConditions\BooleanInBooleanAndRule diff --git a/tests/Handler/MultiRecordArrayHandlerTest.php b/tests/Handler/MultiRecordArrayHandlerTest.php index d04da10..4e0b5b8 100644 --- a/tests/Handler/MultiRecordArrayHandlerTest.php +++ b/tests/Handler/MultiRecordArrayHandlerTest.php @@ -71,13 +71,8 @@ public function logTransactionWithJsonResponse(): void $this->assertSame('Guzzle HTTP request', $this->logger->records[0]['message']); $this->assertSame(LogLevel::DEBUG, $this->logger->records[1]['level']); $this->assertSame('Guzzle HTTP response', $this->logger->records[1]['message']); - $this->assertContains( - [ - 'status' => true, - 'client' => 13000, - ], - $this->logger->records[1]['context']['response']['body'] - ); + $this->assertTrue($this->logger->records[1]['context']['response']['body']['status']); + $this->assertSame(13000, $this->logger->records[1]['context']['response']['body']['client']); } /** @@ -124,13 +119,8 @@ public function logTransactionWithJsonApiResponse(): void $this->assertSame('Guzzle HTTP request', $this->logger->records[0]['message']); $this->assertSame(LogLevel::DEBUG, $this->logger->records[1]['level']); $this->assertSame('Guzzle HTTP response', $this->logger->records[1]['message']); - $this->assertContains( - [ - 'status' => true, - 'client' => 13000, - ], - $this->logger->records[1]['context']['response']['body'] - ); + $this->assertTrue($this->logger->records[1]['context']['response']['body']['status']); + $this->assertSame(13000, $this->logger->records[1]['context']['response']['body']['client']); } /**