From 1579032b08cf0c4e2eb652feb410138a29171d38 Mon Sep 17 00:00:00 2001 From: craig410 Date: Tue, 23 Jul 2024 08:20:37 +0100 Subject: [PATCH] Support PHP 8.3 --- CHANGELOG.md | 4 ++ cloudbuild.yaml | 4 +- composer.json | 14 +++---- phpunit.xml | 40 +++++++++---------- ...st.php => BaseImageProcessorTestCases.php} | 23 +++++------ test/unit/Processor/CLIImageProcessorTest.php | 4 +- test/unit/Processor/ImageOperationsTest.php | 4 +- 7 files changed, 45 insertions(+), 48 deletions(-) rename test/unit/Processor/{BaseImageProcessorTest.php => BaseImageProcessorTestCases.php} (94%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8c7e5b..26e51d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### Unreleased +### v2.1.0 (2024-10-01) + +* Support PHP 8.3 + ### v2.0.2 (2024-02-07) * Support ingenerator/php-utils:^2.0 diff --git a/cloudbuild.yaml b/cloudbuild.yaml index b9ba1cd..5139fb7 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -1,12 +1,12 @@ timeout: 180s steps: - id: 'build:composer' - name: 'eu.gcr.io/ingenerator-ci/ingenerator-php:8.2' + name: 'eu.gcr.io/ingenerator-ci/ingenerator-php:8.3' entrypoint: 'composer' args: - 'install' - '--no-interaction' - id: 'test:unit' - name: 'eu.gcr.io/ingenerator-ci/ingenerator-php:8.2' + name: 'eu.gcr.io/ingenerator-ci/ingenerator-php:8.3' dir: '/workspace' entrypoint: './vendor/bin/phpunit' diff --git a/composer.json b/composer.json index 6af1f3b..70334ca 100644 --- a/composer.json +++ b/composer.json @@ -10,15 +10,15 @@ } ], "require": { - "php": "~8.2.0", + "php": "~8.3.0", "ext-ffi": "*", "ingenerator/php-utils": "^1.17 || ^2.0", "jcupitt/vips": "^2.1", - "symfony/process": "^5.4 || ^6.0 || ^7.0" + "symfony/process": "^7.0" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^3.3", - "phpunit/phpunit": "^9.5", + "ergebnis/phpunit-slow-test-detector": "^2.6", + "phpunit/phpunit": "^11.0", "symfony/filesystem": "^7.0" }, "autoload": { @@ -28,13 +28,13 @@ }, "autoload-dev": { "psr-4": { - "test\\unit\\Ingenerator\\ImageProcessing\\": "test" + "test\\": "test/" } }, "config": { "platform": { - "php": "8.2", - "ext-ffi": "8.2" + "php": "8.3", + "ext-ffi": "8.3" }, "preferred-install": "dist", "sort-packages": true diff --git a/phpunit.xml b/phpunit.xml index 659a296..1c7ce22 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,33 +3,31 @@ - + failOnDeprecation="true" + failOnNotice="true" + failOnWarning="true" + failOnRisky="true" + displayDetailsOnIncompleteTests="true" + displayDetailsOnSkippedTests="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"> + src - + test/unit - - - - - - 200 - - - 20 - - - - - + + + + + + diff --git a/test/unit/Processor/BaseImageProcessorTest.php b/test/unit/Processor/BaseImageProcessorTestCases.php similarity index 94% rename from test/unit/Processor/BaseImageProcessorTest.php rename to test/unit/Processor/BaseImageProcessorTestCases.php index 06678bf..844141b 100644 --- a/test/unit/Processor/BaseImageProcessorTest.php +++ b/test/unit/Processor/BaseImageProcessorTestCases.php @@ -3,9 +3,10 @@ * @author Craig Gosman */ -namespace test\unit\Ingenerator\ImageProcessing\Processor; +namespace test\unit\Processor; use Ingenerator\ImageProcessing\Processor\ImageProcessorInterface; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Ingenerator\ImageProcessing\Processor\ImageCompare; use Symfony\Component\Filesystem\Filesystem; @@ -16,14 +17,14 @@ use const PATHINFO_EXTENSION; use const PATHINFO_FILENAME; -abstract class BaseImageProcessorTest extends TestCase +abstract class BaseImageProcessorTestCases extends TestCase { private const RESOURCE_DIR = __DIR__.'/../../resources/'; private const OUTPUT_DIR = __DIR__.'/../../output/'; abstract protected function newSubject(): ImageProcessorInterface; - public function providerImageSize(): array + public static function providerImageSize(): array { return [ [self::RESOURCE_DIR.'crop_400.jpg', FALSE, [400, 400]], @@ -35,16 +36,14 @@ public function providerImageSize(): array ]; } - /** - * @dataProvider providerImageSize - */ + #[DataProvider('providerImageSize')] public function test_get_image_size(string $source_path, bool $auto_rotate, array $expect): void { $subject = $this->newSubject(); $this->assertSame($expect, $subject::getImageSize($source_path, $auto_rotate)); } - public function providerCreatePlaceholder(): array + public static function providerCreatePlaceholder(): array { return [ 'JPEG placeholder' => [600, 400, self::RESOURCE_DIR.'placeholder.jpg'], @@ -52,9 +51,7 @@ public function providerCreatePlaceholder(): array ]; } - /** - * @dataProvider providerCreatePlaceholder - */ + #[DataProvider('providerCreatePlaceholder')] public function test_create_placeholder($width, $height, $path_expected_result): void { $subject = $this->newSubject(); @@ -69,7 +66,7 @@ public function test_create_placeholder($width, $height, $path_expected_result): $this->assertTrue(ImageCompare::isSame($path_expected_result, $output_file)); } - public function providerThumbnailOperations(): array + public static function providerThumbnailOperations(): array { return [ 'Scale down proportionately' => [ @@ -185,9 +182,7 @@ public function providerThumbnailOperations(): array ]; } - /** - * @dataProvider providerThumbnailOperations - */ + #[DataProvider('providerThumbnailOperations')] public function test_thumbnail(string $source_image, array $operations, string $path_expected_result): void { $operations = array_merge( diff --git a/test/unit/Processor/CLIImageProcessorTest.php b/test/unit/Processor/CLIImageProcessorTest.php index 78ad91c..2407e3e 100644 --- a/test/unit/Processor/CLIImageProcessorTest.php +++ b/test/unit/Processor/CLIImageProcessorTest.php @@ -3,11 +3,11 @@ * @author Craig Gosman */ -namespace test\unit\Ingenerator\ImageProcessing\Processor; +namespace test\unit\Processor; use Ingenerator\ImageProcessing\Processor\CLIImageProcessor; -class CLIImageProcessorTest extends BaseImageProcessorTest +class CLIImageProcessorTest extends BaseImageProcessorTestCases { protected function newSubject(): CLIImageProcessor { diff --git a/test/unit/Processor/ImageOperationsTest.php b/test/unit/Processor/ImageOperationsTest.php index 4d06dd7..caf9516 100644 --- a/test/unit/Processor/ImageOperationsTest.php +++ b/test/unit/Processor/ImageOperationsTest.php @@ -3,11 +3,11 @@ * @author Craig Gosman */ -namespace test\unit\Ingenerator\ImageProcessing\Processor; +namespace test\unit\Processor; use Ingenerator\ImageProcessing\Processor\ImageOperations; -class ImageOperationsTest extends BaseImageProcessorTest +class ImageOperationsTest extends BaseImageProcessorTestCases { protected function newSubject(): ImageOperations {