Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
lancewillett
left a comment
There was a problem hiding this comment.
The refactor itself is good. All seven ReflectionProperty blocks in the image tests now go through the two helpers. Putting them in WP_Image_UnitTestCase fits better than a private method, since three classes share them. At 8651be5, the GD, Imagick and editor tests pass the same as trunk in single site and multisite, and PHPCS is clean.
Please trim it to just the refactor:
- Drop
test_get_and_set_property_value(). It tests the test helpers, not WordPress. The rotate, flip,get_size()andget_suffix()tests already use both helpers and would fail if either broke. - Drop the new annotations on existing tests.
@ticket 39055doesn't belong to these tests: the trunk commits that cite it areWP_Queryorderby tests.@ticket 66584marks a test that covers that ticket's bug. This ticket is a cleanup, so it doesn't belong ontest_get_size(),test_get_suffix(), the rotate and flip tests, or the helper docblocks.- The
@coverslines are unrelated to this change.
After that, the diff is just the two helpers and the call sites.
AI review · claude-opus-5-5
… test cases. Introduces `get_property_value()` and `set_property_value()` helper methods on `WP_Image_UnitTestCase` to eliminate repeated `ReflectionProperty` boilerplate and handle PHP 8.1+ / PHP 8.5+ deprecation-safe accessibility across image editor test classes. Refactors `Tests_Image_Editor_GD`, `Tests_Image_Editor_Imagick`, and `Tests_Image_Editor` to use the new helpers. Props therssoftware. See #66584.
8651be5 to
18abf85
Compare
|
Thanks for the review, @lancewillett! Updated in the latest push:
All GD, Imagick, and editor test suites pass locally in both single site and multisite, and PHPCS is clean. Ready for another look. |
lancewillett
left a comment
There was a problem hiding this comment.
Approving at e3e8657. The diff is now just the two helpers and their seven call sites.
- The GD, Imagick and editor tests match trunk in single site and multisite: 78 tests, 166 assertions.
- With both helpers broken, all seven refactored tests fail (rotate and flip for GD and Imagick, plus
test_generate_filename(),test_get_size()andtest_get_suffix()). So every call site goes through them. - PHPCS is clean, and the change applies cleanly to trunk.
AI review · claude-opus-5-5
|
PR #15842 landed in https://core.trac.wordpress.org/changeset/65353 |
…perties. Replace the repeated `ReflectionProperty` setup in the image editor tests with two helpers on `WP_Image_UnitTestCase`. Developed in: #15842 Props therssoftware, sanjith2023. Fixes #66584. git-svn-id: https://develop.svn.wordpress.org/trunk@65353 602fd350-edb4-49c9-b593-d223f7449a82
…perties. Replace the repeated `ReflectionProperty` setup in the image editor tests with two helpers on `WP_Image_UnitTestCase`. Developed in: WordPress/wordpress-develop#15842 Props therssoftware, sanjith2023. Fixes #66584. Built from https://develop.svn.wordpress.org/trunk@65353 git-svn-id: http://core.svn.wordpress.org/trunk@64493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: https://core.trac.wordpress.org/ticket/66584
Description
In
Tests_Image_Editor_GD, multiple test methods duplicate several lines ofReflectionPropertyboilerplate to read or set protected properties such as$editor->imageand$editor->size. This was noted during review of #66113 (comment).Changes
get_property_value( $editor, $property_name = 'image' )andset_property_value( $editor, $property_name, $value )to the sharedWP_Image_UnitTestCasebase class (tests/phpunit/tests/image/base.php).setAccessible( true )withPHP_VERSION_ID < 80100to ensure safe execution on PHP 8.1+ and avoid PHP 8.5 deprecation notices.Tests_Image_Editor_GD,Tests_Image_Editor_Imagick, andTests_Image_Editorto use the helpers.Tests_Image_Editor_GD::test_get_and_set_property_value().Verification
vendor/bin/phpcspasses with 0 errors across all modified files.vendor/bin/phpunit --group wp-image-editor-gdpasses (43 tests, 119 assertions).vendor/bin/phpunit --filter 'Tests_Image_Editor::'passes (22 tests, 42 assertions).