From d86064fe72ffc7e1ff9f70c15f33232411c72ff8 Mon Sep 17 00:00:00 2001 From: ncla Date: Sat, 4 May 2024 17:48:45 +0300 Subject: [PATCH 1/6] Initial change to start testing v5 support --- composer.json | 4 ++-- tests/TestCase.php | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 6eccaae..f273981 100644 --- a/composer.json +++ b/composer.json @@ -25,10 +25,10 @@ } }, "require": { - "statamic/cms": "^4.0" + "statamic/cms": "v5.0.0-beta.2 as v5.0.0" }, "require-dev": { - "orchestra/testbench": "^6.9|^7.1", + "orchestra/testbench": "^6.9|^7.1|^8.0|^9.0", "pestphp/pest": "^1.22", "spatie/pest-plugin-snapshots": "^1.1" }, diff --git a/tests/TestCase.php b/tests/TestCase.php index 0a4dbf7..98c4755 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -94,8 +94,15 @@ protected function resolveApplicationConfiguration($app) parent::resolveApplicationConfiguration($app); $configs = [ - 'assets', 'cp', 'forms', 'routes', 'static_caching', - 'sites', 'stache', 'system', 'users', + 'assets', + 'cp', + 'forms', + 'routes', + 'static_caching', + // 'sites', + 'stache', + 'system', + 'users', ]; foreach ($configs as $config) { From 653505290a4de5486b8340f1bf01205c8d3be12b Mon Sep 17 00:00:00 2001 From: ncla Date: Sat, 4 May 2024 18:05:07 +0300 Subject: [PATCH 2/6] Update run-tests.yml --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c05938e..b4b3d16 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: php: [8.0, 8.1, 8.2] - statamic: [4.0.*] + statamic: [4.0.*, v5.0.0-beta.2 as v5.0.0] include: - testbench: 7.* From 75bcfa2433f0fb1cc393006abac613e8f12fe4a1 Mon Sep 17 00:00:00 2001 From: ncla Date: Sat, 4 May 2024 18:08:15 +0300 Subject: [PATCH 3/6] Update run-tests.yml --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b4b3d16..2212346 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,8 +9,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [8.0, 8.1, 8.2] - statamic: [4.0.*, v5.0.0-beta.2 as v5.0.0] + php: [8.1, 8.2, 8.3] + statamic: [v5.0.0-beta.2 as v5.0.0] include: - testbench: 7.* From 692cc2b4563f69343ad75eef8880a211d8f53ac5 Mon Sep 17 00:00:00 2001 From: ncla Date: Sat, 4 May 2024 18:11:39 +0300 Subject: [PATCH 4/6] Update run-tests.yml --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2212346..ea82b9c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,7 +12,7 @@ jobs: php: [8.1, 8.2, 8.3] statamic: [v5.0.0-beta.2 as v5.0.0] include: - - testbench: 7.* + - testbench: 8.* name: PHP ${{ matrix.php }} - Statamic ${{ matrix.statamic }} From c4df199a08383d0f6dc636127f5f7d961098741f Mon Sep 17 00:00:00 2001 From: Rias Date: Mon, 13 May 2024 10:19:58 +0200 Subject: [PATCH 5/6] Update snapshots --- composer.json | 2 +- resources/views/responsiveImage.blade.php | 2 +- tests/Feature/ResponsiveTagTest.php | 2 +- ...esponsiveFieldType_field_resolves_it_to_data__1.yml | 2 +- ...sive_field_accepts_responsive_fieldtype_data__1.yml | 2 +- .../GraphQLTest__responsive_field_returns_data__1.json | 2 +- ...agTest__format_quality_is_set_on_breakpoints__1.txt | 8 ++++---- ...ds_custom_parameters_to_the_attribute_string__1.txt | 6 +++--- ...eTagTest__it_can_add_custom_glide_parameters__1.txt | 6 +++--- ...render_a_responsive_image_with_the_directive__1.txt | 6 +++--- ...t_directed_image_as_array_with_the_directive__1.txt | 6 +++--- ...der_an_art_directed_image_with_the_directive__1.txt | 6 +++--- ...nsiveTagTest__it_generates_responsive_images__1.txt | 6 +++--- ...s_responsive_images_in_webp_and_avif_formats__1.txt | 8 ++++---- ...s_responsive_images_in_webp_and_avif_formats__2.txt | 8 ++++---- ...responsive_images_with_breakpoint_parameters__1.txt | 10 +++++----- ...ponsive_images_with_breakpoints_without_webp__1.txt | 6 +++--- ..._generates_responsive_images_with_parameters__1.txt | 6 +++--- ...ates_responsive_images_without_a_placeholder__1.txt | 6 +++--- ..._it_generates_responsive_images_without_webp__1.txt | 4 ++-- ...veTagTest__it_uses_an_alt_field_on_the_asset__1.txt | 6 +++--- ...the_source_image_can_change_with_breakpoints__1.txt | 10 +++++----- 22 files changed, 60 insertions(+), 60 deletions(-) diff --git a/composer.json b/composer.json index f273981..e43ab37 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ } }, "require": { - "statamic/cms": "v5.0.0-beta.2 as v5.0.0" + "statamic/cms": "^5.0" }, "require-dev": { "orchestra/testbench": "^6.9|^7.1|^8.0|^9.0", diff --git a/resources/views/responsiveImage.blade.php b/resources/views/responsiveImage.blade.php index 8289933..b84eab0 100644 --- a/resources/views/responsiveImage.blade.php +++ b/resources/views/responsiveImage.blade.php @@ -40,7 +40,7 @@ {!! $attributeString ?? '' !!} src="{{ $src }}" @unless (\Illuminate\Support\Str::contains($attributeString, 'alt')) - alt="{{ $asset['alt'] ?? $asset['title'] }}" + alt="{{ (string) $asset['alt'] ?: (string) $asset['title'] }}" @endunless @isset($width) width="{{ $width }}" @endisset @isset($height) height="{{ $height }}" @endisset diff --git a/tests/Feature/ResponsiveTagTest.php b/tests/Feature/ResponsiveTagTest.php index deebf60..c28f7ad 100644 --- a/tests/Feature/ResponsiveTagTest.php +++ b/tests/Feature/ResponsiveTagTest.php @@ -355,4 +355,4 @@ function assertMatchesSnapshotWithoutSvg($value) expect($tagOutput) ->toContain('width="123"') ->and('height="123"'); -}); \ No newline at end of file +}); diff --git a/tests/__snapshots__/GraphQLTest__querying_ResponsiveFieldType_field_resolves_it_to_data__1.yml b/tests/__snapshots__/GraphQLTest__querying_ResponsiveFieldType_field_resolves_it_to_data__1.yml index bf091db..4e20ea7 100644 --- a/tests/__snapshots__/GraphQLTest__querying_ResponsiveFieldType_field_resolves_it_to_data__1.yml +++ b/tests/__snapshots__/GraphQLTest__querying_ResponsiveFieldType_field_resolves_it_to_data__1.yml @@ -1,3 +1,3 @@ title: 'Responsive Images addon is awesome' hero: - breakpoints: [{ asset: { path: test.jpg }, label: default, minWidth: 0, widthUnit: px, ratio: 1.2142857142857, sources: [{ format: original, mimeType: image/jpeg, minWidth: 0, mediaWidthUnit: px, mediaString: null, srcSet: '/img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=237&h=195 237w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=284&h=234 284w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=340&h=280 340w' }] }] + breakpoints: [{ asset: { path: test.jpg }, label: default, minWidth: 0, widthUnit: px, ratio: 1.2142857142857, sources: [{ format: original, mimeType: image/jpeg, minWidth: 0, mediaWidthUnit: px, mediaString: null, srcSet: '/img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=/test.jpg?q=90&fit=crop-50-50&w=237&h=195 237w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=/test.jpg?q=90&fit=crop-50-50&w=284&h=234 284w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=/test.jpg?q=90&fit=crop-50-50&w=340&h=280 340w' }] }] diff --git a/tests/__snapshots__/GraphQLTest__responsive_field_accepts_responsive_fieldtype_data__1.yml b/tests/__snapshots__/GraphQLTest__responsive_field_accepts_responsive_fieldtype_data__1.yml index 2789648..72fe088 100644 --- a/tests/__snapshots__/GraphQLTest__responsive_field_accepts_responsive_fieldtype_data__1.yml +++ b/tests/__snapshots__/GraphQLTest__responsive_field_accepts_responsive_fieldtype_data__1.yml @@ -1,3 +1,3 @@ title: 'Responsive Images addon is awesome' hero: - responsive: [{ asset: { id: 'test_container::test.jpg' }, label: default, minWidth: 0, widthUnit: px, ratio: 1.2142857142857, sources: [{ format: original, mimeType: image/jpeg, minWidth: 0, mediaWidthUnit: px, mediaString: null, srcSet: '/img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=237&h=195 237w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=284&h=234 284w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=340&h=280 340w' }] }] + responsive: [{ asset: { id: 'test_container::test.jpg' }, label: default, minWidth: 0, widthUnit: px, ratio: 1.2142857142857, sources: [{ format: original, mimeType: image/jpeg, minWidth: 0, mediaWidthUnit: px, mediaString: null, srcSet: '/img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=/test.jpg?q=90&fit=crop-50-50&w=237&h=195 237w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=/test.jpg?q=90&fit=crop-50-50&w=284&h=234 284w, /img/asset/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=/test.jpg?q=90&fit=crop-50-50&w=340&h=280 340w' }] }] diff --git a/tests/__snapshots__/GraphQLTest__responsive_field_returns_data__1.json b/tests/__snapshots__/GraphQLTest__responsive_field_returns_data__1.json index 6cf8bf3..434f86f 100644 --- a/tests/__snapshots__/GraphQLTest__responsive_field_returns_data__1.json +++ b/tests/__snapshots__/GraphQLTest__responsive_field_returns_data__1.json @@ -17,7 +17,7 @@ "minWidth": 0, "mediaWidthUnit": "px", "mediaString": null, - "srcSet": "\/img\/asset\/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=237&h=195 237w, \/img\/asset\/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=284&h=234 284w, \/img\/asset\/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=?q=90&fit=crop-50-50&w=340&h=280 340w" + "srcSet": "\/img\/asset\/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=\/test.jpg?q=90&fit=crop-50-50&w=237&h=195 237w, \/img\/asset\/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=\/test.jpg?q=90&fit=crop-50-50&w=284&h=234 284w, \/img\/asset\/dGVzdF9jb250YWluZXIvdGVzdC5qcGc=\/test.jpg?q=90&fit=crop-50-50&w=340&h=280 340w" } ] } diff --git a/tests/__snapshots__/ResponsiveTagTest__format_quality_is_set_on_breakpoints__1.txt b/tests/__snapshots__/ResponsiveTagTest__format_quality_is_set_on_breakpoints__1.txt index 57f8fb9..37fc8f5 100644 --- a/tests/__snapshots__/ResponsiveTagTest__format_quality_is_set_on_breakpoints__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__format_quality_is_set_on_breakpoints__1.txt @@ -19,20 +19,20 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_adds_custom_parameters_to_the_attribute_string__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_adds_custom_parameters_to_the_attribute_string__1.txt index 3c1831d..dcba9a3 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_adds_custom_parameters_to_the_attribute_string__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_adds_custom_parameters_to_the_attribute_string__1.txt @@ -19,16 +19,16 @@ Some alt tag diff --git a/tests/__snapshots__/ResponsiveTagTest__it_can_add_custom_glide_parameters__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_can_add_custom_glide_parameters__1.txt index 15447ac..49b16e6 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_can_add_custom_glide_parameters__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_can_add_custom_glide_parameters__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_can_render_a_responsive_image_with_the_directive__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_can_render_a_responsive_image_with_the_directive__1.txt index 91ff000..162ced9 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_can_render_a_responsive_image_with_the_directive__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_can_render_a_responsive_image_with_the_directive__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_as_array_with_the_directive__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_as_array_with_the_directive__1.txt index 91ff000..162ced9 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_as_array_with_the_directive__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_as_array_with_the_directive__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_with_the_directive__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_with_the_directive__1.txt index 91ff000..162ced9 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_with_the_directive__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_can_render_an_art_directed_image_with_the_directive__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images__1.txt index 91ff000..162ced9 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__1.txt index 318f28b..f21d727 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__1.txt @@ -19,20 +19,20 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__2.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__2.txt index 318f28b..f21d727 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__2.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_in_webp_and_avif_formats__2.txt @@ -19,20 +19,20 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoint_parameters__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoint_parameters__1.txt index a97aa1c..80cf37b 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoint_parameters__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoint_parameters__1.txt @@ -19,24 +19,24 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoints_without_webp__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoints_without_webp__1.txt index a6db535..b586494 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoints_without_webp__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_breakpoints_without_webp__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_parameters__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_parameters__1.txt index 051b9cd..7ca7976 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_parameters__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_with_parameters__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_a_placeholder__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_a_placeholder__1.txt index 08a0b1e..5a83156 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_a_placeholder__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_a_placeholder__1.txt @@ -19,16 +19,16 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_webp__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_webp__1.txt index 4237a82..1f0b0df 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_webp__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_generates_responsive_images_without_webp__1.txt @@ -19,12 +19,12 @@ test.jpg diff --git a/tests/__snapshots__/ResponsiveTagTest__it_uses_an_alt_field_on_the_asset__1.txt b/tests/__snapshots__/ResponsiveTagTest__it_uses_an_alt_field_on_the_asset__1.txt index c317792..24db55b 100644 --- a/tests/__snapshots__/ResponsiveTagTest__it_uses_an_alt_field_on_the_asset__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__it_uses_an_alt_field_on_the_asset__1.txt @@ -19,16 +19,16 @@ My asset alt tag diff --git a/tests/__snapshots__/ResponsiveTagTest__the_source_image_can_change_with_breakpoints__1.txt b/tests/__snapshots__/ResponsiveTagTest__the_source_image_can_change_with_breakpoints__1.txt index 993cf6c..d49b40b 100644 --- a/tests/__snapshots__/ResponsiveTagTest__the_source_image_can_change_with_breakpoints__1.txt +++ b/tests/__snapshots__/ResponsiveTagTest__the_source_image_can_change_with_breakpoints__1.txt @@ -19,24 +19,24 @@ test.jpg From da7cedb5bf1686e55ca3b6a3c4ab29720d975d78 Mon Sep 17 00:00:00 2001 From: Rias Date: Mon, 13 May 2024 10:40:11 +0200 Subject: [PATCH 6/6] Update workflow --- .github/workflows/run-tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ea82b9c..b4d878f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,9 +10,6 @@ jobs: strategy: matrix: php: [8.1, 8.2, 8.3] - statamic: [v5.0.0-beta.2 as v5.0.0] - include: - - testbench: 8.* name: PHP ${{ matrix.php }} - Statamic ${{ matrix.statamic }} @@ -29,7 +26,6 @@ jobs: - name: Install dependencies run: | - composer require "statamic/cms:${{ matrix.statamic }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update composer update --prefer-stable --prefer-dist --no-interaction --no-suggest - name: Execute tests