mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Tests: Replace some occurrences of assertEquals() with assertSame().
This ensures that not only the return values match the expected results, but also that their type is the same. Props costdev, desrosj. See #55654. git-svn-id: https://develop.svn.wordpress.org/trunk@54402 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8128f19599
commit
28fdf705dc
@ -17,7 +17,7 @@ class Tests_Admin_IncludesUser extends WP_UnitTestCase {
|
||||
|
||||
if ( $error_code ) {
|
||||
$this->assertWPError( $error );
|
||||
$this->assertEquals( $error_code, $error->get_error_code() );
|
||||
$this->assertSame( $error_code, $error->get_error_code() );
|
||||
} else {
|
||||
$this->assertNotWPError( $error );
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase {
|
||||
$exception = $e;
|
||||
}
|
||||
$this->assertNotEmpty( $e );
|
||||
$this->assertEquals( -1, $e->getMessage() );
|
||||
$this->assertSame( '-1', $e->getMessage() );
|
||||
|
||||
// Not called setup_theme.
|
||||
wp_set_current_user( self::$admin_user_id );
|
||||
|
||||
@ -208,7 +208,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
|
||||
* @dataProvider data_remove_theme_attribute_in_block_template_content
|
||||
*/
|
||||
function test_remove_theme_attribute_in_block_template_content( $template_content, $expected ) {
|
||||
$this->assertEquals( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) );
|
||||
$this->assertSame( $expected, _remove_theme_attribute_in_block_template_content( $template_content ) );
|
||||
}
|
||||
|
||||
function data_remove_theme_attribute_in_block_template_content() {
|
||||
|
||||
@ -240,7 +240,7 @@ class Tests_Blocks_wpBlockType extends WP_UnitTestCase {
|
||||
|
||||
$prepared_attributes = $block_type->prepare_attributes_for_render( $attributes );
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'correct' => 'include',
|
||||
/* wrongType */
|
||||
|
||||
@ -174,9 +174,9 @@ class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase {
|
||||
|
||||
$wp_query->max_num_comment_pages = 7;
|
||||
|
||||
$this->assertEquals( 7, get_comment_pages_count() );
|
||||
$this->assertEquals( 7, get_comment_pages_count( null, null, null ) );
|
||||
$this->assertEquals( 0, get_comment_pages_count( array(), null, null ) );
|
||||
$this->assertSame( 7, get_comment_pages_count() );
|
||||
$this->assertSame( 7, get_comment_pages_count( null, null, null ) );
|
||||
$this->assertSame( 0, get_comment_pages_count( array(), null, null ) );
|
||||
|
||||
$wp_query->max_num_comment_pages = $org_max_num_comment_pages;
|
||||
}
|
||||
|
||||
@ -4021,7 +4021,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals( 3, $q->found_comments );
|
||||
$this->assertSame( 3, $q->found_comments );
|
||||
$this->assertEquals( 2, $q->max_num_pages );
|
||||
}
|
||||
|
||||
|
||||
@ -2533,10 +2533,10 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
$this->assertSame( $default_value, $this->manager->post_value( $setting, $default_value ) );
|
||||
$this->assertSame( $default_value, $setting->post_value( $default_value ) );
|
||||
|
||||
$post_value = '42';
|
||||
$this->manager->set_post_value( 'numeric', $post_value );
|
||||
$this->assertEquals( $post_value, $this->manager->post_value( $setting, $default_value ) );
|
||||
$this->assertEquals( $post_value, $setting->post_value( $default_value ) );
|
||||
$post_value = 42;
|
||||
$this->manager->set_post_value( 'numeric', (string) $post_value );
|
||||
$this->assertSame( $post_value, $this->manager->post_value( $setting, $default_value ) );
|
||||
$this->assertSame( $post_value, $setting->post_value( $default_value ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -188,8 +188,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
|
||||
$count_customize_render_partials_after = has_action( 'customize_render_partials_after' );
|
||||
ob_start();
|
||||
try {
|
||||
$this->expected_partial_ids = array( 'foo' );
|
||||
@ -200,8 +198,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
} catch ( WPDieException $e ) {
|
||||
$this->assertSame( '', $e->getMessage() );
|
||||
}
|
||||
$this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_after' ) );
|
||||
$output = json_decode( ob_get_clean(), true );
|
||||
$this->assertSame( array( false ), $output['data']['contents']['foo'] );
|
||||
}
|
||||
@ -326,8 +324,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
|
||||
$count_customize_render_partials_after = has_action( 'customize_render_partials_after' );
|
||||
ob_start();
|
||||
try {
|
||||
$this->expected_partial_ids = array( 'test_blogname' );
|
||||
@ -338,8 +334,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
} catch ( WPDieException $e ) {
|
||||
$this->assertSame( '', $e->getMessage() );
|
||||
}
|
||||
$this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_after' ) );
|
||||
$output = json_decode( ob_get_clean(), true );
|
||||
$this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_blogname'] );
|
||||
$this->assertArrayHasKey( 'setting_validities', $output['data'] );
|
||||
@ -435,8 +431,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
|
||||
$count_customize_render_partials_after = has_action( 'customize_render_partials_after' );
|
||||
ob_start();
|
||||
try {
|
||||
$this->expected_partial_ids = array( 'test_dynamic_blogname' );
|
||||
@ -447,8 +441,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
} catch ( WPDieException $e ) {
|
||||
$this->assertSame( '', $e->getMessage() );
|
||||
}
|
||||
$this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_after' ) );
|
||||
$output = json_decode( ob_get_clean(), true );
|
||||
$this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_dynamic_blogname'] );
|
||||
}
|
||||
@ -487,8 +481,6 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$count_customize_render_partials_before = has_action( 'customize_render_partials_before' );
|
||||
$count_customize_render_partials_after = has_action( 'customize_render_partials_after' );
|
||||
ob_start();
|
||||
try {
|
||||
$this->expected_partial_ids = array( 'test_blogname', 'test_blogdescription' );
|
||||
@ -499,8 +491,8 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
|
||||
} catch ( WPDieException $e ) {
|
||||
$this->assertSame( '', $e->getMessage() );
|
||||
}
|
||||
$this->assertEquals( $count_customize_render_partials_before + 1, has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertEquals( $count_customize_render_partials_after + 1, has_action( 'customize_render_partials_after' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_before' ) );
|
||||
$this->assertTrue( has_action( 'customize_render_partials_after' ) );
|
||||
$output = json_decode( ob_get_clean(), true );
|
||||
$this->assertSame( array( get_bloginfo( 'name', 'display' ) ), $output['data']['contents']['test_blogname'] );
|
||||
$this->assertSame( array_fill( 0, 2, get_bloginfo( 'description', 'display' ) ), $output['data']['contents']['test_blogdescription'] );
|
||||
|
||||
@ -49,7 +49,7 @@ class Tests_Formatting_MapDeep extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_map_deep_should_map_each_object_element_of_an_array() {
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'var0' => 'ababa',
|
||||
'var1' => (object) array(
|
||||
|
||||
@ -2056,9 +2056,9 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
* @ticket 53668
|
||||
*/
|
||||
public function test_wp_get_default_extension_for_mime_type() {
|
||||
$this->assertEquals( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
|
||||
$this->assertSame( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
|
||||
$this->assertNotEquals( 'jpeg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpeg should not be returned as default extension for "image/jpeg"' );
|
||||
$this->assertEquals( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
|
||||
$this->assertSame( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
|
||||
$this->assertFalse( wp_get_default_extension_for_mime_type( 'wibble/wobble' ), 'false not returned for unrecognized mime type' );
|
||||
$this->assertFalse( wp_get_default_extension_for_mime_type( '' ), 'false not returned when empty string as mime type supplied' );
|
||||
$this->assertFalse( wp_get_default_extension_for_mime_type( ' ' ), 'false not returned when empty string as mime type supplied' );
|
||||
@ -2072,7 +2072,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
*/
|
||||
function test_wp_filesize_with_nonexistent_file() {
|
||||
$file = 'nonexistent/file.jpg';
|
||||
$this->assertEquals( 0, wp_filesize( $file ) );
|
||||
$this->assertSame( 0, wp_filesize( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2082,7 +2082,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
function test_wp_filesize() {
|
||||
$file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
|
||||
|
||||
$this->assertEquals( filesize( $file ), wp_filesize( $file ) );
|
||||
$this->assertSame( filesize( $file ), wp_filesize( $file ) );
|
||||
|
||||
$filter = function() {
|
||||
return 999;
|
||||
@ -2090,7 +2090,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
|
||||
add_filter( 'wp_filesize', $filter );
|
||||
|
||||
$this->assertEquals( 999, wp_filesize( $file ) );
|
||||
$this->assertSame( 999, wp_filesize( $file ) );
|
||||
|
||||
$pre_filter = function() {
|
||||
return 111;
|
||||
@ -2098,7 +2098,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
|
||||
add_filter( 'pre_wp_filesize', $pre_filter );
|
||||
|
||||
$this->assertEquals( 111, wp_filesize( $file ) );
|
||||
$this->assertSame( 111, wp_filesize( $file ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2184,7 +2184,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
),
|
||||
'version' => 1,
|
||||
);
|
||||
$this->assertEquals( $theme_json, $expected_theme_json );
|
||||
$this->assertSameSetsWithIndex( $theme_json, $expected_theme_json );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
|
||||
$this->assertSame( 'author@example.org', $author->user_email );
|
||||
|
||||
// Check that terms were imported correctly.
|
||||
$this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
$this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
|
||||
$this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
$this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
|
||||
$foo = get_term_by( 'slug', 'foo', 'category' );
|
||||
$this->assertSame( 0, $foo->parent );
|
||||
$bar = get_term_by( 'slug', 'bar', 'category' );
|
||||
@ -72,11 +72,11 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
|
||||
|
||||
// Check that posts/pages were imported correctly.
|
||||
$post_count = wp_count_posts( 'post' );
|
||||
$this->assertEquals( 5, $post_count->publish );
|
||||
$this->assertEquals( 1, $post_count->private );
|
||||
$this->assertSame( '5', $post_count->publish );
|
||||
$this->assertSame( '1', $post_count->private );
|
||||
$page_count = wp_count_posts( 'page' );
|
||||
$this->assertEquals( 4, $page_count->publish );
|
||||
$this->assertEquals( 1, $page_count->draft );
|
||||
$this->assertSame( '4', $page_count->publish );
|
||||
$this->assertSame( '1', $page_count->draft );
|
||||
$comment_count = wp_count_comments();
|
||||
$this->assertSame( 1, $comment_count->total_comments );
|
||||
|
||||
@ -230,8 +230,8 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
|
||||
$this->assertSame( 'author', $author->user_login );
|
||||
$this->assertSame( 'author@example.org', $author->user_email );
|
||||
|
||||
$this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
$this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
|
||||
$this->assertSame( '30', wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
$this->assertSame( '3', wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
|
||||
$foo = get_term_by( 'slug', 'foo', 'category' );
|
||||
$this->assertSame( 0, $foo->parent );
|
||||
$bar = get_term_by( 'slug', 'bar', 'category' );
|
||||
@ -239,11 +239,11 @@ class Tests_Import_Import extends WP_Import_UnitTestCase {
|
||||
$this->assertSame( $bar->term_id, $foo_bar->parent );
|
||||
|
||||
$post_count = wp_count_posts( 'post' );
|
||||
$this->assertEquals( 5, $post_count->publish );
|
||||
$this->assertEquals( 1, $post_count->private );
|
||||
$this->assertSame( '5', $post_count->publish );
|
||||
$this->assertSame( '1', $post_count->private );
|
||||
$page_count = wp_count_posts( 'page' );
|
||||
$this->assertEquals( 4, $page_count->publish );
|
||||
$this->assertEquals( 1, $page_count->draft );
|
||||
$this->assertSame( '4', $page_count->publish );
|
||||
$this->assertSame( '1', $page_count->draft );
|
||||
$comment_count = wp_count_comments();
|
||||
$this->assertSame( 1, $comment_count->total_comments );
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
|
||||
|
||||
$this->assertIsArray( $result, $message );
|
||||
$this->assertSame( 'http://localhost/', $result['base_url'], $message );
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSetsWithIndex(
|
||||
array(
|
||||
'author_id' => 2,
|
||||
'author_login' => 'john',
|
||||
@ -86,7 +86,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
|
||||
$result['authors']['john'],
|
||||
$message
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSetsWithIndex(
|
||||
array(
|
||||
'term_id' => 3,
|
||||
'category_nicename' => 'alpha',
|
||||
@ -97,7 +97,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
|
||||
$result['categories'][0],
|
||||
$message
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSetsWithIndex(
|
||||
array(
|
||||
'term_id' => 22,
|
||||
'tag_slug' => 'clippable',
|
||||
@ -107,7 +107,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
|
||||
$result['tags'][0],
|
||||
$message
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSetsWithIndex(
|
||||
array(
|
||||
'term_id' => 40,
|
||||
'term_taxonomy' => 'post_tax',
|
||||
@ -123,7 +123,7 @@ class Tests_Import_Parser extends WP_Import_UnitTestCase {
|
||||
$this->assertCount( 2, $result['posts'], $message );
|
||||
$this->assertCount( 19, $result['posts'][0], $message );
|
||||
$this->assertCount( 18, $result['posts'][1], $message );
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSetsWithIndex(
|
||||
array(
|
||||
array(
|
||||
'name' => 'alpha',
|
||||
|
||||
@ -76,7 +76,7 @@ class Tests_Import_Postmeta extends WP_Import_UnitTestCase {
|
||||
$classy->tag = 'wscript';
|
||||
$expected[] = $classy;
|
||||
|
||||
$this->assertEquals( $expected, get_post_meta( 150, 'test', true ) );
|
||||
$this->assertEqualSets( $expected, get_post_meta( 150, 'test', true ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -501,7 +501,7 @@ https://w.org</a>',
|
||||
);
|
||||
|
||||
$images = get_attached_media( 'image', $post_id );
|
||||
$this->assertEquals( $images, array( $attachment_id => get_post( $attachment_id ) ) );
|
||||
$this->assertEqualSets( $images, array( $attachment_id => get_post( $attachment_id ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -171,7 +171,7 @@ if ( is_multisite() ) :
|
||||
}
|
||||
wp_update_network_counts();
|
||||
|
||||
$this->assertEquals( $site_count_start, $actual );
|
||||
$this->assertSame( $site_count_start, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,7 +191,7 @@ if ( is_multisite() ) :
|
||||
}
|
||||
wp_update_network_counts();
|
||||
|
||||
$this->assertEquals( $site_count_start + 1, $actual );
|
||||
$this->assertSame( $site_count_start + 1, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,11 +202,9 @@ if ( is_multisite() ) :
|
||||
|
||||
$site_count = get_blog_count( self::$different_network_id );
|
||||
|
||||
$this->assertEquals( count( self::$different_site_ids ), $site_count );
|
||||
$this->assertSame( count( self::$different_site_ids ), $site_count );
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function test_active_network_plugins() {
|
||||
$path = 'hello.php';
|
||||
|
||||
|
||||
@ -1555,9 +1555,9 @@ if ( is_multisite() ) :
|
||||
$result = wp_update_site( $site_id, array( 'public' => 1 ) );
|
||||
$site3 = get_site( $site_id );
|
||||
|
||||
$this->assertEquals( 1, $site1->public );
|
||||
$this->assertEquals( 0, $site2->public );
|
||||
$this->assertEquals( 1, $site3->public );
|
||||
$this->assertSame( '1', $site1->public );
|
||||
$this->assertSame( '0', $site2->public );
|
||||
$this->assertSame( '1', $site3->public );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2433,7 +2433,7 @@ if ( is_multisite() ) :
|
||||
|
||||
wpmu_create_blog( 'testsite1.example.org', '/new-blog/', 'New Blog', get_current_user_id(), $meta, 1 );
|
||||
|
||||
$this->assertEquals( $expected_meta, $this->wp_initialize_site_meta );
|
||||
$this->assertSameSetsWithIndex( $expected_meta, $this->wp_initialize_site_meta );
|
||||
|
||||
$this->wp_initialize_site_meta = array();
|
||||
}
|
||||
@ -2534,8 +2534,8 @@ if ( is_multisite() ) :
|
||||
),
|
||||
array(
|
||||
'public' => 0,
|
||||
'WPLANG' => 'en_US',
|
||||
'foo' => 'bar',
|
||||
'WPLANG' => 'en_US',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -176,7 +176,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
|
||||
$this->assertIsInt( add_metadata( 'site', $network_id, $option, $funky_meta, true ) );
|
||||
|
||||
// Check they exists.
|
||||
$this->assertEquals( $funky_meta, get_network_option( $network_id, $option ) );
|
||||
$this->assertEqualSets( $funky_meta, get_network_option( $network_id, $option ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,7 +190,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
|
||||
add_metadata( 'site', $network_id, $option, 'monday', true );
|
||||
add_metadata( 'site', $network_id, $option, 'tuesday', true );
|
||||
add_metadata( 'site', $network_id, $option, 'wednesday', true );
|
||||
$this->assertEquals( 'monday', get_network_option( $network_id, $option, true ) );
|
||||
$this->assertSame( 'monday', get_network_option( $network_id, $option, true ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -279,7 +279,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
add_metadata( 'site', $network_id, $option, $array_w_object, true );
|
||||
$this->assertEquals( $array_w_object, get_network_option( $network_id, $option ) );
|
||||
$this->assertEqualSets( $array_w_object, get_network_option( $network_id, $option ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -424,7 +424,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
// Confirm the defaults.
|
||||
$this->assertEquals( $pages, $pages_default_args );
|
||||
$this->assertEqualSets( $pages, $pages_default_args );
|
||||
|
||||
/*
|
||||
* Here's the tree we are testing:
|
||||
@ -468,7 +468,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals( $pages, $default_args );
|
||||
$this->assertEqualSets( $pages, $default_args );
|
||||
|
||||
/*
|
||||
* Page tree:
|
||||
|
||||
@ -248,7 +248,7 @@ class Tests_Post_Meta extends WP_UnitTestCase {
|
||||
$this->assertIsInt( add_post_meta( self::$post_id, 'test_funky_post_meta', $funky_meta, true ) );
|
||||
|
||||
// Check it exists.
|
||||
$this->assertEquals( $funky_meta, get_post_meta( self::$post_id, 'test_funky_post_meta', true ) );
|
||||
$this->assertEqualSets( $funky_meta, get_post_meta( self::$post_id, 'test_funky_post_meta', true ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -900,7 +900,7 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase {
|
||||
// Validate that the term got assigned.
|
||||
$assigned_terms = wp_get_object_terms( array( $post_id ), array( 'category' ), array() );
|
||||
$this->assertCount( 1, $assigned_terms );
|
||||
$this->assertEquals( $term_id, $assigned_terms[0]->term_id );
|
||||
$this->assertSame( $term_id, $assigned_terms[0]->term_id );
|
||||
|
||||
// Update the post with no changes.
|
||||
$post = get_post( $post_id );
|
||||
@ -909,7 +909,7 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase {
|
||||
// Validate the term is still assigned.
|
||||
$assigned_terms = wp_get_object_terms( array( $post_id ), array( 'category' ), array() );
|
||||
$this->assertCount( 1, $assigned_terms );
|
||||
$this->assertEquals( $term_id, $assigned_terms[0]->term_id );
|
||||
$this->assertSame( $term_id, $assigned_terms[0]->term_id );
|
||||
|
||||
// Remove the term from the post.
|
||||
$post->post_category = array();
|
||||
|
||||
@ -298,7 +298,7 @@ class Tests_Query_Date extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals( $expected, $posts );
|
||||
$this->assertEqualSets( $expected, $posts );
|
||||
}
|
||||
|
||||
public function test_simple_monthnum_expecting_results() {
|
||||
|
||||
@ -421,7 +421,7 @@ class REST_Block_Renderer_Controller_Test extends WP_Test_REST_Controller_Testca
|
||||
$data = $response->get_data();
|
||||
|
||||
$this->assertSame( $expected_attributes, json_decode( $data['rendered'], true ) );
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSetsWithIndex(
|
||||
json_decode( $block_type->render( $attributes ), true ),
|
||||
json_decode( $data['rendered'], true )
|
||||
);
|
||||
|
||||
@ -371,7 +371,7 @@ class WP_REST_Global_Styles_Controller_Test extends WP_Test_REST_Controller_Test
|
||||
$data = $response->get_data();
|
||||
$links = $response->get_links();
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertEqualSets(
|
||||
array(
|
||||
'id' => self::$global_styles_id,
|
||||
'title' => array(
|
||||
@ -409,7 +409,7 @@ class WP_REST_Global_Styles_Controller_Test extends WP_Test_REST_Controller_Test
|
||||
);
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$data = $response->get_data();
|
||||
$this->assertEquals( 'My new global styles title', $data['title']['raw'] );
|
||||
$this->assertSame( 'My new global styles title', $data['title']['raw'] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2797,7 +2797,7 @@ class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
|
||||
$this->assertSame( 200, $response->get_status() );
|
||||
$this->assertEquals( array( 0 ), $response->get_data()['meta']['multi_boolean'] );
|
||||
$this->assertSameSetsWithIndex( array( false ), $response->get_data()['meta']['multi_boolean'] );
|
||||
|
||||
$this->assertFalse( get_metadata_by_mid( 'post', $mid1 ) );
|
||||
$this->assertNotFalse( get_metadata_by_mid( 'post', $mid2 ) );
|
||||
|
||||
@ -116,12 +116,12 @@ class WP_Test_REST_Site_Health_Controller extends WP_Test_REST_TestCase {
|
||||
$this->assertCount( 1, $route );
|
||||
|
||||
$route = current( $route );
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
array( WP_REST_Server::READABLE => true ),
|
||||
$route['methods']
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
'test_page_cache',
|
||||
$route['callback'][1]
|
||||
);
|
||||
|
||||
@ -628,7 +628,7 @@ class WP_Test_REST_Themes_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
$result = $response->get_data();
|
||||
$this->assertArrayHasKey( 'theme_supports', $result[0] );
|
||||
$this->assertArrayHasKey( 'editor-font-sizes', $result[0]['theme_supports'] );
|
||||
$this->assertEquals( array( $tiny ), $result[0]['theme_supports']['editor-font-sizes'] );
|
||||
$this->assertEqualSetsWithIndex( array( $tiny ), $result[0]['theme_supports']['editor-font-sizes'] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -343,7 +343,7 @@ class Tests_REST_WpRestTemplatesController extends WP_Test_REST_Controller_Testc
|
||||
*/
|
||||
public function test_sanitize_template_id( $input_id, $sanitized_id ) {
|
||||
$endpoint = new WP_REST_Templates_Controller( 'wp_template' );
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
$sanitized_id,
|
||||
$endpoint->_sanitize_template_id( $input_id )
|
||||
);
|
||||
|
||||
@ -88,7 +88,7 @@ class Tests_Style_Engine_wpStyleEngineCSSRulesStore extends WP_UnitTestCase {
|
||||
$burrito_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'burrito' );
|
||||
$quesadilla_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'quesadilla' );
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
array(
|
||||
'burrito' => $burrito_store,
|
||||
'quesadilla' => $quesadilla_store,
|
||||
@ -108,7 +108,7 @@ class Tests_Style_Engine_wpStyleEngineCSSRulesStore extends WP_UnitTestCase {
|
||||
$dolmades_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'dolmades' );
|
||||
$tzatziki_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'tzatziki' );
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
array(
|
||||
'dolmades' => $dolmades_store,
|
||||
'tzatziki' => $tzatziki_store,
|
||||
@ -119,7 +119,7 @@ class Tests_Style_Engine_wpStyleEngineCSSRulesStore extends WP_UnitTestCase {
|
||||
|
||||
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
array(),
|
||||
WP_Style_Engine_CSS_Rules_Store::get_stores(),
|
||||
'Return value of get_stores() is not an empty array after remove_all_stores() called.'
|
||||
|
||||
@ -75,7 +75,7 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
// There are 5 posts, all Uncategorized.
|
||||
$this->assertEquals( 1, $count );
|
||||
$this->assertSame( '1', $count );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,14 +86,14 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
|
||||
// Counts all terms (1 default category, 5 tags).
|
||||
$count = wp_count_terms();
|
||||
$this->assertEquals( 6, $count );
|
||||
$this->assertSame( '6', $count );
|
||||
|
||||
// Counts only tags (5), with both current and legacy signature.
|
||||
// Legacy usage should not trigger deprecated notice.
|
||||
$count = wp_count_terms( array( 'taxonomy' => 'post_tag' ) );
|
||||
$legacy_count = wp_count_terms( 'post_tag' );
|
||||
$this->assertEquals( 5, $count );
|
||||
$this->assertEquals( $count, $legacy_count );
|
||||
$this->assertSame( '5', $count );
|
||||
$this->assertSame( $count, $legacy_count );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +159,7 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
$this->assertIsNumeric( $t );
|
||||
$this->assertNotWPError( $t );
|
||||
$this->assertGreaterThan( 0, $t );
|
||||
$this->assertEquals( $initial_count + 1, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
$this->assertSame( (string) ( $initial_count + 1 ), wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
|
||||
// Make sure the term exists.
|
||||
$this->assertGreaterThan( 0, term_exists( $term ) );
|
||||
@ -169,7 +169,7 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
$this->assertTrue( wp_delete_category( $t ) );
|
||||
$this->assertNull( term_exists( $term ) );
|
||||
$this->assertNull( term_exists( $t ) );
|
||||
$this->assertEquals( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
$this->assertSame( $initial_count, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -255,7 +255,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
'fields' => 'id=>parent',
|
||||
)
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
$term_id1 => 0,
|
||||
$term_id2 => $term_id1,
|
||||
@ -288,7 +288,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
'fields' => 'id=>name',
|
||||
)
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
$term_id1 => 'WOO!',
|
||||
$term_id2 => 'HOO!',
|
||||
@ -303,7 +303,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
|
||||
'fields' => 'id=>slug',
|
||||
)
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
$term_id1 => 'woo',
|
||||
$term_id2 => 'hoo',
|
||||
|
||||
@ -59,7 +59,7 @@ class Tests_Term_Tax_Query extends WP_UnitTestCase {
|
||||
'operator' => 'IN',
|
||||
);
|
||||
|
||||
$this->assertEquals( $expected, $tq->queries[0] );
|
||||
$this->assertSameSetsWithIndex( $expected, $tq->queries[0] );
|
||||
}
|
||||
|
||||
public function test_construct_fill_missing_query_params_merge_with_passed_values() {
|
||||
@ -82,7 +82,7 @@ class Tests_Term_Tax_Query extends WP_UnitTestCase {
|
||||
'foo' => 'bar',
|
||||
);
|
||||
|
||||
$this->assertEquals( $expected, $tq->queries[0] );
|
||||
$this->assertSameSetsWithIndex( $expected, $tq->queries[0] );
|
||||
}
|
||||
|
||||
public function test_construct_cast_terms_to_array() {
|
||||
@ -262,7 +262,7 @@ class Tests_Term_Tax_Query extends WP_UnitTestCase {
|
||||
);
|
||||
$tq->transform_query( $tq->queries[0], 'term_taxonomy_id' );
|
||||
|
||||
$this->assertEquals( $tt_ids, $tq->queries[0]['terms'] );
|
||||
$this->assertEqualSets( $tt_ids, $tq->queries[0]['terms'] );
|
||||
$this->assertSame( 'term_taxonomy_id', $tq->queries[0]['field'] );
|
||||
}
|
||||
|
||||
|
||||
@ -676,6 +676,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
|
||||
'.has-grey-color{color: var(--wp--preset--color--grey) !important;}.has-dark-grey-color{color: var(--wp--preset--color--dark-grey) !important;}.has-light-grey-color{color: var(--wp--preset--color--light-grey) !important;}.has-white-2-black-color{color: var(--wp--preset--color--white-2-black) !important;}.has-grey-background-color{background-color: var(--wp--preset--color--grey) !important;}.has-dark-grey-background-color{background-color: var(--wp--preset--color--dark-grey) !important;}.has-light-grey-background-color{background-color: var(--wp--preset--color--light-grey) !important;}.has-white-2-black-background-color{background-color: var(--wp--preset--color--white-2-black) !important;}.has-grey-border-color{border-color: var(--wp--preset--color--grey) !important;}.has-dark-grey-border-color{border-color: var(--wp--preset--color--dark-grey) !important;}.has-light-grey-border-color{border-color: var(--wp--preset--color--light-grey) !important;}.has-white-2-black-border-color{border-color: var(--wp--preset--color--white-2-black) !important;}',
|
||||
$theme_json->get_stylesheet( array( 'presets' ) )
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
'body{--wp--preset--color--grey: grey;--wp--preset--color--dark-grey: grey;--wp--preset--color--light-grey: grey;--wp--preset--color--white-2-black: grey;--wp--custom--white-2-black: value;}',
|
||||
$theme_json->get_stylesheet( array( 'variables' ) )
|
||||
@ -3352,7 +3353,7 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
|
||||
'default'
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
$this->assertSame(
|
||||
'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }.wp-site-blocks > * + * { margin-block-start: 1rem; }body { --wp--style--block-gap: 1rem; }body .is-layout-flow > *{margin-block-start: 0;margin-block-end: 0;}body .is-layout-flow > * + *{margin-block-start: 1rem;margin-block-end: 0;}body .is-layout-flex{gap: 1rem;}body .is-layout-flow > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-flow > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-flow > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-flex{display: flex;}body .is-layout-flex{flex-wrap: wrap;align-items: center;}.wp-block-post-content{color: gray;}.wp-block-social-links.is-layout-flow > *{margin-block-start: 0;margin-block-end: 0;}.wp-block-social-links.is-layout-flow > * + *{margin-block-start: 0;margin-block-end: 0;}.wp-block-social-links.is-layout-flex{gap: 0;}.wp-block-buttons.is-layout-flow > *{margin-block-start: 0;margin-block-end: 0;}.wp-block-buttons.is-layout-flow > * + *{margin-block-start: 0;margin-block-end: 0;}.wp-block-buttons.is-layout-flex{gap: 0;}',
|
||||
$theme_json->get_stylesheet()
|
||||
);
|
||||
|
||||
@ -366,7 +366,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
|
||||
WP_Theme_JSON_Resolver::clean_cached_data();
|
||||
}
|
||||
$query_count = count( $this->queries ) - $query_count;
|
||||
$this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
|
||||
$this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
|
||||
|
||||
$user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
|
||||
$this->assertEmpty( $user_cpt );
|
||||
@ -381,7 +381,7 @@ class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
|
||||
$this->assertSameSets( $user_cpt, $new_user_cpt );
|
||||
}
|
||||
$query_count = count( $this->queries ) - $query_count;
|
||||
$this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
|
||||
$this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
|
||||
remove_filter( 'query', array( $this, 'filter_db_query' ) );
|
||||
}
|
||||
|
||||
|
||||
@ -560,21 +560,21 @@ class Tests_User extends WP_UnitTestCase {
|
||||
|
||||
wp_set_current_user( self::$author_id );
|
||||
$counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', false );
|
||||
$this->assertEquals( 1, $counts[ self::$author_id ] );
|
||||
$this->assertEquals( 1, $counts[ $user_id_b ] );
|
||||
$this->assertSame( '1', $counts[ self::$author_id ] );
|
||||
$this->assertSame( '1', $counts[ $user_id_b ] );
|
||||
|
||||
$counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', true );
|
||||
$this->assertEquals( 1, $counts[ self::$author_id ] );
|
||||
$this->assertEquals( 1, $counts[ $user_id_b ] );
|
||||
$this->assertSame( '1', $counts[ self::$author_id ] );
|
||||
$this->assertSame( '1', $counts[ $user_id_b ] );
|
||||
|
||||
wp_set_current_user( $user_id_b );
|
||||
$counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', false );
|
||||
$this->assertEquals( 1, $counts[ self::$author_id ] );
|
||||
$this->assertEquals( 2, $counts[ $user_id_b ] );
|
||||
$this->assertSame( '1', $counts[ self::$author_id ] );
|
||||
$this->assertSame( '2', $counts[ $user_id_b ] );
|
||||
|
||||
$counts = count_many_users_posts( array( self::$author_id, $user_id_b ), 'post', true );
|
||||
$this->assertEquals( 1, $counts[ self::$author_id ] );
|
||||
$this->assertEquals( 1, $counts[ $user_id_b ] );
|
||||
$this->assertSame( '1', $counts[ self::$author_id ] );
|
||||
$this->assertSame( '1', $counts[ $user_id_b ] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -59,34 +59,34 @@ class Tests_User_CountUserPosts extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_count_user_posts_post_type_should_default_to_post() {
|
||||
$this->assertEquals( 4, count_user_posts( self::$user_id ) );
|
||||
$this->assertSame( '4', count_user_posts( self::$user_id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21364
|
||||
*/
|
||||
public function test_count_user_posts_post_type_post() {
|
||||
$this->assertEquals( 4, count_user_posts( self::$user_id, 'post' ) );
|
||||
$this->assertSame( '4', count_user_posts( self::$user_id, 'post' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21364
|
||||
*/
|
||||
public function test_count_user_posts_post_type_cpt() {
|
||||
$this->assertEquals( 3, count_user_posts( self::$user_id, 'wptests_pt' ) );
|
||||
$this->assertSame( '3', count_user_posts( self::$user_id, 'wptests_pt' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 32243
|
||||
*/
|
||||
public function test_count_user_posts_with_multiple_post_types() {
|
||||
$this->assertEquals( 7, count_user_posts( self::$user_id, array( 'wptests_pt', 'post' ) ) );
|
||||
$this->assertSame( '7', count_user_posts( self::$user_id, array( 'wptests_pt', 'post' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 32243
|
||||
*/
|
||||
public function test_count_user_posts_should_ignore_non_existent_post_types() {
|
||||
$this->assertEquals( 4, count_user_posts( self::$user_id, array( 'foo', 'post' ) ) );
|
||||
$this->assertSame( '4', count_user_posts( self::$user_id, array( 'foo', 'post' ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase {
|
||||
$count = count_users( $strategy );
|
||||
|
||||
$this->assertSame( 8, $count['total_users'] );
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'administrator' => 2,
|
||||
'editor' => 1,
|
||||
@ -133,7 +133,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase {
|
||||
$count = count_users( $strategy );
|
||||
|
||||
$this->assertSame( 8, $count['total_users'] );
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'administrator' => 2,
|
||||
'editor' => 1,
|
||||
@ -151,7 +151,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase {
|
||||
restore_current_blog();
|
||||
|
||||
$this->assertSame( 2, $count['total_users'] );
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'administrator' => 1,
|
||||
'editor' => 1,
|
||||
@ -166,7 +166,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase {
|
||||
restore_current_blog();
|
||||
|
||||
$this->assertSame( 2, $count['total_users'] );
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'administrator' => 1,
|
||||
'contributor' => 1,
|
||||
@ -239,7 +239,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase {
|
||||
$count = count_users( $strategy );
|
||||
|
||||
$this->assertSame( 3, $count['total_users'] );
|
||||
$this->assertEquals(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'administrator' => 2,
|
||||
'editor' => 1,
|
||||
|
||||
@ -52,7 +52,7 @@ class Tests_User_Query extends WP_UnitTestCase {
|
||||
public function test_get_and_set() {
|
||||
$users = new WP_User_Query();
|
||||
|
||||
$this->assertEquals( '', $users->get( 'fields' ) );
|
||||
$this->assertNull( $users->get( 'fields' ) );
|
||||
if ( isset( $users->query_vars['fields'] ) ) {
|
||||
$this->assertSame( '', $users->query_vars['fields'] );
|
||||
}
|
||||
@ -582,7 +582,7 @@ class Tests_User_Query extends WP_UnitTestCase {
|
||||
// All values get reset.
|
||||
$query->prepare_query( array( 'fields' => 'all' ) );
|
||||
$this->assertEmpty( $query->query_limit );
|
||||
$this->assertEquals( '', $query->query_limit );
|
||||
$this->assertNull( $query->query_limit );
|
||||
$_query_vars = $query->query_vars;
|
||||
|
||||
$query->prepare_query();
|
||||
@ -1685,7 +1685,7 @@ class Tests_User_Query extends WP_UnitTestCase {
|
||||
$ids = $q->get_results();
|
||||
|
||||
// Must include user that has the same string in display_name.
|
||||
$this->assertEquals( array( $new_user1 ), $ids );
|
||||
$this->assertSameSetsWithIndex( array( (string) $new_user1 ), $ids );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1274,10 +1274,10 @@ class Tests_Widgets extends WP_UnitTestCase {
|
||||
$new_next_theme_sidebars = wp_map_sidebars_widgets( $prev_theme_sidebars );
|
||||
|
||||
$expected_sidebars = array(
|
||||
'primary' => 1,
|
||||
'wp_inactive_widgets' => array(),
|
||||
'primary' => 1,
|
||||
);
|
||||
$this->assertEquals( $expected_sidebars, $new_next_theme_sidebars );
|
||||
$this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1295,7 +1295,7 @@ class Tests_Widgets extends WP_UnitTestCase {
|
||||
|
||||
$new_next_theme_sidebars = wp_map_sidebars_widgets( $prev_theme_sidebars );
|
||||
|
||||
$this->assertEquals( $prev_theme_sidebars, $new_next_theme_sidebars );
|
||||
$this->assertSameSetsWithIndex( $prev_theme_sidebars, $new_next_theme_sidebars );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1318,7 +1318,7 @@ class Tests_Widgets extends WP_UnitTestCase {
|
||||
'secondary' => array(),
|
||||
'wp_inactive_widgets' => array(),
|
||||
);
|
||||
$this->assertEquals( $expected_sidebars, $new_next_theme_sidebars );
|
||||
$this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1362,6 +1362,6 @@ class Tests_Widgets extends WP_UnitTestCase {
|
||||
'primary' => array(),
|
||||
'wp_inactive_widgets' => array(),
|
||||
);
|
||||
$this->assertEquals( $expected_sidebars, $new_next_theme_sidebars );
|
||||
$this->assertSameSetsWithIndex( $expected_sidebars, $new_next_theme_sidebars );
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ class Tests_Widgets_wpWidgetMedia extends WP_UnitTestCase {
|
||||
$this->widget_instance_filter_args = array();
|
||||
$widget->widget( $args, $instance );
|
||||
$this->assertCount( 3, $this->widget_instance_filter_args );
|
||||
$this->assertEquals( $instance, $this->widget_instance_filter_args[0] );
|
||||
$this->assertSameSetsWithIndex( $instance, $this->widget_instance_filter_args[0] );
|
||||
$this->assertSame( $args, $this->widget_instance_filter_args[1] );
|
||||
$this->assertSame( $widget, $this->widget_instance_filter_args[2] );
|
||||
$output = ob_get_clean();
|
||||
|
||||
@ -238,7 +238,7 @@ class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase {
|
||||
);
|
||||
$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
|
||||
$this->assertNotIXRError( $result );
|
||||
$this->assertEquals( '', get_post_format( $result ) );
|
||||
$this->assertFalse( get_post_format( $result ) );
|
||||
}
|
||||
|
||||
public function test_invalid_taxonomy() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user