WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (2 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertSame( [number], count( ... ) ) with assertCount() to use native PHPUnit functionality.

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

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/types.php

    r51331 r51367  
    350350        $this->assertNotContains( '%foo%', $wp_rewrite->rewritecode );
    351351        $this->assertNotContains( 'bar=', $wp_rewrite->queryreplace );
    352         $this->assertSame( --$count_before, count( $wp_rewrite->rewritereplace ) ); // Array was reduced by one value.
     352        $this->assertCount( --$count_before, $wp_rewrite->rewritereplace ); // Array was reduced by one value.
    353353    }
    354354
     
    462462
    463463        $this->assertArrayHasKey( 'future_foo', $wp_filter );
    464         $this->assertSame( 1, count( $wp_filter['future_foo']->callbacks ) );
     464        $this->assertCount( 1, $wp_filter['future_foo']->callbacks );
    465465        $this->assertTrue( unregister_post_type( 'foo' ) );
    466466        $this->assertArrayNotHasKey( 'future_foo', $wp_filter );
     
    482482
    483483        $this->assertArrayHasKey( 'add_meta_boxes_foo', $wp_filter );
    484         $this->assertSame( 1, count( $wp_filter['add_meta_boxes_foo']->callbacks ) );
     484        $this->assertCount( 1, $wp_filter['add_meta_boxes_foo']->callbacks );
    485485        $this->assertTrue( unregister_post_type( 'foo' ) );
    486486        $this->assertArrayNotHasKey( 'add_meta_boxes_foo', $wp_filter );
Note: See TracChangeset for help on using the changeset viewer.