Make WordPress Core


Ignore:
Timestamp:
07/12/2021 10:35:44 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( in_array( ... ) ) with assertContains() to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403].

Props hellofromTonya, jrf, SergeyBiryukov.
Fixes #53123. See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php

    r51367 r51404  
    446446
    447447        // For good measure, check that the expected value is in the array.
    448         $this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ), true ) );
     448        $this->assertContains( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) );
    449449
    450450        // Attempt to add a brand new enclosure via XML-RPC.
     
    456456        // Check that the new enclosure is in the enclosure meta.
    457457        $new_enclosure_string = "{$new_enclosure['url']}\n{$new_enclosure['length']}\n{$new_enclosure['type']}\n";
    458         $this->assertTrue( in_array( $new_enclosure_string, get_post_meta( $post_id, 'enclosure' ), true ) );
     458        $this->assertContains( $new_enclosure_string, get_post_meta( $post_id, 'enclosure' ) );
    459459
    460460        // Check that the old enclosure is in the enclosure meta.
    461         $this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ), true ) );
     461        $this->assertContains( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) );
    462462    }
    463463
Note: See TracChangeset for help on using the changeset viewer.