From b37c7e586edcc1235809476a2c0bc29562b27c38 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Fri, 4 Sep 2026 19:03:44 -0400 Subject: [PATCH 1/2] feat: bump min php to 8.3 The shared php-test workflow pins its own 8.2-8.5 matrix, so the test job is defined here to drop the 8.2 legs. --- .github/workflows/ci.yml | 21 ++++++++++++++++++++- composer.json | 3 +-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79402d1..0755978 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,16 +8,35 @@ on: jobs: tests: - uses: zenstruck/.github/.github/workflows/php-test.yml@main + name: PHP ${{ matrix.php }}, ${{ matrix.deps }} + runs-on: ubuntu-latest + strategy: + matrix: + php: [8.3, 8.4, 8.5] + deps: [highest] + include: + - php: 8.3 + deps: lowest + steps: + - uses: zenstruck/.github/actions/php-test-symfony@main + with: + php: ${{ matrix.php }} + deps: ${{ matrix.deps }} code-coverage: uses: zenstruck/.github/.github/workflows/php-coverage-codecov.yml@main + with: + php: 8.3 composer-validate: uses: zenstruck/.github/.github/workflows/php-composer-validate.yml@main + with: + php: 8.3 sca: uses: zenstruck/.github/.github/workflows/php-stan.yml@main + with: + php: 8.3 fixcs: name: Run php-cs-fixer diff --git a/composer.json b/composer.json index f3809c5..251b793 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,7 @@ } ], "require": { - "php": ">=8.0", - "symfony/polyfill-php81": "^1.26", + "php": ">=8.3", "zenstruck/temp-file": "^1.0" }, "require-dev": { From f5790b578b6b7b70c1ee0859e5aee2ad9548127c Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Fri, 4 Sep 2026 19:03:44 -0400 Subject: [PATCH 2/2] test: assert the temp dir without hardcoding /tmp macOS reports its temp directory unresolved but creates files in the resolved one, so neither side matches the literal. --- tests/ImageFileInfoTest.php | 8 +++--- tests/TempDirAssertions.php | 27 +++++++++++++++++++ .../FilterObjectTransformerTestCase.php | 4 +-- tests/TransformerTestCase.php | 10 ++++--- 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 tests/TempDirAssertions.php diff --git a/tests/ImageFileInfoTest.php b/tests/ImageFileInfoTest.php index 110270b..ced65bf 100644 --- a/tests/ImageFileInfoTest.php +++ b/tests/ImageFileInfoTest.php @@ -19,6 +19,8 @@ */ final class ImageFileInfoTest extends TestCase { + use TempDirAssertions; + /** * @test * @dataProvider imageMetadataProvider @@ -28,13 +30,13 @@ public function can_get_metadata(string $file, int $height, int $width, string $ $this->metadataAssertions(ImageFileInfo::wrap($file), $height, $width, $mime, $extension); $this->metadataAssertions($image = ImageFileInfo::from(\file_get_contents($file)), $height, $width, $mime, $extension); - $this->assertSame('/tmp', \dirname($image)); + $this->assertInTempDir($image); $this->metadataAssertions($image = ImageFileInfo::from(\fopen($file, 'r')), $height, $width, $mime, $extension); - $this->assertSame('/tmp', \dirname($image)); + $this->assertInTempDir($image); $this->metadataAssertions($image = ImageFileInfo::from(new \SplFileInfo($file)), $height, $width, $mime, $extension); - $this->assertSame('/tmp', \dirname($image)); + $this->assertInTempDir($image); } public static function imageMetadataProvider(): iterable diff --git a/tests/TempDirAssertions.php b/tests/TempDirAssertions.php new file mode 100644 index 0000000..97db8eb --- /dev/null +++ b/tests/TempDirAssertions.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Image\Tests; + +/** + * @author Kevin Bond + */ +trait TempDirAssertions +{ + /** + * macOS reports its temp directory unresolved but creates files in the + * resolved one, so both sides have to be normalized before comparing. + */ + protected function assertInTempDir(\SplFileInfo $file): void + { + $this->assertSame(\realpath(\sys_get_temp_dir()), \realpath(\dirname($file))); + } +} diff --git a/tests/Transformer/FilterObjectTransformerTestCase.php b/tests/Transformer/FilterObjectTransformerTestCase.php index 3cdcbb2..09f6619 100644 --- a/tests/Transformer/FilterObjectTransformerTestCase.php +++ b/tests/Transformer/FilterObjectTransformerTestCase.php @@ -32,14 +32,14 @@ public function can_transform_into_temp_image_with_filter_object(): void $this->assertSame(100, $resized->dimensions()->width()); $this->assertSame(120, $resized->dimensions()->height()); $this->assertSame('jpg', $resized->getExtension()); - $this->assertSame('/tmp', \dirname($resized)); + $this->assertInTempDir($resized); $resized = $image->transform($this->filterObject(), ['format' => 'png']); $this->assertSame(100, $resized->dimensions()->width()); $this->assertSame(120, $resized->dimensions()->height()); $this->assertSame('png', $resized->getExtension()); - $this->assertSame('/tmp', \dirname($resized)); + $this->assertInTempDir($resized); } /** diff --git a/tests/TransformerTestCase.php b/tests/TransformerTestCase.php index a93bf47..4fda899 100644 --- a/tests/TransformerTestCase.php +++ b/tests/TransformerTestCase.php @@ -20,6 +20,8 @@ */ abstract class TransformerTestCase extends TestCase { + use TempDirAssertions; + /** * @test */ @@ -32,14 +34,14 @@ public function can_transform_into_temp_image(): void $this->assertSame(100, $resized->dimensions()->width()); $this->assertSame(120, $resized->dimensions()->height()); $this->assertSame('jpg', $resized->getExtension()); - $this->assertSame('/tmp', \dirname($resized)); + $this->assertInTempDir($resized); $resized = $image->transform($this->filterCallback(), ['format' => 'png']); $this->assertSame(100, $resized->dimensions()->width()); $this->assertSame(120, $resized->dimensions()->height()); $this->assertSame('png', $resized->getExtension()); - $this->assertSame('/tmp', \dirname($resized)); + $this->assertInTempDir($resized); } /** @@ -90,14 +92,14 @@ public function can_transform_into_temp_image_with_invokable_object(): void $this->assertSame(100, $resized->dimensions()->width()); $this->assertSame(120, $resized->dimensions()->height()); $this->assertSame('jpg', $resized->getExtension()); - $this->assertSame('/tmp', \dirname($resized)); + $this->assertInTempDir($resized); $resized = $image->transform($this->filterCallback(), ['format' => 'png']); $this->assertSame(100, $resized->dimensions()->width()); $this->assertSame(120, $resized->dimensions()->height()); $this->assertSame('png', $resized->getExtension()); - $this->assertSame('/tmp', \dirname($resized)); + $this->assertInTempDir($resized); } /**