General: Fix some precision alignment formatting warnings.

The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42228 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-11-26 23:56:25 +00:00
parent d00e74042b
commit 574821573a
82 changed files with 355 additions and 352 deletions

View File

@@ -129,8 +129,8 @@ require dirname( __FILE__ ) . '/spy-rest-server.php';
*/
class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
protected $longOptions = array(
'exclude-group=',
'group=',
'exclude-group=',
'group=',
);
function __construct( $argv ) {
array_shift( $argv );

View File

@@ -31,7 +31,7 @@ class Tests_Canonical_PageOnFront extends WP_Canonical_UnitTestCase {
* (string) expected redirect location
* [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
*/
return array(
return array(
// Check against an odd redirect
array( '/page/2/', '/page/2/' ),
array( '/?page=2', '/page/2/' ),
@@ -43,6 +43,6 @@ class Tests_Canonical_PageOnFront extends WP_Canonical_UnitTestCase {
array( '/front-page/2/', '/page/2/' ),
array( '/front-page/?page=2', '/page/2/' ),
array( '/blog-page/?paged=2', '/blog-page/page/2/' ),
);
);
}
}

View File

@@ -616,10 +616,10 @@ class Tests_Comment extends WP_UnitTestCase {
// Check to see if a notification email was sent to the post author `test@test.com`.
if ( isset( $GLOBALS['phpmailer']->mock_sent ) &&
! empty( $GLOBALS['phpmailer']->mock_sent ) &&
'test@test.com' == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] ) {
$email_sent_when_comment_added = true;
reset_phpmailer_instance();
! empty( $GLOBALS['phpmailer']->mock_sent ) &&
'test@test.com' == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] ) {
$email_sent_when_comment_added = true;
reset_phpmailer_instance();
} else {
$email_sent_when_comment_added = false;
}

View File

@@ -131,7 +131,7 @@ class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase {
/**
* Validate max_num_comment_pages logic of get_comment_pages_count
*/
function test_max_num_comment_pages() {
function test_max_num_comment_pages() {
global $wp_query;
$wp_query = new WP_Query();
@@ -144,5 +144,5 @@ class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase {
$this->assertEquals( 0, get_comment_pages_count( array(), null, null ) );
$wp_query->max_num_comment_pages = $org_max_num_comment_pages;
}
}
}

View File

@@ -89,7 +89,7 @@ class Tests_Comment_Last_Modified extends WP_UnitTestCase {
$this->assertFalse( wp_cache_get( 'lastcommentmodified:server', 'timeinfo' ) );
$this->assertSame( strtotime( '2000-01-02 10:00:00' ), strtotime( get_lastcommentmodified() ) );
$this->assertSame( strtotime( '2000-01-02 10:00:00' ), strtotime( wp_cache_get( 'lastcommentmodified:server', 'timeinfo' ) ) );
$this->assertSame( strtotime( '2000-01-02 10:00:00' ), strtotime( wp_cache_get( 'lastcommentmodified:server', 'timeinfo' ) ) );
}
public function test_cache_is_cleared_when_comment_is_trashed() {

View File

@@ -98,38 +98,38 @@ class Tests_Compat extends WP_UnitTestCase {
$heredoc = <<<EOT
hello world
EOT;
$inputs = array(
/*1*/ 0,
1,
12345,
-2345,
// float data
/*5*/ 10.5,
-10.5,
12.3456789000e10,
12.3456789000E-10,
.5,
// null data
/*10*/ NULL,
null,
// boolean data
/*12*/ true,
false,
TRUE,
FALSE,
// empty data
/*16*/ "",
'',
// string data
/*18*/ "string",
'string',
$heredoc,
// object data
/*21*/ new classA(),
// undefined data
/*22*/ @$undefined_var,
// unset data
/*23*/ @$unset_var,
$inputs = array(
0,
1,
12345,
-2345,
// float data
10.5,
-10.5,
12.3456789000e10,
12.3456789000E-10,
.5,
// null data
NULL,
null,
// boolean data
true,
false,
TRUE,
FALSE,
// empty data
"",
'',
// string data
"string",
'string',
$heredoc,
// object data
new classA(),
// undefined data
@$undefined_var,
// unset data
@$unset_var,
);
$outputs = array(
"0",

View File

@@ -104,10 +104,10 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
$trans_orig = $wpsmiliestrans; // save original translations array
$wpsmiliestrans = array(
':PP' => 'icon_tongue.gif',
':arrow:' => 'icon_arrow.gif',
':monkey:' => 'icon_shock_the_monkey.gif',
':nervou:' => 'icon_nervou.gif'
':PP' => 'icon_tongue.gif',
':arrow:' => 'icon_arrow.gif',
':monkey:' => 'icon_shock_the_monkey.gif',
':nervou:' => 'icon_nervou.gif'
);
smilies_init();
@@ -258,7 +258,7 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
$orig_trans = $wpsmiliestrans; // save original tranlations array
$wpsmiliestrans = array (
':)' => 'simple-smile.png'
':)' => 'simple-smile.png'
);
smilies_init();
@@ -346,13 +346,13 @@ class Tests_Formatting_Smilies extends WP_UnitTestCase {
}
public function _filter_remove_smilies( $wpsmiliestrans ) {
public function _filter_remove_smilies( $wpsmiliestrans ) {
unset( $wpsmiliestrans[':oops:'] );
return $wpsmiliestrans;
}
}
public function _filter_add_smilies( $wpsmiliestrans ) {
public function _filter_add_smilies( $wpsmiliestrans ) {
$wpsmiliestrans['<3'] = '\xe2\x9d\xa4';
return $wpsmiliestrans;
}
}
}

View File

@@ -14,9 +14,9 @@ class Tests_Formatting_Ent2NCR extends WP_UnitTestCase {
}
/**
Get test data from files, one test per line.
Comments start with "###".
*/
* Get test data from files, one test per line.
* Comments start with "###".
*/
function entities() {
$entities = file( DIR_TESTDATA . '/formatting/entities.txt' );
$data_provided = array();

View File

@@ -127,10 +127,10 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
array( 123, array( 'path' => '123' ) ),
);
/*
Untestable edge cases in various PHP:
- ///example.com - Fails in PHP >= 5.4.7, assumed path in <5.4.7
- ://example.com - assumed path in PHP >= 5.4.7, fails in <5.4.7
*/
* Untestable edge cases in various PHP:
* - ///example.com - Fails in PHP >= 5.4.7, assumed path in <5.4.7
* - ://example.com - assumed path in PHP >= 5.4.7, fails in <5.4.7
*/
}
/**

View File

@@ -292,7 +292,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
$this->fail( 'jpeg support unavailable' );
$file = wp_crop_image( DIR_TESTDATA . '/images/canola.jpg',
0, 0, 100, 100, 100, 100 );
0, 0, 100, 100, 100, 100 );
$this->assertNotInstanceOf( 'WP_Error', $file );
$this->assertFileExists( $file );
$image = wp_get_image_editor( $file );
@@ -312,8 +312,8 @@ class Tests_Image_Functions extends WP_UnitTestCase {
}
$file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
0, 0, 100, 100, 100, 100, false,
DIR_TESTDATA . '/images/' . __FUNCTION__ . '.jpg' );
0, 0, 100, 100, 100, 100, false,
DIR_TESTDATA . '/images/' . __FUNCTION__ . '.jpg' );
$this->assertNotInstanceOf( 'WP_Error', $file );
$this->assertFileExists( $file );
$image = wp_get_image_editor( $file );
@@ -326,7 +326,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
public function test_wp_crop_image_file_not_exist() {
$file = wp_crop_image( DIR_TESTDATA . '/images/canoladoesnotexist.jpg',
0, 0, 100, 100, 100, 100 );
0, 0, 100, 100, 100, 100 );
$this->assertInstanceOf( 'WP_Error', $file );
}
@@ -336,7 +336,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
}
$file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
0, 0, 100, 100, 100, 100 );
0, 0, 100, 100, 100, 100 );
$this->assertInstanceOf( 'WP_Error', $file );
}
@@ -352,7 +352,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
add_filter( 'wp_image_editors', array( $this, 'mock_image_editor' ) );
$file = wp_crop_image( DIR_TESTDATA . '/images/canola.jpg',
0, 0, 100, 100, 100, 100 );
0, 0, 100, 100, 100, 100 );
$this->assertInstanceOf( 'WP_Error', $file );
remove_filter( 'wp_image_editors', array( $this, 'mock_image_editor' ) );

View File

@@ -171,7 +171,7 @@ abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase
return $editor;
$resized = $editor->resize( $width, $height, $crop );
if ( is_wp_error( $resized ) )
if ( is_wp_error( $resized ) )
return $resized;
$dest_file = $editor->generate_filename();

View File

@@ -165,12 +165,12 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
$revisions = wp_get_post_revisions( $post_id );
$this->assertCount( 1, $revisions );
foreach ( $revisions as $revision ) {
$this->assertTrue( user_can( self::$editor_user_id, 'edit_post', $revision->post_parent ) );
$this->assertTrue( user_can( self::$editor_user_id, 'edit_post', $revision->post_parent ) );
}
// Author shouldn't be able to restore the revisions
foreach ( $revisions as $revision ) {
$this->assertFalse( user_can( self::$author_user_id, 'edit_post', $revision->post_parent ) );
$this->assertFalse( user_can( self::$author_user_id, 'edit_post', $revision->post_parent ) );
}
}
@@ -215,12 +215,12 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
$this->assertTrue( user_can( self::$editor_user_id, 'read_post', $post_id ) );
foreach ( $revisions as $revision ) {
$this->assertTrue( user_can( self::$editor_user_id, 'read_post', $revision->ID ) );
$this->assertTrue( user_can( self::$editor_user_id, 'read_post', $revision->ID ) );
}
// Author should be able to view the revisions fine
foreach ( $revisions as $revision ) {
$this->assertTrue( user_can( self::$author_user_id, 'read_post', $revision->ID ) );
$this->assertTrue( user_can( self::$author_user_id, 'read_post', $revision->ID ) );
}
}

View File

@@ -415,7 +415,7 @@ class Tests_Query_Results extends WP_UnitTestCase {
// Expect post ids in the same order as post__in array when order=asc is passed in
$this->assertSame( $expected_returned_array, $q->posts );
}
}
/**
* @ticket 39055

View File

@@ -7,9 +7,9 @@
* @subpackage REST API
*/
/**
* @group restapi
*/
/**
* @group restapi
*/
class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Testcase {
protected static $editor_id;

View File

@@ -6,9 +6,9 @@
* @subpackage REST API
*/
/**
* @group restapi
*/
/**
* @group restapi
*/
class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
protected static $wp_meta_keys_saved;
protected static $post_id;

View File

@@ -6,9 +6,9 @@
* @subpackage REST API
*/
/**
* @group restapi
*/
/**
* @group restapi
*/
class WP_Test_REST_Post_Statuses_Controller extends WP_Test_REST_Controller_Testcase {
public function test_register_routes() {

View File

@@ -6,9 +6,9 @@
* @subpackage REST API
*/
/**
* @group restapi
*/
/**
* @group restapi
*/
class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcase {
public function test_register_routes() {

View File

@@ -6,9 +6,9 @@
* @subpackage REST API
*/
/**
* @group restapi
*/
/**
* @group restapi
*/
class WP_Test_REST_Revisions_Controller extends WP_Test_REST_Controller_Testcase {
protected static $post_id;
protected static $page_id;

View File

@@ -397,12 +397,12 @@ class Tests_REST_Server extends WP_Test_REST_TestCase {
public function test_json_error_with_status() {
$stub = $this->getMockBuilder( 'Spy_REST_Server' )
->setMethods( array( 'set_status' ) )
->getMock();
->setMethods( array( 'set_status' ) )
->getMock();
$stub->expects( $this->once() )
->method( 'set_status' )
->with( $this->equalTo( 400 ) );
->method( 'set_status' )
->with( $this->equalTo( 400 ) );
$data = array(
'code' => 'wp-api-test-error',

View File

@@ -145,7 +145,7 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
/**
* @ticket 34332
*/
public function test_should_return_null_when_provided_taxonomy_does_not_match_actual_term_taxonomy() {
public function test_should_return_null_when_provided_taxonomy_does_not_match_actual_term_taxonomy() {
$term_id = self::factory()->term->create( array( 'taxonomy' => 'post_tag' ) );
$this->assertNull( get_term( $term_id, 'category' ) );
}