mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Coding Standards: Fix the remaining issues in /tests.
All PHP files in `/tests` now conform to the PHP coding standards, or have exceptions appropriately marked. Travis now also runs `phpcs` on the `/tests` directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉 See #47632. git-svn-id: https://develop.svn.wordpress.org/trunk@45607 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -109,7 +109,7 @@ class Tests_XMLRPC_mw_getRecentPosts extends WP_XMLRPC_UnitTestCase {
|
||||
$this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
|
||||
$this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
|
||||
|
||||
if ( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == self::$post_id ) {
|
||||
if ( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] === self::$post_id ) {
|
||||
$attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true );
|
||||
|
||||
$this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
|
||||
|
||||
@@ -445,7 +445,7 @@ class Tests_XMLRPC_wp_editPost extends WP_XMLRPC_UnitTestCase {
|
||||
$this->assertEquals( 1, count( get_post_meta( $post_id, 'enclosure' ) ) );
|
||||
|
||||
// For good measure, check that the expected value is in the array
|
||||
$this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) ) );
|
||||
$this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ), true ) );
|
||||
|
||||
// Attempt to add a brand new enclosure via XML-RPC
|
||||
$this->myxmlrpcserver->add_enclosure_if_new( $post_id, $new_enclosure );
|
||||
@@ -455,10 +455,10 @@ class Tests_XMLRPC_wp_editPost extends WP_XMLRPC_UnitTestCase {
|
||||
|
||||
// Check that the new enclosure is in the enclosure meta
|
||||
$new_enclosure_string = "{$new_enclosure['url']}\n{$new_enclosure['length']}\n{$new_enclosure['type']}\n";
|
||||
$this->assertTrue( in_array( $new_enclosure_string, get_post_meta( $post_id, 'enclosure' ) ) );
|
||||
$this->assertTrue( in_array( $new_enclosure_string, get_post_meta( $post_id, 'enclosure' ), true ) );
|
||||
|
||||
// Check that the old enclosure is in the enclosure meta
|
||||
$this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) ) );
|
||||
$this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ), true ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,8 +55,8 @@ class Tests_XMLRPC_wp_getPages extends WP_XMLRPC_UnitTestCase {
|
||||
}
|
||||
|
||||
function remove_editor_edit_page_cap( $caps, $cap, $user_id, $args ) {
|
||||
if ( in_array( $cap, array( 'edit_page', 'edit_others_pages' ) ) ) {
|
||||
if ( $user_id == self::$editor_id && $args[0] == self::$post_id ) {
|
||||
if ( in_array( $cap, array( 'edit_page', 'edit_others_pages' ), true ) ) {
|
||||
if ( $user_id === self::$editor_id && $args[0] === self::$post_id ) {
|
||||
return array( false );
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class Tests_XMLRPC_wp_getPages extends WP_XMLRPC_UnitTestCase {
|
||||
// WP#20629
|
||||
$this->assertNotIXRError( $result );
|
||||
|
||||
if ( $result['page_id'] == self::$post_id ) {
|
||||
if ( $result['page_id'] === self::$post_id ) {
|
||||
$found_incapable = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -121,9 +121,9 @@ class Tests_XMLRPC_wp_getTerms extends WP_XMLRPC_UnitTestCase {
|
||||
$this->assertNotEquals( 0, count( $results ) );
|
||||
|
||||
foreach ( $results as $term ) {
|
||||
if ( $term['term_id'] == $cat1 ) {
|
||||
if ( $term['term_id'] === $cat1 ) {
|
||||
break; // found cat1 first as expected
|
||||
} elseif ( $term['term_id'] == $cat2 ) {
|
||||
} elseif ( $term['term_id'] === $cat2 ) {
|
||||
$this->assertFalse( false, 'Incorrect category ordering.' );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user