Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit 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.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

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

    r46586 r48937  
    4949        $expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n";
    5050
    51         $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
     51        $this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
    5252    }
    5353
     
    6464        $expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n";
    6565
    66         $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
     66        $this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
    6767    }
    6868
     
    8484        $expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n";
    8585
    86         $this->assertEquals( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
     86        $this->assertSame( $expected, get_echo( 'wp_oembed_add_discovery_links' ) );
    8787    }
    8888}
Note: See TracChangeset for help on using the changeset viewer.