From f44aca91a356e81e935ea8fea57870c0451a3a4c Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Sat, 9 Jul 2022 14:00:48 +0200 Subject: [PATCH 1/9] fixed --- .github/workflows/ci.yml | 16 +++++----------- composer.json | 6 +++--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d297d00..e508638 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,17 +90,11 @@ jobs: coverage: none tools: cs2pr - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - name: Composer install - run: composer stan-setup + run: composer update + + - name: Composer show + run: composer show - name: Run PHP CodeSniffer continue-on-error: true @@ -111,7 +105,7 @@ jobs: - name: Run psalm if: success() || failure() - run: vendor/bin/psalm.phar --output-format=github + run: vendor/bin/psalm.phar --output-format=github --php-version=8.0 - name: Run phpstan if: success() || failure() diff --git a/composer.json b/composer.json index 26af517..a3d94aa 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,9 @@ }, "require-dev": { "cakephp/cakephp-codesniffer": "^4.0", - "phpunit/phpunit": "^9.1|^9.5" + "phpunit/phpunit": "^9.1|^9.5", + "phpstan/phpstan": "^0.12", + "psalm/phar": "^3.18|^4" }, "autoload": { "psr-4": { @@ -48,11 +50,9 @@ "phpstan": "phpstan.phar analyse", "psalm": "psalm.phar --php-version=8.0", "stan": [ - "@stan-setup", "@phpstan", "@psalm" ], - "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 psalm/phar:\"^3.18|^4\" && mv composer.backup composer.json", "update-lowest": "@composer update --prefer-lowest" } } From 03c2d71e005527516eef9e5593bb798c95d53e70 Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Sat, 9 Jul 2022 14:05:24 +0200 Subject: [PATCH 2/9] fixed --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index a3d94aa..283d46a 100644 --- a/composer.json +++ b/composer.json @@ -54,5 +54,10 @@ "@psalm" ], "update-lowest": "@composer update --prefer-lowest" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } From 06b220c1db336679ef96981aa6ff33c62ec2e9dc Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Thu, 22 Sep 2022 16:02:24 +0200 Subject: [PATCH 3/9] updated for CakePHP 4.4 --- CHANGELOG.md | 3 +++ tests/TestCase/Command/ClearAllCommandTest.php | 4 ++-- tests/TestCase/Command/ClearCommandTest.php | 4 ++-- tests/bootstrap.php | 7 +++++++ version | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a87336f..f8ec244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # 1.x branch ## 1.10 branch +### 1.10.2 +* updated for CakePHP 4.4. + ### 1.10.1 * ready for CakePHP 4.4. diff --git a/tests/TestCase/Command/ClearAllCommandTest.php b/tests/TestCase/Command/ClearAllCommandTest.php index 8349dde..a44815a 100644 --- a/tests/TestCase/Command/ClearAllCommandTest.php +++ b/tests/TestCase/Command/ClearAllCommandTest.php @@ -16,7 +16,7 @@ use Cake\Console\ConsoleIo; use Cake\Console\Exception\StopException; -use Cake\TestSuite\Stub\ConsoleOutput; +use Cake\Console\TestSuite\StubConsoleOutput; use Exception; use MeTools\TestSuite\ConsoleIntegrationTestTrait; use Thumber\Cake\TestSuite\TestCase; @@ -76,6 +76,6 @@ public function testExecuteOnFailure(): void $this->Command->ThumbManager->method('_clear') ->will($this->throwException(new Exception())); - $this->Command->run([], new ConsoleIo(null, new ConsoleOutput())); + $this->Command->run([], new ConsoleIo(null, new StubConsoleOutput())); } } diff --git a/tests/TestCase/Command/ClearCommandTest.php b/tests/TestCase/Command/ClearCommandTest.php index 1f4508b..55efd75 100644 --- a/tests/TestCase/Command/ClearCommandTest.php +++ b/tests/TestCase/Command/ClearCommandTest.php @@ -16,7 +16,7 @@ use Cake\Console\ConsoleIo; use Cake\Console\Exception\StopException; -use Cake\TestSuite\Stub\ConsoleOutput; +use Cake\Console\TestSuite\StubConsoleOutput; use Exception; use MeTools\TestSuite\ConsoleIntegrationTestTrait; use Thumber\Cake\TestSuite\TestCase; @@ -101,6 +101,6 @@ public function testExecuteOnFailure(): void $this->Command->ThumbManager->method('_clear') ->will($this->throwException(new Exception())); - $this->Command->run(['noExisting'], new ConsoleIo(null, new ConsoleOutput())); + $this->Command->run(['noExisting'], new ConsoleIo(null, new StubConsoleOutput())); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6ebc622..364be7d 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -76,4 +76,11 @@ define('THUMBER_TARGET', Configure::read('Thumber.target', TMP . 'thumbs')); $_SERVER['PHP_SELF'] = '/'; +/** + * @todo to be removed in a later version + */ +if (!class_exists('Cake\Console\TestSuite\StubConsoleOutput')) { + class_alias('Cake\TestSuite\Stub\ConsoleOutput', 'Cake\Console\TestSuite\StubConsoleOutput'); +} + echo 'Running tests for "' . getenv('THUMBER_DRIVER') . '" driver ' . PHP_EOL; diff --git a/version b/version index 4dae298..5ad2491 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.10.1 +1.10.2 From e852e19a5264338d777a5b20d8c005971eda133f Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Thu, 22 Sep 2022 16:02:51 +0200 Subject: [PATCH 4/9] fixed deprecated methods --- tests/TestCase/Command/ClearAllCommandTest.php | 2 +- tests/TestCase/Command/ClearCommandTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/TestCase/Command/ClearAllCommandTest.php b/tests/TestCase/Command/ClearAllCommandTest.php index a44815a..092e357 100644 --- a/tests/TestCase/Command/ClearAllCommandTest.php +++ b/tests/TestCase/Command/ClearAllCommandTest.php @@ -71,7 +71,7 @@ public function testExecuteOnFailure(): void { $this->expectException(StopException::class); $this->Command->ThumbManager = $this->getMockBuilder(ThumbManager::class) - ->setMethods(['_clear']) + ->onlyMethods(['_clear']) ->getMock(); $this->Command->ThumbManager->method('_clear') ->will($this->throwException(new Exception())); diff --git a/tests/TestCase/Command/ClearCommandTest.php b/tests/TestCase/Command/ClearCommandTest.php index 55efd75..70c686c 100644 --- a/tests/TestCase/Command/ClearCommandTest.php +++ b/tests/TestCase/Command/ClearCommandTest.php @@ -96,7 +96,7 @@ public function testExecuteOnFailure(): void { $this->expectException(StopException::class); $this->Command->ThumbManager = $this->getMockBuilder(ThumbManager::class) - ->setMethods(['_clear']) + ->onlyMethods(['_clear']) ->getMock(); $this->Command->ThumbManager->method('_clear') ->will($this->throwException(new Exception())); From a2bdc8efcb3c697e6a075920adf05e42cd230cf3 Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Thu, 22 Sep 2022 16:03:10 +0200 Subject: [PATCH 5/9] fixed typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8ec244..85c7444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ ## 1.8 branch ### 1.8.1 * little fixes; -* APIs are now generated by `phpDocumentor` and no longer by` apigen`. +* APIs are now generated by `phpDocumentor` and no longer by `apigen`. ### 1.8.0 * much of the code will be moved into the `php-thumber` package, so that it From da1ad417d10e5c33df7e1317958927cca21d1b87 Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Thu, 22 Sep 2022 16:03:14 +0200 Subject: [PATCH 6/9] updated --- phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 7f3d8f7..80941f4 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -16,5 +16,5 @@ parameters: checkMissingIterableValueType: false treatPhpDocTypesAsCertain: false - excludes_analyse: + excludePaths: - tests/test_app/ \ No newline at end of file From 40b60bd33f695520afddd154acd05b618206222e Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Thu, 22 Sep 2022 16:09:36 +0200 Subject: [PATCH 7/9] fixed --- tests/TestCase/Middleware/ThumbnailMiddlewareTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/TestCase/Middleware/ThumbnailMiddlewareTest.php b/tests/TestCase/Middleware/ThumbnailMiddlewareTest.php index 5a66fdb..901375e 100644 --- a/tests/TestCase/Middleware/ThumbnailMiddlewareTest.php +++ b/tests/TestCase/Middleware/ThumbnailMiddlewareTest.php @@ -25,6 +25,7 @@ /** * ThumbnailMiddlewareTest class + * @property \Cake\Http\Response $_response The response for the most recent request */ class ThumbnailMiddlewareTest extends TestCase { From dd209d23d7b90e5bbd4d75685d0505e0a73bc9a0 Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Thu, 22 Sep 2022 16:09:42 +0200 Subject: [PATCH 8/9] updated --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 283d46a..07d14d7 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ "require-dev": { "cakephp/cakephp-codesniffer": "^4.0", "phpunit/phpunit": "^9.1|^9.5", - "phpstan/phpstan": "^0.12", - "psalm/phar": "^3.18|^4" + "phpstan/phpstan": "^1.7", + "psalm/phar": "^4.24" }, "autoload": { "psr-4": { From caaf14ea76fafdc3d59fc8a1c6fae314ef0252bd Mon Sep 17 00:00:00 2001 From: mirko-pagliai Date: Thu, 22 Sep 2022 16:12:36 +0200 Subject: [PATCH 9/9] updated --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c7444..50c5533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # 1.x branch ## 1.10 branch ### 1.10.2 -* updated for CakePHP 4.4. +* updated for CakePHP 4.4; +* little fixes for `phpstan`, `psalm` and for the `composer.json` file. ### 1.10.1 * ready for CakePHP 4.4.