Make WordPress Core

Changeset 51337


Ignore:
Timestamp:
07/06/2021 12:31:19 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( is_object( ... ) ) with assertIsObject() to use native PHPUnit functionality.

Follow-up to [51331], [51335].

See #53363.

Location:
trunk/tests/phpunit/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/nav-menu.php

    r50284 r51337  
    552552         */
    553553        function _confirm_nav_menu_item_args_object( $args ) {
    554                 $this->assertTrue( is_object( $args ) );
     554                $this->assertIsObject( $args );
    555555                return $args;
    556556        }
    557557
    558558        function _confirm_second_param_args_object( $ignored_1, $args ) {
    559                 $this->assertTrue( is_object( $args ) );
     559                $this->assertIsObject( $args );
    560560                return $ignored_1;
    561561        }
    562562
    563563        function _confirm_third_param_args_object( $ignored_1, $ignored_2, $args ) {
    564                 $this->assertTrue( is_object( $args ) );
     564                $this->assertIsObject( $args );
    565565                return $ignored_1;
    566566        }
    567567
    568568        function _confirm_forth_param_args_object( $ignored_1, $ignored_2, $ignored_3, $args ) {
    569                 $this->assertTrue( is_object( $args ) );
     569                $this->assertIsObject( $args );
    570570                return $ignored_1;
    571571        }
  • trunk/tests/phpunit/tests/taxonomy.php

    r51335 r51337  
    2828                        $tax = get_taxonomy( $taxonomy );
    2929                        // Should return an object with the correct taxonomy object type.
    30                         $this->assertTrue( is_object( $tax ) );
     30                        $this->assertIsObject( $tax );
    3131                        $this->assertIsArray( $tax->object_type );
    3232                        $this->assertSame( array( 'post' ), $tax->object_type );
     
    110110                        $tax = get_taxonomy( $taxonomy );
    111111                        // Should return an object with the correct taxonomy object type.
    112                         $this->assertTrue( is_object( $tax ) );
     112                        $this->assertIsObject( $tax );
    113113                        $this->assertIsArray( $tax->object_type );
    114114                        $this->assertSame( array( 'link' ), $tax->object_type );
Note: See TracChangeset for help on using the changeset viewer.