Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in tests.

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45588 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2019-07-02 04:43:01 +00:00
parent 969c17d82d
commit fe28df65e3
36 changed files with 278 additions and 132 deletions
+20 -12
View File
@@ -161,20 +161,22 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
// '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
function test_page_trackback() {
$page_ids = array();
$page_ids[] = $page_id = self::factory()->post->create(
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'parent-page',
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-1',
'post_parent' => $page_id,
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_ids[] = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-2',
@@ -197,20 +199,22 @@ 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() {
$page_ids = array();
$page_ids[] = $page_id = self::factory()->post->create(
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'parent-page',
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-1',
'post_parent' => $page_id,
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_ids[] = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-2',
@@ -233,20 +237,22 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
function test_page_feed_with_no_comments() {
$page_ids = array();
$page_ids[] = $page_id = self::factory()->post->create(
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'parent-page',
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-1',
'post_parent' => $page_id,
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_ids[] = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-2',
@@ -269,20 +275,22 @@ 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() {
$page_ids = array();
$page_ids[] = $page_id = self::factory()->post->create(
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'parent-page',
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-1',
'post_parent' => $page_id,
)
);
$page_ids[] = $page_id = self::factory()->post->create(
$page_ids[] = $page_id;
$page_ids[] = self::factory()->post->create(
array(
'post_type' => 'page',
'post_title' => 'child-page-2',
+28 -14
View File
@@ -22,49 +22,56 @@ class Tests_Query_Results extends WP_UnitTestCase {
static $child_four;
public static function wpSetUpBeforeClass( $factory ) {
self::$cat_ids[] = $cat_a = $factory->term->create(
$cat_a = $factory->term->create(
array(
'taxonomy' => 'category',
'name' => 'cat-a',
)
);
self::$cat_ids[] = $cat_b = $factory->term->create(
self::$cat_ids[] = $cat_a;
$cat_b = $factory->term->create(
array(
'taxonomy' => 'category',
'name' => 'cat-b',
)
);
self::$cat_ids[] = $cat_c = $factory->term->create(
self::$cat_ids[] = $cat_b;
$cat_c = $factory->term->create(
array(
'taxonomy' => 'category',
'name' => 'cat-c',
)
);
self::$cat_ids[] = $cat_c;
self::$tag_ids[] = $tag_a = $factory->term->create(
$tag_a = $factory->term->create(
array(
'taxonomy' => 'post_tag',
'name' => 'tag-a',
)
);
self::$tag_ids[] = $tag_b = $factory->term->create(
self::$tag_ids[] = $tag_a;
$tag_b = $factory->term->create(
array(
'taxonomy' => 'post_tag',
'name' => 'tag-b',
)
);
self::$tag_ids[] = $tag_c = $factory->term->create(
self::$tag_ids[] = $tag_b;
$tag_c = $factory->term->create(
array(
'taxonomy' => 'post_tag',
'name' => 'tag-c',
)
);
self::$tag_ids[] = $tag_nun = $factory->term->create(
self::$tag_ids[] = $tag_c;
$tag_nun = $factory->term->create(
array(
'taxonomy' => 'post_tag',
'name' => 'tag-נ',
)
);
self::$tag_ids[] = $tag_nun;
self::$post_ids[] = $factory->post->create(
array(
@@ -232,52 +239,59 @@ class Tests_Query_Results extends WP_UnitTestCase {
)
);
self::$post_ids[] = self::$parent_one = $factory->post->create(
self::$parent_one = $factory->post->create(
array(
'post_title' => 'parent-one',
'post_date' => '2007-01-01 00:00:00',
)
);
self::$post_ids[] = self::$parent_two = $factory->post->create(
self::$post_ids[] = self::$parent_one;
self::$parent_two = $factory->post->create(
array(
'post_title' => 'parent-two',
'post_date' => '2007-01-01 00:00:00',
)
);
self::$post_ids[] = self::$parent_three = $factory->post->create(
self::$post_ids[] = self::$parent_two;
self::$parent_three = $factory->post->create(
array(
'post_title' => 'parent-three',
'post_date' => '2007-01-01 00:00:00',
)
);
self::$post_ids[] = self::$child_one = $factory->post->create(
self::$post_ids[] = self::$parent_three;
self::$child_one = $factory->post->create(
array(
'post_title' => 'child-one',
'post_parent' => self::$parent_one,
'post_date' => '2007-01-01 00:00:01',
)
);
self::$post_ids[] = self::$child_two = $factory->post->create(
self::$post_ids[] = self::$child_one;
self::$child_two = $factory->post->create(
array(
'post_title' => 'child-two',
'post_parent' => self::$parent_one,
'post_date' => '2007-01-01 00:00:02',
)
);
self::$post_ids[] = self::$child_three = $factory->post->create(
self::$post_ids[] = self::$child_two;
self::$child_three = $factory->post->create(
array(
'post_title' => 'child-three',
'post_parent' => self::$parent_two,
'post_date' => '2007-01-01 00:00:03',
)
);
self::$post_ids[] = self::$child_four = $factory->post->create(
self::$post_ids[] = self::$child_three;
self::$child_four = $factory->post->create(
array(
'post_title' => 'child-four',
'post_parent' => self::$parent_two,
'post_date' => '2007-01-01 00:00:04',
)
);
self::$post_ids[] = self::$child_four;
}
function setUp() {
+2 -1
View File
@@ -403,7 +403,8 @@ class Tests_Query_SetupPostdata extends WP_UnitTestCase {
*/
function test_setup_postdata_loop() {
$post_id = self::factory()->post->create( array( 'post_content' => 'global post' ) );
$GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id );
$GLOBALS['post'] = get_post( $post_id );
$GLOBALS['wp_query']->post = $GLOBALS['post'];
$ids = self::factory()->post->create_many( 5 );
foreach ( $ids as $id ) {
+2 -1
View File
@@ -1298,7 +1298,8 @@ class Tests_Query_TaxQuery extends WP_UnitTestCase {
$posts = self::factory()->post->create_many( 5 );
$cats = $tags = array();
$cats = array();
$tags = array();
// need term_taxonomy_ids in addition to term_ids, so no factory
for ( $i = 0; $i < 5; $i++ ) {