Skip to content

Commit

Permalink
Merge pull request #86 from mirko-pagliai/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mirko-pagliai authored Jun 21, 2022
2 parents f93db80 + 20ef9b7 commit e310aa8
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
thumber-driver: 'gd'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
PHP_VERSION: '7.4'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 1.x branch
## 1.10 branch
### 1.10.1
* ready for CakePHP 4.4.

### 1.10.0
* requires at least PHP 7.4;
* little fixes.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"test": "rm -f -r /tmp/cake* && phpunit",
"coverage": "XDEBUG_MODE=coverage phpunit --coverage-html=coverage",
"phpstan": "phpstan.phar analyse",
"psalm": "psalm.phar",
"psalm": "psalm.phar --php-version=8.0",
"stan": [
"@stan-setup",
"@phpstan",
Expand Down
9 changes: 7 additions & 2 deletions src/Middleware/ThumbnailMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
namespace Thumber\Cake\Middleware;

use Cake\Core\Configure;
use Cake\Http\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down Expand Up @@ -44,8 +45,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

$response = new Response();
$response = $response->withModified(filemtime($file) ?: 0);
if ($response->checkNotModified($request)) {
return $response;
/**
* @todo to be removed in a later version
*/
$method = version_compare(Configure::version(), '4.4', '>=') ? 'isNotModified' : 'checkNotModified';
if ($response->$method($request)) {
return $response->withNotModified();
}

return $response->withFile($file)->withType(mime_content_type($file) ?: '');
Expand Down
6 changes: 1 addition & 5 deletions tests/TestCase/Command/ClearAllCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@

/**
* ClearAllCommandTest class
* @property \Thumber\Cake\Command\ClearAllCommand $Command
*/
class ClearAllCommandTest extends TestCase
{
use ConsoleIntegrationTestTrait;

/**
* @var \Thumber\Cake\Command\ClearAllCommand
*/
protected $Command;

/**
* @var bool
*/
Expand Down
6 changes: 1 addition & 5 deletions tests/TestCase/Command/ClearCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@

/**
* ClearCommandTest class
* @property \Thumber\Cake\Command\ClearCommand $Command
*/
class ClearCommandTest extends TestCase
{
use ConsoleIntegrationTestTrait;

/**
* @var \Thumber\Cake\Command\ClearCommand
*/
protected $Command;

/**
* @var bool
*/
Expand Down
6 changes: 1 addition & 5 deletions tests/TestCase/Middleware/ThumbnailMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@ public function testThumb(): void
if (Configure::readOrFail('Thumber.driver') == 'imagick') {
$extensions += [
'bmp' => 'image/x-ms-bmp',
'ico' => 'image/x-icon',
'ico' => 'image/vnd.microsoft.icon',
'psd' => 'image/vnd.adobe.photoshop',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
];

if (version_compare(PHP_VERSION, '7.4', '>=')) {
$extensions['ico'] = 'image/vnd.microsoft.icon';
}
}

$ThumbHelper = new ThumbHelper(new View());
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
'serialize' => true,
],
]);
Configure::write('pluginsToLoad', ['Thumber/Cake']);
Configure::write('pluginsToLoad', ['Thumber\\Cake\\Plugin']);
if (!getenv('THUMBER_DRIVER')) {
putenv('THUMBER_DRIVER=' . (extension_loaded('imagick') ? 'imagick' : 'gd'));
}
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.0
1.10.1

0 comments on commit e310aa8

Please sign in to comment.