Make WordPress Core


Ignore:
Timestamp:
07/18/2021 02:00:35 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in rest_sanitize_request_arg() tests.

This replaces instances of assertSame( true, ... ) with assertTrue() to use native PHPUnit functionality.

Follow-up to [38832].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-controller.php

    r51452 r51453  
    112112
    113113        // Check sanitize testing.
    114         $this->assertSame(
    115             false,
     114        $this->assertFalse(
    116115            rest_sanitize_request_arg( 'false', $this->request, 'someboolean' )
    117116        );
    118         $this->assertSame(
    119             false,
     117        $this->assertFalse(
    120118            rest_sanitize_request_arg( '0', $this->request, 'someboolean' )
    121119        );
    122         $this->assertSame(
    123             false,
     120        $this->assertFalse(
    124121            rest_sanitize_request_arg( 0, $this->request, 'someboolean' )
    125122        );
    126         $this->assertSame(
    127             false,
     123        $this->assertFalse(
    128124            rest_sanitize_request_arg( 'FALSE', $this->request, 'someboolean' )
    129125        );
    130         $this->assertSame(
    131             true,
     126        $this->assertTrue(
    132127            rest_sanitize_request_arg( 'true', $this->request, 'someboolean' )
    133128        );
    134         $this->assertSame(
    135             true,
     129        $this->assertTrue(
    136130            rest_sanitize_request_arg( '1', $this->request, 'someboolean' )
    137131        );
    138         $this->assertSame(
    139             true,
     132        $this->assertTrue(
    140133            rest_sanitize_request_arg( 1, $this->request, 'someboolean' )
    141134        );
    142         $this->assertSame(
    143             true,
     135        $this->assertTrue(
    144136            rest_sanitize_request_arg( 'TRUE', $this->request, 'someboolean' )
    145137        );
Note: See TracChangeset for help on using the changeset viewer.