mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Coding Standards: Add visibility to methods in tests/phpunit/tests/.
Adds a `public` visibility to test fixtures, tests, data providers, and callbacks methods. Adds a `private` visibility to helper methods within test classes. Renames callbacks and helpers that previously started with a `_` prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit. Props costdev, jrf, hellofromTonya. Fixes #54177. git-svn-id: https://develop.svn.wordpress.org/trunk@52010 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -14,7 +14,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
protected $page_ids;
|
||||
protected $post_ids;
|
||||
|
||||
function set_up() {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
update_option( 'comments_per_page', 5 );
|
||||
@@ -25,12 +25,12 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
create_initial_taxonomies();
|
||||
}
|
||||
|
||||
function test_home() {
|
||||
public function test_home() {
|
||||
$this->go_to( '/' );
|
||||
$this->assertQueryTrue( 'is_home', 'is_front_page' );
|
||||
}
|
||||
|
||||
function test_page_on_front() {
|
||||
public function test_page_on_front() {
|
||||
$page_on_front = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -56,18 +56,18 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
delete_option( 'page_for_posts' );
|
||||
}
|
||||
|
||||
function test_404() {
|
||||
public function test_404() {
|
||||
$this->go_to( '/notapage' );
|
||||
$this->assertQueryTrue( 'is_404' );
|
||||
}
|
||||
|
||||
function test_permalink() {
|
||||
public function test_permalink() {
|
||||
$post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) );
|
||||
$this->go_to( get_permalink( $post_id ) );
|
||||
$this->assertQueryTrue( 'is_single', 'is_singular' );
|
||||
}
|
||||
|
||||
function test_post_comments_feed() {
|
||||
public function test_post_comments_feed() {
|
||||
$post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) );
|
||||
self::factory()->comment->create_post_comments( $post_id, 2 );
|
||||
$this->go_to( get_post_comments_feed_link( $post_id ) );
|
||||
@@ -75,20 +75,20 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
|
||||
function test_post_comments_feed_with_no_comments() {
|
||||
public function test_post_comments_feed_with_no_comments() {
|
||||
$post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) );
|
||||
$this->go_to( get_post_comments_feed_link( $post_id ) );
|
||||
$this->assertQueryTrue( 'is_feed', 'is_single', 'is_singular', 'is_comment_feed' );
|
||||
}
|
||||
|
||||
function test_attachment_comments_feed() {
|
||||
public function test_attachment_comments_feed() {
|
||||
$attachment_id = self::factory()->post->create( array( 'post_type' => 'attachment' ) );
|
||||
self::factory()->comment->create_post_comments( $attachment_id, 2 );
|
||||
$this->go_to( get_post_comments_feed_link( $attachment_id ) );
|
||||
$this->assertQueryTrue( 'is_feed', 'is_attachment', 'is_single', 'is_singular', 'is_comment_feed' );
|
||||
}
|
||||
|
||||
function test_page() {
|
||||
public function test_page() {
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -99,7 +99,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$this->assertQueryTrue( 'is_page', 'is_singular' );
|
||||
}
|
||||
|
||||
function test_parent_page() {
|
||||
public function test_parent_page() {
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -111,7 +111,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$this->assertQueryTrue( 'is_page', 'is_singular' );
|
||||
}
|
||||
|
||||
function test_child_page_1() {
|
||||
public function test_child_page_1() {
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -130,7 +130,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$this->assertQueryTrue( 'is_page', 'is_singular' );
|
||||
}
|
||||
|
||||
function test_child_page_2() {
|
||||
public function test_child_page_2() {
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -157,7 +157,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
|
||||
function test_page_trackback() {
|
||||
public function test_page_trackback() {
|
||||
$page_ids = array();
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
@@ -195,7 +195,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
|
||||
function test_page_feed() {
|
||||
public function test_page_feed() {
|
||||
$page_ids = array();
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
@@ -233,7 +233,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
function test_page_feed_with_no_comments() {
|
||||
public function test_page_feed_with_no_comments() {
|
||||
$page_ids = array();
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
@@ -271,7 +271,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
|
||||
function test_page_feed_atom() {
|
||||
public function test_page_feed_atom() {
|
||||
$page_ids = array();
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
@@ -311,7 +311,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
|
||||
function test_page_page_2() {
|
||||
public function test_page_page_2() {
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -330,7 +330,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
|
||||
function test_page_page_2_no_slash() {
|
||||
public function test_page_page_2_no_slash() {
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -349,7 +349,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
|
||||
function test_pagination_of_posts_page() {
|
||||
public function test_pagination_of_posts_page() {
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -380,7 +380,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// 'feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
|
||||
// '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
|
||||
function test_main_feed_2() {
|
||||
public function test_main_feed_2() {
|
||||
self::factory()->post->create(); // @test_404
|
||||
$feeds = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
|
||||
@@ -398,7 +398,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
}
|
||||
|
||||
function test_main_feed() {
|
||||
public function test_main_feed() {
|
||||
self::factory()->post->create(); // @test_404
|
||||
$types = array( 'rss2', 'rss', 'atom' );
|
||||
foreach ( $types as $type ) {
|
||||
@@ -408,7 +408,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
|
||||
function test_paged() {
|
||||
public function test_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
self::factory()->post->create_many( 5 );
|
||||
for ( $i = 2; $i <= 3; $i++ ) {
|
||||
@@ -419,7 +419,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
|
||||
// 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
|
||||
function test_main_comments_feed() {
|
||||
public function test_main_comments_feed() {
|
||||
$post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) );
|
||||
self::factory()->comment->create_post_comments( $post_id, 2 );
|
||||
|
||||
@@ -445,7 +445,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
|
||||
// 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
|
||||
function test_search_feed() {
|
||||
public function test_search_feed() {
|
||||
// Check the long form.
|
||||
$types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
foreach ( $types as $type ) {
|
||||
@@ -462,7 +462,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
|
||||
function test_search_paged() {
|
||||
public function test_search_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
self::factory()->post->create_many( 3, array( 'post_title' => 'test' ) );
|
||||
$this->go_to( '/search/test/page/2/' );
|
||||
@@ -470,7 +470,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'search/(.+)/?$' => 'index.php?s=$matches[1]',
|
||||
function test_search() {
|
||||
public function test_search() {
|
||||
$this->go_to( '/search/test/' );
|
||||
$this->assertQueryTrue( 'is_search' );
|
||||
}
|
||||
@@ -478,14 +478,14 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 13961
|
||||
*/
|
||||
function test_search_encoded_chars() {
|
||||
public function test_search_encoded_chars() {
|
||||
$this->go_to( '/search/F%C3%BCnf%2Bbar/' );
|
||||
$this->assertSame( get_query_var( 's' ), 'Fünf+bar' );
|
||||
}
|
||||
|
||||
// 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
|
||||
// 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
|
||||
function test_category_feed() {
|
||||
public function test_category_feed() {
|
||||
self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'cat-a',
|
||||
@@ -509,7 +509,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
|
||||
function test_category_paged() {
|
||||
public function test_category_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
self::factory()->post->create_many( 3 );
|
||||
$this->go_to( '/category/uncategorized/page/2/' );
|
||||
@@ -517,7 +517,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
|
||||
function test_category() {
|
||||
public function test_category() {
|
||||
self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'cat-a',
|
||||
@@ -530,7 +530,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
|
||||
// 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
|
||||
function test_tag_feed() {
|
||||
public function test_tag_feed() {
|
||||
self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'tag-a',
|
||||
@@ -553,7 +553,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
|
||||
function test_tag_paged() {
|
||||
public function test_tag_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
$post_ids = self::factory()->post->create_many( 3 );
|
||||
foreach ( $post_ids as $post_id ) {
|
||||
@@ -564,7 +564,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
|
||||
function test_tag() {
|
||||
public function test_tag() {
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'name' => 'Tag Named A',
|
||||
@@ -589,7 +589,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
|
||||
// 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
|
||||
function test_author_feed() {
|
||||
public function test_author_feed() {
|
||||
self::factory()->user->create( array( 'user_login' => 'user-a' ) );
|
||||
// Check the long form.
|
||||
$types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
@@ -607,7 +607,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
|
||||
function test_author_paged() {
|
||||
public function test_author_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
$user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
|
||||
self::factory()->post->create_many( 3, array( 'post_author' => $user_id ) );
|
||||
@@ -616,14 +616,14 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
|
||||
function test_author() {
|
||||
public function test_author() {
|
||||
$user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
|
||||
self::factory()->post->create( array( 'post_author' => $user_id ) );
|
||||
$this->go_to( '/author/user-a/' );
|
||||
$this->assertQueryTrue( 'is_archive', 'is_author' );
|
||||
}
|
||||
|
||||
function test_author_with_no_posts() {
|
||||
public function test_author_with_no_posts() {
|
||||
$user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
|
||||
$this->go_to( '/author/user-a/' );
|
||||
$this->assertQueryTrue( 'is_archive', 'is_author' );
|
||||
@@ -631,7 +631,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
|
||||
function test_ymd_feed() {
|
||||
public function test_ymd_feed() {
|
||||
self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
// Check the long form.
|
||||
$types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
@@ -649,7 +649,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
|
||||
function test_ymd_paged() {
|
||||
public function test_ymd_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
$this->go_to( '/2007/09/04/page/2/' );
|
||||
@@ -657,7 +657,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
|
||||
function test_ymd() {
|
||||
public function test_ymd() {
|
||||
self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
$this->go_to( '/2007/09/04/' );
|
||||
$this->assertQueryTrue( 'is_archive', 'is_day', 'is_date' );
|
||||
@@ -665,7 +665,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
|
||||
// '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
|
||||
function test_ym_feed() {
|
||||
public function test_ym_feed() {
|
||||
self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
// Check the long form.
|
||||
$types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
@@ -683,7 +683,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
|
||||
function test_ym_paged() {
|
||||
public function test_ym_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
$this->go_to( '/2007/09/page/2/' );
|
||||
@@ -691,7 +691,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
|
||||
function test_ym() {
|
||||
public function test_ym() {
|
||||
self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
$this->go_to( '/2007/09/' );
|
||||
$this->assertQueryTrue( 'is_archive', 'is_date', 'is_month' );
|
||||
@@ -699,7 +699,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
|
||||
// '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
|
||||
function test_y_feed() {
|
||||
public function test_y_feed() {
|
||||
self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
// Check the long form.
|
||||
$types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
@@ -717,7 +717,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
|
||||
function test_y_paged() {
|
||||
public function test_y_paged() {
|
||||
update_option( 'posts_per_page', 2 );
|
||||
self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
$this->go_to( '/2007/page/2/' );
|
||||
@@ -725,14 +725,14 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
|
||||
function test_y() {
|
||||
public function test_y() {
|
||||
self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
|
||||
$this->go_to( '/2007/' );
|
||||
$this->assertQueryTrue( 'is_archive', 'is_date', 'is_year' );
|
||||
}
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
|
||||
function test_post_trackback() {
|
||||
public function test_post_trackback() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$permalink = get_permalink( $post_id );
|
||||
$this->go_to( "{$permalink}trackback/" );
|
||||
@@ -741,7 +741,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
|
||||
function test_post_comment_feed() {
|
||||
public function test_post_comment_feed() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$permalink = get_permalink( $post_id );
|
||||
// Check the long form.
|
||||
@@ -760,7 +760,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
|
||||
function test_post_paged_short() {
|
||||
public function test_post_paged_short() {
|
||||
$post_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_date' => '2007-09-04 00:00:00',
|
||||
@@ -775,7 +775,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
|
||||
function test_post_attachment() {
|
||||
public function test_post_attachment() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'attachment' ) );
|
||||
$permalink = get_attachment_link( $post_id );
|
||||
$this->go_to( $permalink );
|
||||
@@ -793,7 +793,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @expectedIncorrectUsage WP_Date_Query
|
||||
*/
|
||||
function test_bad_dates() {
|
||||
public function test_bad_dates() {
|
||||
$this->go_to( '/2013/13/13/' );
|
||||
$this->assertQueryTrue( 'is_404' );
|
||||
|
||||
@@ -801,7 +801,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$this->assertQueryTrue( 'is_404' );
|
||||
}
|
||||
|
||||
function test_post_type_archive_with_tax_query() {
|
||||
public function test_post_type_archive_with_tax_query() {
|
||||
delete_option( 'rewrite_rules' );
|
||||
|
||||
$cpt_name = 'ptawtq';
|
||||
@@ -832,7 +832,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_with_tax_query' ) );
|
||||
}
|
||||
|
||||
function pre_get_posts_with_tax_query( &$query ) {
|
||||
public function pre_get_posts_with_tax_query( &$query ) {
|
||||
$term = get_term_by( 'slug', 'tag-slug', 'post_tag' );
|
||||
$query->set(
|
||||
'tax_query',
|
||||
@@ -846,7 +846,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
function test_post_type_array() {
|
||||
public function test_post_type_array() {
|
||||
delete_option( 'rewrite_rules' );
|
||||
|
||||
$cpt_name = 'thearray';
|
||||
@@ -874,11 +874,11 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_with_type_array' ) );
|
||||
}
|
||||
|
||||
function pre_get_posts_with_type_array( &$query ) {
|
||||
public function pre_get_posts_with_type_array( &$query ) {
|
||||
$query->set( 'post_type', array( 'post', 'thearray' ) );
|
||||
}
|
||||
|
||||
function test_is_single() {
|
||||
public function test_is_single() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$this->go_to( "/?p=$post_id" );
|
||||
|
||||
@@ -898,7 +898,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 16802
|
||||
*/
|
||||
function test_is_single_with_parent() {
|
||||
public function test_is_single_with_parent() {
|
||||
// Use custom hierarchical post type.
|
||||
$post_type = 'test_hierarchical';
|
||||
|
||||
@@ -1005,7 +1005,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 38225
|
||||
*/
|
||||
function test_is_single_with_attachment() {
|
||||
public function test_is_single_with_attachment() {
|
||||
$post_id = self::factory()->post->create();
|
||||
|
||||
$attachment_id = self::factory()->attachment->create_object(
|
||||
@@ -1025,7 +1025,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$this->assertTrue( $q->is_attachment );
|
||||
}
|
||||
|
||||
function test_is_page() {
|
||||
public function test_is_page() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
|
||||
$this->go_to( "/?page_id=$post_id" );
|
||||
|
||||
@@ -1045,7 +1045,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 16802
|
||||
*/
|
||||
function test_is_page_with_parent() {
|
||||
public function test_is_page_with_parent() {
|
||||
$parent_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
@@ -1079,7 +1079,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$this->assertFalse( is_page( 'foo' ) );
|
||||
}
|
||||
|
||||
function test_is_attachment() {
|
||||
public function test_is_attachment() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'attachment' ) );
|
||||
$this->go_to( "/?attachment_id=$post_id" );
|
||||
|
||||
@@ -1236,7 +1236,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$this->assertFalse( $q->is_page( $p2 ) );
|
||||
}
|
||||
|
||||
function test_is_page_template() {
|
||||
public function test_is_page_template() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
|
||||
update_post_meta( $post_id, '_wp_page_template', 'example.php' );
|
||||
$this->go_to( "/?page_id=$post_id" );
|
||||
@@ -1246,7 +1246,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 31271
|
||||
*/
|
||||
function test_is_page_template_default() {
|
||||
public function test_is_page_template_default() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
|
||||
$this->go_to( "/?page_id=$post_id" );
|
||||
$this->assertTrue( is_page_template( 'default' ) );
|
||||
@@ -1256,7 +1256,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 31271
|
||||
*/
|
||||
function test_is_page_template_array() {
|
||||
public function test_is_page_template_array() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
|
||||
update_post_meta( $post_id, '_wp_page_template', 'example.php' );
|
||||
$this->go_to( "/?page_id=$post_id" );
|
||||
@@ -1267,7 +1267,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 18375
|
||||
*/
|
||||
function test_is_page_template_other_post_type() {
|
||||
public function test_is_page_template_other_post_type() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'post' ) );
|
||||
update_post_meta( $post_id, '_wp_page_template', 'example.php' );
|
||||
$this->go_to( get_post_permalink( $post_id ) );
|
||||
@@ -1278,7 +1278,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 39211
|
||||
*/
|
||||
function test_is_page_template_not_singular() {
|
||||
public function test_is_page_template_not_singular() {
|
||||
global $wpdb;
|
||||
|
||||
// We need a non-post that shares an ID with a post assigned a template.
|
||||
|
||||
Reference in New Issue
Block a user