From da84910c8a907b6ab471c99cae7cdde8b33c52d0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 21 Dec 2015 05:48:24 +0000 Subject: [PATCH] Query: Introduce a unit test which will fail when new public query vars are introduced without also updating the test. This adds an extra layer of explicitness to introducing public query vars in order to avoid introducing unintentional clashes with URL query vars that are already in use. See #35115 git-svn-id: https://develop.svn.wordpress.org/trunk@36045 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/query/vars.php | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/phpunit/tests/query/vars.php diff --git a/tests/phpunit/tests/query/vars.php b/tests/phpunit/tests/query/vars.php new file mode 100644 index 0000000000..0720a83f14 --- /dev/null +++ b/tests/phpunit/tests/query/vars.php @@ -0,0 +1,72 @@ +assertEquals( array( + + // Static public query vars: + 'm', + 'p', + 'posts', + 'w', + 'cat', + 'withcomments', + 'withoutcomments', + 's', + 'search', + 'exact', + 'sentence', + 'calendar', + 'page', + 'paged', + 'more', + 'tb', + 'pb', + 'author', + 'order', + 'orderby', + 'year', + 'monthnum', + 'day', + 'hour', + 'minute', + 'second', + 'name', + 'category_name', + 'tag', + 'feed', + 'author_name', + 'static', + 'pagename', + 'page_id', + 'error', + 'attachment', + 'attachment_id', + 'subpost', + 'subpost_id', + 'preview', + 'robots', + 'taxonomy', + 'term', + 'cpage', + 'post_type', + 'embed', + + // Dynamically added public query vars: + 'post_format', + 'rest_route', + + ), $wp->public_query_vars, 'Care should be taken when introducing new public query vars. See https://core.trac.wordpress.org/ticket/35115' ); + } + +}