Make WordPress Core

Changeset 58044


Ignore:
Timestamp:
04/24/2024 10:03:06 PM (17 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in WP_oEmbed_Controller tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Follow-up to [41047].

Props costdev.
See #60706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/oembed/controller.php

    r56549 r58044  
    607607        $this->assertSame( 'YouTube', $data->provider_name );
    608608        $this->assertSame( 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg', $data->thumbnail_url );
    609         $this->assertEquals( $data->width, $request['maxwidth'] );
    610         $this->assertEquals( $data->height, $request['maxheight'] );
     609        $this->assertSame( (int) $data->width, $request['maxwidth'] );
     610        $this->assertSame( (int) $data->height, $request['maxheight'] );
    611611    }
    612612
Note: See TracChangeset for help on using the changeset viewer.