WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (3 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/taxonomy.php

    r51337 r51367  
    863863        $this->assertNotContains( '%foo%', $wp_rewrite->rewritecode );
    864864        $this->assertNotContains( 'bar=', $wp_rewrite->queryreplace );
    865         $this->assertSame( --$count_before, count( $wp_rewrite->rewritereplace ) ); // Array was reduced by one value.
     865        $this->assertCount( --$count_before, $wp_rewrite->rewritereplace ); // Array was reduced by one value.
    866866    }
    867867
     
    892892
    893893        $this->assertArrayHasKey( 'wp_ajax_add-foo', $wp_filter );
    894         $this->assertSame( 1, count( $wp_filter['wp_ajax_add-foo']->callbacks ) );
     894        $this->assertCount( 1, $wp_filter['wp_ajax_add-foo']->callbacks );
    895895        $this->assertTrue( unregister_taxonomy( 'foo' ) );
    896896        $this->assertArrayNotHasKey( 'wp_ajax_add-foo', $wp_filter );
Note: See TracChangeset for help on using the changeset viewer.