mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-14 22:00:23 +00:00
Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues. This change includes three notable additions: - Multiline function calls must now put each parameter on a new line. - Auto-formatting files is now part of the `grunt precommit` script. - Auto-fixable coding standards issues will now cause Travis failures. Fixes #44600. git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -800,7 +800,8 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
$cpt_name = 'ptawtq';
|
||||
register_post_type(
|
||||
$cpt_name, array(
|
||||
$cpt_name,
|
||||
array(
|
||||
'taxonomies' => array( 'post_tag', 'category' ),
|
||||
'rewrite' => true,
|
||||
'has_archive' => true,
|
||||
@@ -828,7 +829,8 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
function pre_get_posts_with_tax_query( &$query ) {
|
||||
$term = get_term_by( 'slug', 'tag-slug', 'post_tag' );
|
||||
$query->set(
|
||||
'tax_query', array(
|
||||
'tax_query',
|
||||
array(
|
||||
array(
|
||||
'taxonomy' => 'post_tag',
|
||||
'field' => 'term_id',
|
||||
@@ -843,7 +845,8 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
|
||||
$cpt_name = 'thearray';
|
||||
register_post_type(
|
||||
$cpt_name, array(
|
||||
$cpt_name,
|
||||
array(
|
||||
'taxonomies' => array( 'post_tag', 'category' ),
|
||||
'rewrite' => true,
|
||||
'has_archive' => true,
|
||||
@@ -894,7 +897,8 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$post_type = 'test_hierarchical';
|
||||
|
||||
register_post_type(
|
||||
$post_type, array(
|
||||
$post_type,
|
||||
array(
|
||||
'hierarchical' => true,
|
||||
'rewrite' => true,
|
||||
'has_archive' => true,
|
||||
@@ -999,7 +1003,9 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
|
||||
$post_id = self::factory()->post->create();
|
||||
|
||||
$attachment_id = self::factory()->attachment->create_object(
|
||||
'image.jpg', $post_id, array(
|
||||
'image.jpg',
|
||||
$post_id,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -53,7 +53,8 @@ class Tests_Query_Date extends WP_UnitTestCase {
|
||||
|
||||
public function _get_query_result( $args = array() ) {
|
||||
$args = wp_parse_args(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'post_status' => 'any', // For the future post
|
||||
'posts_per_page' => '-1', // To make sure results are accurate
|
||||
'orderby' => 'ID', // Same order they were created
|
||||
|
||||
@@ -21,7 +21,8 @@ class Tests_Query_DateQuery extends WP_UnitTestCase {
|
||||
|
||||
public function _get_query_result( $args = array() ) {
|
||||
$args = wp_parse_args(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'post_status' => 'any', // For the future post
|
||||
'posts_per_page' => '-1', // To make sure results are accurate
|
||||
'orderby' => 'ID', // Same order they were created
|
||||
|
||||
@@ -186,7 +186,8 @@ class Tests_Query_IsTerm extends WP_UnitTestCase {
|
||||
|
||||
function pre_get_posts_tax_category_tax_query( &$query ) {
|
||||
$query->set(
|
||||
'tax_query', array(
|
||||
'tax_query',
|
||||
array(
|
||||
array(
|
||||
'taxonomy' => 'testtax',
|
||||
'field' => 'term_id',
|
||||
|
||||
@@ -1867,7 +1867,7 @@ class Tests_Query_MetaQuery extends WP_UnitTestCase {
|
||||
'key' => 'aa_foo',
|
||||
),
|
||||
),
|
||||
'fields' => 'ids',
|
||||
'fields' => 'ids',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1915,7 +1915,7 @@ class Tests_Query_MetaQuery extends WP_UnitTestCase {
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
),
|
||||
'fields' => 'ids',
|
||||
'fields' => 'ids',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -197,7 +197,8 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
|
||||
public function test_protected_should_be_included_when_in_the_admin() {
|
||||
set_current_screen( 'dashboard' );
|
||||
register_post_status(
|
||||
'foo', array(
|
||||
'foo',
|
||||
array(
|
||||
'protected' => true,
|
||||
'show_in_admin_all_list' => true,
|
||||
)
|
||||
@@ -264,7 +265,8 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
|
||||
public function test_single_post_with_nonpublic_and_protected_status_should_not_be_shown_for_user_who_cannot_edit_others_posts() {
|
||||
register_post_type( 'foo_pt' );
|
||||
register_post_status(
|
||||
'foo_ps', array(
|
||||
'foo_ps',
|
||||
array(
|
||||
'public' => false,
|
||||
'protected' => true,
|
||||
)
|
||||
@@ -290,7 +292,8 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
|
||||
public function test_single_post_with_nonpublic_and_protected_status_should_be_shown_for_user_who_can_edit_others_posts() {
|
||||
register_post_type( 'foo_pt' );
|
||||
register_post_status(
|
||||
'foo_ps', array(
|
||||
'foo_ps',
|
||||
array(
|
||||
'public' => false,
|
||||
'protected' => true,
|
||||
)
|
||||
@@ -316,7 +319,8 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
|
||||
public function test_single_post_with_nonpublic_and_private_status_should_not_be_shown_for_user_who_cannot_edit_others_posts() {
|
||||
register_post_type( 'foo_pt' );
|
||||
register_post_status(
|
||||
'foo_ps', array(
|
||||
'foo_ps',
|
||||
array(
|
||||
'public' => false,
|
||||
'private' => true,
|
||||
)
|
||||
@@ -342,7 +346,8 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
|
||||
public function test_single_post_with_nonpublic_and_private_status_should_be_shown_for_user_who_can_edit_others_posts() {
|
||||
register_post_type( 'foo_pt' );
|
||||
register_post_status(
|
||||
'foo_ps', array(
|
||||
'foo_ps',
|
||||
array(
|
||||
'public' => false,
|
||||
'private' => true,
|
||||
)
|
||||
|
||||
@@ -527,7 +527,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
array(
|
||||
'child-one',
|
||||
'child-two',
|
||||
), wp_list_pluck( $posts, 'post_title' )
|
||||
),
|
||||
wp_list_pluck( $posts, 'post_title' )
|
||||
);
|
||||
|
||||
// Second parent's children
|
||||
@@ -543,7 +544,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
array(
|
||||
'child-three',
|
||||
'child-four',
|
||||
), wp_list_pluck( $posts, 'post_title' )
|
||||
),
|
||||
wp_list_pluck( $posts, 'post_title' )
|
||||
);
|
||||
|
||||
// Both first and second parent's children
|
||||
@@ -561,7 +563,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
'child-two',
|
||||
'child-three',
|
||||
'child-four',
|
||||
), wp_list_pluck( $posts, 'post_title' )
|
||||
),
|
||||
wp_list_pluck( $posts, 'post_title' )
|
||||
);
|
||||
|
||||
// Third parent's children
|
||||
@@ -592,7 +595,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
'child-four',
|
||||
'child-one',
|
||||
'child-two',
|
||||
), wp_list_pluck( $posts, 'post_title' )
|
||||
),
|
||||
wp_list_pluck( $posts, 'post_title' )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1063,7 +1067,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
// If both arguments are passed, only post_password is considered.
|
||||
$result4 = $this->q->query(
|
||||
array_merge(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'has_password' => true,
|
||||
'post_password' => '',
|
||||
)
|
||||
@@ -1072,7 +1077,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
$this->assertEquals( array( $one ), $result4 );
|
||||
$result5 = $this->q->query(
|
||||
array_merge(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'has_password' => false,
|
||||
'post_password' => '',
|
||||
)
|
||||
@@ -1081,7 +1087,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
$this->assertEquals( array( $one ), $result5 );
|
||||
$result6 = $this->q->query(
|
||||
array_merge(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'has_password' => null,
|
||||
'post_password' => '',
|
||||
)
|
||||
@@ -1091,7 +1098,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
|
||||
$result7 = $this->q->query(
|
||||
array_merge(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'has_password' => true,
|
||||
'post_password' => 'burrito',
|
||||
)
|
||||
@@ -1100,7 +1108,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
$this->assertEqualSets( array( $two, $three ), $result7 );
|
||||
$result8 = $this->q->query(
|
||||
array_merge(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'has_password' => false,
|
||||
'post_password' => 'burrito',
|
||||
)
|
||||
@@ -1109,7 +1118,8 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
$this->assertEqualSets( array( $two, $three ), $result8 );
|
||||
$result9 = $this->q->query(
|
||||
array_merge(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'has_password' => null,
|
||||
'post_password' => 'burrito',
|
||||
)
|
||||
|
||||
@@ -613,7 +613,8 @@ class Tests_Query_Search extends WP_UnitTestCase {
|
||||
add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
|
||||
|
||||
apply_filters(
|
||||
'posts_clauses', array(
|
||||
'posts_clauses',
|
||||
array(
|
||||
'where' => '',
|
||||
'groupby' => '',
|
||||
'join' => '',
|
||||
|
||||
@@ -1214,7 +1214,9 @@ class Tests_Query_TaxQuery extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
$image_id = self::factory()->attachment->create_object(
|
||||
'image.jpg', 0, array(
|
||||
'image.jpg',
|
||||
0,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'post_type' => 'attachment',
|
||||
)
|
||||
|
||||
@@ -71,7 +71,9 @@ class Tests_Query_Vars extends WP_UnitTestCase {
|
||||
'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'
|
||||
),
|
||||
$wp->public_query_vars,
|
||||
'Care should be taken when introducing new public query vars. See https://core.trac.wordpress.org/ticket/35115'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user