Tests: Use assertIsCallable() for callable assertions. - #13017
Tests: Use assertIsCallable() for callable assertions.#13017rootzero00 wants to merge 2 commits into
assertIsCallable() for callable assertions.#13017Conversation
Replaces generic `assertTrue( is_callable() )` assertions in the Customize widgets tests with the dedicated PHPUnit assertion. See #65819.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
We have the same pattern in |
Replaces generic `assertTrue( is_callable() )` assertions with PHPUnit's dedicated callable assertion in the multisite cache fallback tests. See #65819.
assertIsCallable() for callable assertions.assertIsCallable() for callable assertions.
|
Thanks — I've added those two occurrences in The additional change is limited to that one file (+2/-2), replacing the Fresh validation passes:
|
Replaces eight generic
assertTrue( is_callable() )assertions withPHPUnit's dedicated
assertIsCallable()assertion in:tests/phpunit/tests/customize/widgets.phptests/phpunit/tests/multisite/wpCacheSwitchToBlogFallback.phpThis is a test-only cleanup and does not change WordPress runtime behavior.
The multisite assertions were added as a review-driven follow-up after the
same pattern was identified in
Tests_Multisite_WpCacheSwitchToBlogFallback.Trac ticket: https://core.trac.wordpress.org/ticket/65819
Testing
npm run test:php -- --filter Tests_WP_Customize_Widgets --colors=never --do-not-cache-resultnpm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_Multisite_WpCacheSwitchToBlogFallback::test_wp_cache_switch_to_blog_function_exists --colors=never --do-not-cache-resultnpm run test:php -- -c tests/phpunit/multisite.xml --filter Tests_Multisite_WpCacheSwitchToBlogFallback --colors=never --do-not-cache-resultnpm run env:composer -- lint tests/phpunit/tests/multisite/wpCacheSwitchToBlogFallback.phpFresh upstream verification confirmed that neither changed test file has
changed upstream since the candidate parent.
Use of AI Tools
AI assistance: Yes
Tool(s): ChatGPT
Model(s): GPT-5.6 Sol
Used for: Investigation support, contribution workflow and validation
planning, and drafting assistance. The change was reviewed, understood,
signed, and tested by me.
This Pull Request is for code review only. Please keep all other
discussion in the Trac ticket. Do not merge this Pull Request. See
GitHub Pull Requests for Code Review
in the Core Handbook for more details.