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

fixed #87

Merged
merged 9 commits into from
Sep 22, 2022
Merged
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
16 changes: 5 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 1.x branch
## 1.10 branch
### 1.10.2
* updated for CakePHP 4.4;
* little fixes for `phpstan`, `psalm` and for the `composer.json` file.

### 1.10.1
* ready for CakePHP 4.4.

Expand Down Expand Up @@ -48,7 +52,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
Expand Down
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "^1.7",
"psalm/phar": "^4.24"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -48,11 +50,14 @@
"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"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ parameters:
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false

excludes_analyse:
excludePaths:
- tests/test_app/
6 changes: 3 additions & 3 deletions tests/TestCase/Command/ClearAllCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,11 +71,11 @@ 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()));

$this->Command->run([], new ConsoleIo(null, new ConsoleOutput()));
$this->Command->run([], new ConsoleIo(null, new StubConsoleOutput()));
}
}
6 changes: 3 additions & 3 deletions tests/TestCase/Command/ClearCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -96,11 +96,11 @@ 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()));

$this->Command->run(['noExisting'], new ConsoleIo(null, new ConsoleOutput()));
$this->Command->run(['noExisting'], new ConsoleIo(null, new StubConsoleOutput()));
}
}
1 change: 1 addition & 0 deletions tests/TestCase/Middleware/ThumbnailMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

/**
* ThumbnailMiddlewareTest class
* @property \Cake\Http\Response $_response The response for the most recent request
*/
class ThumbnailMiddlewareTest extends TestCase
{
Expand Down
7 changes: 7 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.1
1.10.2