Skip to content

Conversation

@johnbillion
Copy link
Member

@johnbillion johnbillion commented Dec 2, 2021

Several tests perform assertions conditionally or iterate dynamic arrays without ensuring they're populated. If the test is faulty and the condition never evaluates to true or the array being iterated is empty then we'll never know about it.

This adds additional assertions that cover these situations.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

Copy link
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fully approve the direction of this PR. Left some remarks inline to iterate on this further.

@johnbillion johnbillion changed the title Add assertions that test the tests. #54725 Add assertions that test the tests. Jan 25, 2022
@johnbillion
Copy link
Member Author

Thanks for the comments @jrfnl , I've pushed some changes. I've left the whitespace unadjusted for now to keep the diff clean, the whitespace can be corrected at the point of commit.

Next up, we've actually got some failures as a result of these additional assertions that need investigating.

@jrfnl
Copy link
Member

jrfnl commented Jan 25, 2022

Next up, we've actually got some failures as a result of these additional assertions that need investigating.

Nah, not test failures: test successes as making these changes has probably uncovered some bugs in the underlying code 😁

@johnbillion johnbillion changed the title #54725 Add assertions that test the tests. #63167 Add assertions that test the tests. May 26, 2025
# Conflicts:
#	tests/phpunit/tests/ajax/MediaEdit.php
#	tests/phpunit/tests/import/parser.php
#	tests/phpunit/tests/media.php
@github-actions
Copy link

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props johnbillion, jrf.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@johnbillion
Copy link
Member Author

@johnbillion johnbillion deleted the test-safety branch June 11, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants