ampproject / amp-wp

Enable AMP on your WordPress site, the WordPress way.
https://wordpress.org/plugins/amp/
GNU General Public License v2.0
1.79k stars 382 forks source link

Fix static-analysis and PHPUnit tests errors #7814

Closed thelovekesh closed 3 months ago

thelovekesh commented 3 months ago

Summary

PHPStan

The latest PHPStan version (1.11.3) is showing a few errors:

[errors] ``` ------ ---------------------------------------------------------------------- Line includes/sanitizers/class-amp-comments-sanitizer.php ------ ---------------------------------------------------------------------- 45 Call to AMP_Base_Sanitizer::init() on a separate line has no effect. ------ ---------------------------------------------------------------------- ------ ---------------------------------------------------------------------- Line includes/sanitizers/class-amp-script-sanitizer.php ------ ---------------------------------------------------------------------- 102 Call to AMP_Base_Sanitizer::init() on a separate line has no effect. ------ ---------------------------------------------------------------------- ------ ---------------------------------------------------------------------- Line includes/sanitizers/class-amp-style-sanitizer.php ------ ---------------------------------------------------------------------- 894 Call to AMP_Base_Sanitizer::init() on a separate line has no effect. ------ ---------------------------------------------------------------------- ```

This PR includes the fix to resolve these static analysis errors.

PHPUnit

A few tests for ReaderThemeSupportFeatures failed due to new changes introduced in theme.json v3. The new versions introduce a new settings.spacing.defaultSpacingSizes property which decides if default space sizing needs to be preferred over the default ones. This PR adds support for this property in reader themes as well. Also see the dev notes for this new change - https://github.com/WordPress/gutenberg/pull/58409#issuecomment-2078077477

Checklist

github-actions[bot] commented 3 months ago

Plugin builds for 59862291e54dec2d343974faefdf7d2301a3ff1f are ready :bellhop_bell:!

Checksums
# Development build checksums
0ea508aa5064fb79e58f531de24b812c1e55b209c6e0bd1119e4c7c8dc8cfd63 *amp.zip

# Production build checksums
37fa88f69fe8140aff8e5cf5727d81af32857a4ece9d92ebe757a9ab9c9b9acf *amp.zip

[!WARNING] These builds are for testing purposes only and should not be used in production.

thelovekesh commented 3 months ago

Marking as draft now, as I'll be fixing the failing tests in trunk in same PR.

thelovekesh commented 1 month ago

QA Passed ✅