Make WordPress Core


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

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( isset( ... ) ) with assertArrayHasKey() to use native PHPUnit functionality.

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

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/hooks/removeFilter.php

    r50342 r51397  
    1919                $hook->remove_filter( $tag, $callback, $priority );
    2020
    21                 $this->assertFalse( isset( $hook->callbacks[ $priority ] ) );
     21                $this->assertArrayNotHasKey( $priority, $hook->callbacks );
    2222        }
    2323
    … …  
    3333                $hook->remove_filter( $tag, $callback, $priority );
    3434
    35                 $this->assertFalse( isset( $hook->callbacks[ $priority ] ) );
     35                $this->assertArrayNotHasKey( $priority, $hook->callbacks );
    3636        }
    3737
    … …  
    4646                $hook->remove_filter( $tag, $callback, $priority );
    4747
    48                 $this->assertFalse( isset( $hook->callbacks[ $priority ] ) );
     48                $this->assertArrayNotHasKey( $priority, $hook->callbacks );
    4949        }
    5050
    … …  
    7777
    7878                $hook->remove_filter( $tag, $callback_one, $priority );
    79                 $this->assertFalse( isset( $hook->callbacks[ $priority ] ) );
     79                $this->assertArrayNotHasKey( $priority, $hook->callbacks );
    8080                $this->assertCount( 1, $hook->callbacks[ $priority + 1 ] );
    8181        }
Note: See TracChangeset for help on using the changeset viewer.