Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public function test_save_attachment_order_success(): void {

$this->assertTrue( $response['success'], 'AJAX response should be successful' );

$this->assertEquals( 10, get_post( self::$attachment_ids[0] )->menu_order, 'First attachment menu_order should be 10' );
$this->assertEquals( 20, get_post( self::$attachment_ids[1] )->menu_order, 'Second attachment menu_order should be 20' );
$this->assertSame( 10, get_post( self::$attachment_ids[0] )->menu_order, 'First attachment menu_order should be 10' );
$this->assertSame( 20, get_post( self::$attachment_ids[1] )->menu_order, 'Second attachment menu_order should be 20' );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function test_send_attachment_to_editor_image_success(): void {

// Verify that the attachment was attached to the post.
$attachment = get_post( self::$attachment_id );
$this->assertEquals( self::$post_id, $attachment->post_parent, 'Attachment should be attached to the post' );
$this->assertSame( self::$post_id, $attachment->post_parent, 'Attachment should be attached to the post' );
}

/**
Expand Down
20 changes: 10 additions & 10 deletions tests/phpunit/tests/admin/includes/misc/adminColorSchemePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function test_admin_color_scheme_picker_sorting() {
}

$expected_order = array( 'modern', 'fresh', 'light', 'coffee', 'ocean' );
$this->assertEquals( $expected_order, $found_colors, 'Color schemes should be ordered with modern, fresh, light first, followed by others alphabetically.' );
$this->assertSame( $expected_order, $found_colors, 'Color schemes should be ordered with modern, fresh, light first, followed by others alphabetically.' );
}

/**
Expand Down Expand Up @@ -250,29 +250,29 @@ public function test_admin_color_scheme_picker_html_structure() {
$xpath = new DOMXPath( $dom );

// Check fieldset and legend.
$this->assertEquals( 1, $xpath->query( '//fieldset[@id="color-picker"]' )->length );
$this->assertEquals( 1, $xpath->query( '//legend' )->length );
$this->assertSame( 1, $xpath->query( '//fieldset[@id="color-picker"]' )->length );
$this->assertSame( 1, $xpath->query( '//legend' )->length );

// Check radio input.
$radio = $xpath->query( '//input[@type="radio"][@value="modern"]' );
$this->assertEquals( 1, $radio->length );
$this->assertEquals( 'admin_color_modern', $radio->item( 0 )->getAttribute( 'id' ) );
$this->assertSame( 1, $radio->length );
$this->assertSame( 'admin_color_modern', $radio->item( 0 )->getAttribute( 'id' ) );

// Check hidden inputs.
$this->assertEquals( 1, $xpath->query( '//input[@type="hidden"][@class="css_url"][@value="https://example.com/modern.css"]' )->length );
$this->assertSame( 1, $xpath->query( '//input[@type="hidden"][@class="css_url"][@value="https://example.com/modern.css"]' )->length );

$icon_colors_input = $xpath->query( '//input[@type="hidden"][@class="icon_colors"]' );
$this->assertEquals( 1, $icon_colors_input->length );
$this->assertSame( 1, $icon_colors_input->length );
$json_data = json_decode( $icon_colors_input->item( 0 )->getAttribute( 'value' ), true );
$this->assertEquals( array( 'icons' => array( 'icons' => '#333' ) ), $json_data );
$this->assertSame( array( 'icons' => array( 'icons' => '#333' ) ), $json_data );

// Check label.
$label = $xpath->query( '//label[@for="admin_color_modern"]' );
$this->assertEquals( 1, $label->length );
$this->assertSame( 1, $label->length );
$this->assertStringContainsString( 'Modern Display Name', $label->item( 0 )->nodeValue );

// Check color palette.
$this->assertEquals( 2, $xpath->query( '//div[@class="color-palette-shade"]' )->length );
$this->assertSame( 2, $xpath->query( '//div[@class="color-palette-shade"]' )->length );
$this->assertStringContainsString( 'background-color: #111', $output );
$this->assertStringContainsString( 'background-color: #222', $output );
}
Expand Down
2 changes: 2 additions & 0 deletions tests/phpunit/tests/admin/includes/misc/setScreenOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function test_set_screen_options( $option, $value, $expected ) {
}

$meta = get_user_meta( $user_id, $option, true );
// Keep assertEquals() because expected fixtures use integers while filter-passthrough options may store POST values as strings.
$this->assertEquals( $expected, $meta );
}

Expand Down Expand Up @@ -149,6 +150,7 @@ public function test_set_screen_options_with_filters() {
}
}

// Keep assertEquals() because the filter returns the raw POST string while the assertion uses an integer.
$this->assertEquals( 25, get_user_meta( $user_id, 'custom_per_page', true ) );
}

Expand Down
2 changes: 2 additions & 0 deletions tests/phpunit/tests/admin/includesUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function test_wp_process_translation_update_selection_uses_current_packag
$update->package = 'https://example.org/current.zip';
set_site_transient( 'update_plugins', (object) array( 'translations' => array( (array) $update ) ) );

// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals(
array( $id => $update ),
wp_process_translation_update_selection( array( $id ), array( $id ) )
Expand Down Expand Up @@ -496,6 +497,7 @@ static function ( $key ) use ( $updates ) {
if ( false === $selected ) {
$this->assertFalse( $actual );
} else {
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( wp_get_translation_updates_by_id( $get_updates( $selected ) ), $actual );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/functions/wpGetUpdatePhpAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Tests_functions_wpGetUpdatePhpAnnotation extends WP_UnitTestCase {
* @ticket 59699
*/
public function test_wp_get_update_php_annotation() {
$this->assertEquals( '', wp_get_update_php_annotation() );
$this->assertSame( '', wp_get_update_php_annotation() );
}

/**
Expand Down