From 66ca42e4490601c2235377859843d85e2a64e39e Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 22 Aug 2024 10:10:05 -0700 Subject: [PATCH 1/3] Add isset() check in case source type is absent --- includes/validation/class-amp-validation-manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/validation/class-amp-validation-manager.php b/includes/validation/class-amp-validation-manager.php index 1d4ba232b1d..cac607113e8 100644 --- a/includes/validation/class-amp-validation-manager.php +++ b/includes/validation/class-amp-validation-manager.php @@ -1166,7 +1166,7 @@ static function ( $enqueued_script_source ) use ( $script_handle ) { $has_non_core = false; foreach ( $extra_sources as $extra_source ) { - if ( 'core' !== $extra_source['type'] ) { + if ( isset( $extra_source['type'] ) && 'core' !== $extra_source['type'] ) { $has_non_core = true; break; } From c0f05a04f91793732dd57f1fae21d9ff3b042654 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 22 Aug 2024 10:30:40 -0700 Subject: [PATCH 2/3] Bump minimum WP version to 6.5 --- .github/workflows/build-test-measure.yml | 6 +++--- README.md | 2 +- amp.php | 2 +- src/DependencySupport.php | 2 +- tests/php/src/Admin/AmpPluginsTest.php | 2 +- tests/php/src/Admin/AmpThemesTest.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test-measure.yml b/.github/workflows/build-test-measure.yml index a4801f98023..facc17fcb1e 100644 --- a/.github/workflows/build-test-measure.yml +++ b/.github/workflows/build-test-measure.yml @@ -328,11 +328,11 @@ jobs: external-http: true - php: '7.4' - wp: '6.3' + wp: '6.5' phpunit: '7' - php: '7.4' - wp: '6.3' + wp: '6.5' phpunit: '7' external-http: true steps: @@ -507,7 +507,7 @@ jobs: wp: 'latest' - php: '7.4' - wp: '6.3' + wp: '6.5' steps: - name: Shutdown default MySQL service if: needs.pre-run.outputs.changed-php-count > 0 diff --git a/README.md b/README.md index 3f4a2104b09..8c7d22253c6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ An easier path to great Page Experience for everyone. Powered by AMP. **Contributors:** [google](https://profiles.wordpress.org/google), [xwp](https://profiles.wordpress.org/xwp), [rtcamp](https://profiles.wordpress.org/rtcamp), [automattic](https://profiles.wordpress.org/automattic), [westonruter](https://profiles.wordpress.org/westonruter), [albertomedina](https://profiles.wordpress.org/albertomedina), [schlessera](https://profiles.wordpress.org/schlessera), [delawski](https://profiles.wordpress.org/delawski/), [swissspidy](https://profiles.wordpress.org/swissspidy), [pierlo](https://profiles.wordpress.org/pierlo), [joshuawold](https://profiles.wordpress.org/joshuawold), [thelovekesh](https://profiles.wordpress.org/thelovekesh/) **Tags:** [page experience](https://wordpress.org/plugins/tags/page-experience), [performance](https://wordpress.org/plugins/tags/performance), [amp](https://wordpress.org/plugins/tags/amp), [mobile](https://wordpress.org/plugins/tags/mobile), [optimization](https://wordpress.org/plugins/tags/optimization) -**Requires at least:** 6.3 +**Requires at least:** 6.5 **Tested up to:** 6.6 **Stable tag:** 2.5.4 **License:** [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html) diff --git a/amp.php b/amp.php index a34c60fdd39..1dcb030db88 100644 --- a/amp.php +++ b/amp.php @@ -7,7 +7,7 @@ * Author URI: https://github.com/ampproject/amp-wp/graphs/contributors * Version: 2.5.5-alpha * License: GPLv2 or later - * Requires at least: 6.3 + * Requires at least: 6.5 * Requires PHP: 7.4 * * @package AMP diff --git a/src/DependencySupport.php b/src/DependencySupport.php index d58511c571e..31b51953744 100644 --- a/src/DependencySupport.php +++ b/src/DependencySupport.php @@ -30,7 +30,7 @@ class DependencySupport implements Service { * * @var string */ - const WP_MIN_VERSION = '6.3'; + const WP_MIN_VERSION = '6.5'; /** * Determines whether core or Gutenberg provides minimal support. diff --git a/tests/php/src/Admin/AmpPluginsTest.php b/tests/php/src/Admin/AmpPluginsTest.php index 511a20997f3..507eea3692b 100644 --- a/tests/php/src/Admin/AmpPluginsTest.php +++ b/tests/php/src/Admin/AmpPluginsTest.php @@ -161,7 +161,7 @@ public function test_is_needed() { $this->assertFalse( AmpPlugins::is_needed() ); // Test 3: Admin request in supported WordPress . - $wp_version = '6.3'; + $wp_version = '6.5'; set_current_screen( 'index.php' ); $this->assertTrue( AmpPlugins::is_needed() ); diff --git a/tests/php/src/Admin/AmpThemesTest.php b/tests/php/src/Admin/AmpThemesTest.php index 0b18aae8f8a..3c5bbbcda22 100644 --- a/tests/php/src/Admin/AmpThemesTest.php +++ b/tests/php/src/Admin/AmpThemesTest.php @@ -83,7 +83,7 @@ public function test_is_needed() { $this->assertFalse( AmpThemes::is_needed() ); // Test 3: Admin request. - $wp_version = '6.3'; + $wp_version = '6.5'; set_current_screen( 'index.php' ); $this->assertTrue( is_admin() ); $this->assertTrue( AmpThemes::is_needed() ); From 296c233b085e3e97e213ca7959532837591cc030 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 22 Aug 2024 10:34:27 -0700 Subject: [PATCH 3/3] Account for CSS changes in twentyten theme --- tests/php/test-amp-style-sanitizer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/php/test-amp-style-sanitizer.php b/tests/php/test-amp-style-sanitizer.php index b2ee1a986e3..7142e5a8503 100644 --- a/tests/php/test-amp-style-sanitizer.php +++ b/tests/php/test-amp-style-sanitizer.php @@ -3524,11 +3524,11 @@ function ( $original_dom, $original_source, $amphtml_dom, $amphtml_source ) { $this->assertStringContainsString( '.wp-block-audio figcaption', $amphtml_source, 'Expected block-library/style.css' ); } - if ( version_compare( strtok( get_bloginfo( 'version' ), '-' ), '6.6', '>=' ) ) { - $this->assertStringContainsString( '[class^="wp-block-"]:not(.wp-block-gallery) > figcaption', $amphtml_source, 'Expected twentyten/blocks.css' ); - } else { - $this->assertStringContainsString( '[class^="wp-block-"]:not(.wp-block-gallery) figcaption', $amphtml_source, 'Expected twentyten/blocks.css' ); - } + $this->assertStringContainsString( + '[class^="wp-block-"]:not(.wp-block-gallery) figcaption', + str_replace( '> figcaption', 'figcaption', $amphtml_source ), // Account for recent CSS changes. + 'Expected twentyten/blocks.css' + ); $amphtml_source = preg_replace( '/\s*>\s*/', '>', $amphtml_source ); // Account for variance in postcss. $this->assertStringContainsString( '.amp-wp-default-form-message>p', $amphtml_source, 'Expected amp-default.css' );