WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/27/2015 10:26:16 PM (6 years ago)
Author:
johnbillion
Message:

Switch several assertions to assertNotWPError() so more context is provided when the assertion fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/wpInsertTerm.php

    r31812 r34646  
    2828        $t = wp_insert_term( $term, $taxonomy );
    2929        $this->assertInternalType( 'array', $t );
    30         $this->assertFalse( is_wp_error($t) );
     30        $this->assertNotWPError( $t );
    3131        $this->assertTrue( $t['term_id'] > 0 );
    3232        $this->assertTrue( $t['term_taxonomy_id'] > 0 );
     
    162162    public function test_wp_insert_term_duplicate_name() {
    163163        $term = $this->factory->tag->create_and_get( array( 'name' => 'Bozo' ) );
    164         $this->assertFalse( is_wp_error( $term ) );
     164        $this->assertNotWPError( $term );
    165165        $this->assertTrue( empty( $term->errors ) );
    166166
    167167        // Test existing term name with unique slug
    168168        $term1 = $this->factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );
    169         $this->assertFalse( is_wp_error( $term1 ) );
     169        $this->assertNotWPError( $term1 );
    170170
    171171        // Test an existing term name
     
    201201
    202202        $term13 = $this->factory->tag->create( array( 'name' => 'A' ) );
    203         $this->assertFalse( is_wp_error( $term13 ) );
     203        $this->assertNotWPError( $term13 );
    204204        $term14 = $this->factory->tag->create( array( 'name' => 'A' ) );
    205205        $this->assertTrue( is_wp_error( $term14 ) );
    206206        $term15 = $this->factory->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) );
    207         $this->assertFalse( is_wp_error( $term15 ) );
     207        $this->assertNotWPError( $term15 );
    208208        $term16 = $this->factory->tag->create( array( 'name' => 'A+' ) );
    209209        $this->assertTrue( is_wp_error( $term16 ) );
    210210        $term17 = $this->factory->tag->create( array( 'name' => 'A++' ) );
    211         $this->assertFalse( is_wp_error( $term17 ) );
     211        $this->assertNotWPError( $term17 );
    212212        $term18 = $this->factory->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) );
    213         $this->assertFalse( is_wp_error( $term18 ) );
     213        $this->assertNotWPError( $term18 );
    214214        $term19 = $this->factory->tag->create( array( 'name' => 'A-' ) );
    215215        $this->assertTrue( is_wp_error( $term19 ) );
    216216        $term20 = $this->factory->tag->create( array( 'name' => 'A--' ) );
    217         $this->assertFalse( is_wp_error( $term20 ) );
     217        $this->assertNotWPError( $term20 );
    218218    }
    219219
     
    277277        ) );
    278278
    279         $this->assertFalse( is_wp_error( $t2 ) );
     279        $this->assertNotWPError( $t2 );
    280280
    281281        $t2_term = get_term( $t2['term_id'], 'wptests_tax' );
     
    369369        ) );
    370370
    371         $this->assertFalse( is_wp_error( $t4 ) );
     371        $this->assertNotWPError( $t4 );
    372372        $t4_term = get_term( $t4['term_id'], 'wptests_tax' );
    373373
     
    392392        ) );
    393393
    394         $this->assertFalse( is_wp_error( $t2 ) );
     394        $this->assertNotWPError( $t2 );
    395395
    396396        $t2_term = get_term( $t2['term_id'], 'wptests_tax' );
     
    456456        ) );
    457457
    458         $this->assertFalse( is_wp_error( $created ) );
     458        $this->assertNotWPError( $created );
    459459
    460460        $new_term = get_term( $created['term_id'], 'wptests_tax_2' );
     
    487487        ) );
    488488
    489         $this->assertFalse( is_wp_error( $created ) );
     489        $this->assertNotWPError( $created );
    490490
    491491        $new_term = get_term( $created['term_id'], 'wptests_tax_2' );
Note: See TracChangeset for help on using the changeset viewer.