Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The theme had no automated PHP tests on
master(an old WP_Mock attempt lived onfeature/tests, 268 commits behind). Since local development now runs on wp-env, the tests run against a real WordPress there instead of mocking it, so they stay close to production behaviour.What
.wp-env.test.json(port 8889, PHP 8.4,testsEnvironment: false, theme active, ACF loaded), separate from the dev environment and using its ownwptests_tables.tests/bootstrap.php,tests/wp-tests-config.php(WP_DEFAULT_THEME, sofunctions.phpand the services boot as in production),phpunit.xml.dist.tests/php/, mirroringinc/, onWP_UnitTestCase(factories, real registries,wp_scripts(),go_to(), real attachments…). No mocking library. Classes with static caches run in separate processes. Tests never readdist/: fixtures intests/assets/are wired through thetheme_file_path/theme_file_urifilters.phpunit/phpunit9.6.38 andyoast/phpunit-polyfills4.0.0 (Composer),@wordpress/env12.0.0 andenv:*/test:phpscripts (npm).tests-php.ymlworkflow, PHPUnit on WordPress 6.3 (minimum declared instyle.css) and latest stable with PHP 8.4. Coverage is generated locally only (npm run env:start-tests).Requires PHP, dev and test wp-env, Composer platform8.4.99, PHPCompatibilitytestVersion,php-qualityworkflow). This reverts the 8.3 alignment of d73e2dc.Suspected bugs found (not fixed here, current behaviour pinned in tests)
Svg::get_inline_icon_markup()/Icon::resolve_icons_directory(): containment check without trailing separator, a sibling folder such asdist/images-outsideis accepted.Service_Container:get_service( Some::class )returns the class name string; callingboot_services()twice throws anError.Editor::register()reads the global container instead of the given one (depends on service order).get_theme_static_image_dimensions()calls a method onget_service( 'assets' )without checking forfalse.get_the_link()button mode: "Undefined array key" warnings forrel/targetwithouttarget="_blank".Body_Class::add()accepts an array per its doc but makesbody_class()throw aTypeError.Icon::unregister_core_icon_collection():_doing_it_wrongnotice whencoreis already unregistered.>breadcrumb separator,gutenberg_blocks_allowed()only removes the first duplicate.Test plan
npm run env:start-ci && npm run test:php: 293 tests, 706 assertions, green on WordPress 7.1.4 / PHP 8.4WP_ENV_CORE=WordPress/WordPress#6.3): green, 13 Icon tests skipped (icon API requires WP 7.1)npm run env:start-tests && npm run test:php -- --coverage-html=coverage/ --coverage-text: 97.3 % linescomposer csclean, GrumPHP pre-commit checks pass.wp-env.json) starts on PHP 8.4.27, theme and ACF active, home page returns 200PHP Testsworkflow green on this PR🤖 Generated with Claude Code
Note
Medium Risk
No production
inc/changes, but raising the minimum PHP version affects all theme consumers; the new CI gate depends on Docker/wp-env reliability.Overview
Adds PHPUnit integration tests that run inside a dedicated wp-env stack (
.wp-env.test.json, port 8889,wptests_tables), with bootstrap wiring for real WordPress, active theme, and ACF—plus ~293 tests undertests/php/, asset fixtures, and npm scripts (env:start-tests,env:start-ci,test:php). CI gains.github/workflows/tests-php.yml(WordPress 6.3 and latest, PHP 8.4); quality tooling excludestests/from PHPCS/Psalm and documents the workflow in the README.Separately, the theme standardizes on PHP 8.4 (
style.css, Composer platform,.wp-env.json, PHPCompatibility,php-quality.yml), adds PHPUnit dev dependencies and@wordpress/env, and keeps tests off theme export bundles via.gitattributes.Reviewed by Cursor Bugbot for commit 58f3cb2. Bugbot is set up for automated code reviews on this repo. Configure here.