Skip to content

added test for get_num_queries and wp_get_nocache_headers#1930

Open
pbearne wants to merge 21 commits into
WordPress:trunkfrom
pbearne:wp_get_nocache_headers
Open

added test for get_num_queries and wp_get_nocache_headers#1930
pbearne wants to merge 21 commits into
WordPress:trunkfrom
pbearne:wp_get_nocache_headers

Conversation

@pbearne

@pbearne pbearne commented Nov 23, 2021

Copy link
Copy Markdown

Trac ticket:

@costdev costdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this PR to improve the test suite @pbearne! Nice work!

This review contains suggestions to:

  • make the tests, filenames and classnames consistent with others in the test suite.
  • make the assertions stricter.
  • make clear which assertion fails, and why, when multiple assertions exist.
  • make a clear distinction between what is being tested.
  • make tests more performant.

Comment thread tests/phpunit/tests/functions/get_num_queries.php Outdated
Comment thread tests/phpunit/tests/functions/get_num_queries.php Outdated
Comment thread tests/phpunit/tests/functions/get_num_queries.php Outdated
Comment thread tests/phpunit/tests/functions/wp_get_nocache_headers.php Outdated
Comment thread tests/phpunit/tests/functions/get_num_queries.php Outdated
Comment thread tests/phpunit/tests/functions/wp_get_nocache_headers.php Outdated
pbearne and others added 6 commits November 23, 2021 08:58
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>

@costdev costdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work on the updates @pbearne!

Just two more requests from me to rename the files for consistency with the rest of the test suite.

Comment thread tests/phpunit/tests/functions/get_num_queries.php
Comment thread tests/phpunit/tests/functions/wp_get_nocache_headers.php Outdated
@peterwilsoncc

Copy link
Copy Markdown
Contributor

@pbearne @costdev I've pushed up several changes

  • merged in trunk
  • renamed files per Colin's earlier review
  • Various coding standards fixes
  • I changed the DB query for testing the number of queries increased to a simpler one: SELECT now()
  • Added tests for the cache headers to account for the changes in r56134 for logged in users

@peterwilsoncc peterwilsoncc requested a review from costdev November 5, 2023 23:01

@costdev costdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @peterwilsoncc!

A couple of changes to docblock descriptions for consistency and so that third-person singular verbs are used.

Comment thread tests/phpunit/tests/functions/getNumQueries.php Outdated
Comment thread tests/phpunit/tests/functions/getNumQueries.php Outdated
Comment thread tests/phpunit/tests/functions/wpGetNocacheHeaders.php Outdated
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @pbearne@git.wordpress.org.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Props pbearne, peterwilsoncc, costdev.

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

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

3 participants