mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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:
@@ -706,7 +706,8 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Framework_TestCase {
|
||||
// note: the WP and WP_Query classes like to silently fetch parameters
|
||||
// from all over the place (globals, GET, etc), which makes it tricky
|
||||
// to run them more than once without very carefully clearing everything
|
||||
$_GET = $_POST = array();
|
||||
$_GET = array();
|
||||
$_POST = array();
|
||||
foreach ( array( 'query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow', 'current_screen' ) as $v ) {
|
||||
if ( isset( $GLOBALS[ $v ] ) ) {
|
||||
unset( $GLOBALS[ $v ] );
|
||||
|
||||
@@ -71,7 +71,9 @@ define( 'WP_MAX_MEMORY_LIMIT', -1 );
|
||||
|
||||
define( 'REST_TESTS_IMPOSSIBLY_HIGH_NUMBER', 99999999 );
|
||||
|
||||
$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
|
||||
$PHP_SELF = '/index.php';
|
||||
$GLOBALS['PHP_SELF'] = '/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/index.php';
|
||||
|
||||
// Should we run in multisite mode?
|
||||
$multisite = '1' == getenv( 'WP_MULTISITE' );
|
||||
|
||||
@@ -20,7 +20,9 @@ if ( ! defined( 'WP_DEFAULT_THEME' ) ) {
|
||||
|
||||
tests_reset__SERVER();
|
||||
|
||||
$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
|
||||
$PHP_SELF = '/index.php';
|
||||
$GLOBALS['PHP_SELF'] = '/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/index.php';
|
||||
|
||||
tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter_exit' );
|
||||
|
||||
|
||||
@@ -266,7 +266,8 @@ class SpeedTrapListener implements PHPUnit_Framework_TestListener {
|
||||
* Renders slow test report footer.
|
||||
*/
|
||||
protected function renderFooter() {
|
||||
if ( $hidden = $this->getHiddenCount( $this->slow ) ) {
|
||||
$hidden = $this->getHiddenCount( $this->slow );
|
||||
if ( $hidden ) {
|
||||
echo sprintf( '...and there %s %s more above your threshold hidden from view', $hidden == 1 ? 'is' : 'are', $hidden );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,14 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
'post_date' => '2008-06-02 00:00:00',
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $post_id = $factory->post->create(
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_title' => 'post-format-test-gallery',
|
||||
'post_date' => '2008-06-10 00:00:00',
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $factory->post->create(
|
||||
self::$post_ids[] = $post_id;
|
||||
$factory->post->create(
|
||||
array(
|
||||
'import_id' => 611,
|
||||
'post_type' => 'attachment',
|
||||
@@ -75,6 +76,7 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
'post_parent' => $post_id,
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $post_id;
|
||||
|
||||
self::$post_ids[] = $factory->post->create(
|
||||
array(
|
||||
@@ -84,13 +86,14 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
self::$post_ids[] = $post_id = $factory->post->create(
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'import_id' => 149,
|
||||
'post_title' => 'comment-test',
|
||||
'post_date' => '2008-03-03 00:00:00',
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $post_id;
|
||||
self::$comment_ids = $factory->comment->create_post_comments( $post_id, 15 );
|
||||
|
||||
self::$post_ids[] = $factory->post->create( array( 'post_date' => '2008-09-05 00:00:00' ) );
|
||||
@@ -111,12 +114,13 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
'post_title' => 'about',
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $post_id = $factory->post->create(
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'post_title' => 'parent-page',
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $post_id;
|
||||
self::$post_ids[] = $factory->post->create(
|
||||
array(
|
||||
'import_id' => 144,
|
||||
@@ -126,40 +130,45 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
self::$post_ids[] = $parent_id = $factory->post->create(
|
||||
$parent_id = $factory->post->create(
|
||||
array(
|
||||
'post_name' => 'parent',
|
||||
'post_type' => 'page',
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $child_id_1 = $factory->post->create(
|
||||
self::$post_ids[] = $parent_id;
|
||||
$child_id_1 = $factory->post->create(
|
||||
array(
|
||||
'post_name' => 'child1',
|
||||
'post_type' => 'page',
|
||||
'post_parent' => $parent_id,
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $child_id_2 = $factory->post->create(
|
||||
self::$post_ids[] = $child_id_1;
|
||||
$child_id_2 = $factory->post->create(
|
||||
array(
|
||||
'post_name' => 'child2',
|
||||
'post_type' => 'page',
|
||||
'post_parent' => $parent_id,
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $grandchild_id_1 = $factory->post->create(
|
||||
self::$post_ids[] = $child_id_2;
|
||||
$grandchild_id_1 = $factory->post->create(
|
||||
array(
|
||||
'post_name' => 'grandchild',
|
||||
'post_type' => 'page',
|
||||
'post_parent' => $child_id_1,
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $grandchild_id_2 = $factory->post->create(
|
||||
self::$post_ids[] = $grandchild_id_1;
|
||||
$grandchild_id_2 = $factory->post->create(
|
||||
array(
|
||||
'post_name' => 'grandchild',
|
||||
'post_type' => 'page',
|
||||
'post_parent' => $child_id_2,
|
||||
)
|
||||
);
|
||||
self::$post_ids[] = $grandchild_id_2;
|
||||
|
||||
$cat1 = $factory->term->create(
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user