Make WordPress Core


Ignore:
Timestamp:
11/09/2016 12:01:42 AM (10 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Utilise assertWPError() and assertNotWPError() in more places.

See #38716

File:
1 edited

Legend:

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

    r38382 r39174  
    4949        $found = wp_insert_term( 'foo', 'bar' );
    5050
    51         $this->assertTrue( is_wp_error( $found ) );
     51        $this->assertWPError( $found );
    5252        $this->assertSame( 'invalid_taxonomy', $found->get_error_code() );
    5353    }
     
    5858        remove_filter( 'pre_insert_term', array( $this, '_pre_insert_term_callback' ) );
    5959
    60         $this->assertTrue( is_wp_error( $found ) );
     60        $this->assertWPError( $found );
    6161        $this->assertSame( 'custom_error', $found->get_error_code() );
    6262    }
     
    6565        $found = wp_insert_term( 0, 'post_tag' );
    6666
    67         $this->assertTrue( is_wp_error( $found ) );
     67        $this->assertWPError( $found );
    6868        $this->assertSame( 'invalid_term_id', $found->get_error_code() );
    6969    }
     
    7272        $found = wp_insert_term( '  ', 'post_tag' );
    7373
    74         $this->assertTrue( is_wp_error( $found ) );
     74        $this->assertWPError( $found );
    7575        $this->assertSame( 'empty_term_name', $found->get_error_code() );
    7676    }
     
    8181        ) );
    8282
    83         $this->assertTrue( is_wp_error( $found ) );
     83        $this->assertWPError( $found );
    8484        $this->assertSame( 'missing_parent', $found->get_error_code() );
    8585    }
     
    171171        // Test an existing term name
    172172        $term2 = self::factory()->tag->create( array( 'name' => 'Bozo' ) );
    173         $this->assertTrue( is_wp_error( $term2 ) );
     173        $this->assertWPError( $term2 );
    174174        $this->assertNotEmpty( $term2->errors );
    175175
     
    180180        $term6 = self::factory()->tag->create( array( 'name' => 'T$$$$' ) );
    181181        $term7 = self::factory()->tag->create( array( 'name' => 'T$$$$' ) );
    182         $this->assertTrue( is_wp_error( $term7 ) );
     182        $this->assertWPError( $term7 );
    183183        $this->assertNotEmpty( $term7->errors );
    184184        $this->assertEquals( $term6, $term7->error_data['term_exists'] );
     
    193193        $term11 = self::factory()->tag->create( array( 'name' => '$$$$' ) );
    194194        $term12 = self::factory()->tag->create( array( 'name' => '$$$$' ) );
    195         $this->assertTrue( is_wp_error( $term12 ) );
     195        $this->assertWPError( $term12 );
    196196        $this->assertNotEmpty( $term12->errors );
    197197        $this->assertEquals( $term11, $term12->error_data['term_exists'] );
     
    203203        $this->assertNotWPError( $term13 );
    204204        $term14 = self::factory()->tag->create( array( 'name' => 'A' ) );
    205         $this->assertTrue( is_wp_error( $term14 ) );
     205        $this->assertWPError( $term14 );
    206206        $term15 = self::factory()->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) );
    207207        $this->assertNotWPError( $term15 );
    208208        $term16 = self::factory()->tag->create( array( 'name' => 'A+' ) );
    209         $this->assertTrue( is_wp_error( $term16 ) );
     209        $this->assertWPError( $term16 );
    210210        $term17 = self::factory()->tag->create( array( 'name' => 'A++' ) );
    211211        $this->assertNotWPError( $term17 );
     
    213213        $this->assertNotWPError( $term18 );
    214214        $term19 = self::factory()->tag->create( array( 'name' => 'A-' ) );
    215         $this->assertTrue( is_wp_error( $term19 ) );
     215        $this->assertWPError( $term19 );
    216216        $term20 = self::factory()->tag->create( array( 'name' => 'A--' ) );
    217217        $this->assertNotWPError( $term20 );
Note: See TracChangeset for help on using the changeset viewer.