Changeset 39174
- Timestamp:
- 11/09/2016 12:01:42 AM (9 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/errors.php
r29854 r39174 10 10 $error = new WP_Error( 'foo', 'message', 'data' ); 11 11 12 $this->assert True( is_wp_error( $error ));12 $this->assertWPError( $error ); 13 13 $this->assertEquals( 'foo', $error->get_error_code() ); 14 14 $this->assertEquals( 'message', $error->get_error_message() ); … … 20 20 $error->add( 'foo', 'message', 'data' ); 21 21 22 $this->assert True( is_wp_error( $error ));22 $this->assertWPError( $error ); 23 23 $this->assertEquals( 'foo', $error->get_error_code() ); 24 24 $this->assertEquals( 'message', $error->get_error_message() ); … … 31 31 $error->add( 'bar', 'bar message', 'bar data' ); 32 32 33 $this->assert True( is_wp_error( $error ));33 $this->assertWPError( $error ); 34 34 $this->assertEquals( 'foo', $error->get_error_code() ); 35 35 $this->assertEquals( 'foo message', $error->get_error_message() ); -
trunk/tests/phpunit/tests/http/base.php
r38757 r39174 132 132 // 10 > 5 133 133 $res = wp_remote_request($this->redirection_script . '?rt=' . 10, array('redirection' => 5) ); 134 $this->assert True( is_wp_error($res), print_r($res, true));134 $this->assertWPError( $res ); 135 135 } 136 136 … … 138 138 // 6 > 5 (close edgecase) 139 139 $res = wp_remote_request($this->redirection_script . '?rt=' . 6, array('redirection' => 5) ); 140 $this->assert True( is_wp_error($res));140 $this->assertWPError( $res ); 141 141 } 142 142 … … 388 388 389 389 $res = wp_remote_get( 'https://wordpress.org/' ); 390 $this->assert True( ! is_wp_error( $res ), print_r( $res, true ));390 $this->assertNotWPError( $res ); 391 391 } 392 392 -
trunk/tests/phpunit/tests/import/parser.php
r33250 r39174 30 30 $parser = new $p; 31 31 $result = $parser->parse($file); 32 $this->assert True( is_wp_error( $result ));32 $this->assertWPError( $result ); 33 33 $this->assertEquals( 'There was an error when reading this WXR file', $result->get_error_message() ); 34 34 } … … 43 43 $parser = new $p; 44 44 $result = $parser->parse( $file ); 45 $this->assert True( is_wp_error( $result ));45 $this->assertWPError( $result ); 46 46 $this->assertEquals( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() ); 47 47 } -
trunk/tests/phpunit/tests/post.php
r38810 r39174 382 382 // Test both return paths with or without WP_Error 383 383 $insert_post = wp_insert_post( $post, true ); 384 $this->assert True( is_wp_error( $insert_post ), 'Did not get a WP_Error back from wp_insert_post');384 $this->assertWPError( $insert_post ); 385 385 $this->assertEquals( 'invalid_date', $insert_post->get_error_code() ); 386 386 -
trunk/tests/phpunit/tests/term/getTheTerms.php
r38398 r39174 144 144 $p = self::$post_ids[0]; 145 145 $terms = get_the_terms( $p, 'this-taxonomy-does-not-exist' ); 146 $this->assert True( is_wp_error( $terms ));146 $this->assertWPError( $terms ); 147 147 } 148 148 -
trunk/tests/phpunit/tests/term/taxQuery.php
r37682 r39174 232 232 $tq->transform_query( $tq->queries[0], 'term_taxonomy_id' ); 233 233 234 $this->assert True( is_wp_error( $tq->queries[0] ));234 $this->assertWPError( $tq->queries[0] ); 235 235 } 236 236 -
trunk/tests/phpunit/tests/term/wpInsertTerm.php
r38382 r39174 49 49 $found = wp_insert_term( 'foo', 'bar' ); 50 50 51 $this->assert True( is_wp_error( $found ));51 $this->assertWPError( $found ); 52 52 $this->assertSame( 'invalid_taxonomy', $found->get_error_code() ); 53 53 } … … 58 58 remove_filter( 'pre_insert_term', array( $this, '_pre_insert_term_callback' ) ); 59 59 60 $this->assert True( is_wp_error( $found ));60 $this->assertWPError( $found ); 61 61 $this->assertSame( 'custom_error', $found->get_error_code() ); 62 62 } … … 65 65 $found = wp_insert_term( 0, 'post_tag' ); 66 66 67 $this->assert True( is_wp_error( $found ));67 $this->assertWPError( $found ); 68 68 $this->assertSame( 'invalid_term_id', $found->get_error_code() ); 69 69 } … … 72 72 $found = wp_insert_term( ' ', 'post_tag' ); 73 73 74 $this->assert True( is_wp_error( $found ));74 $this->assertWPError( $found ); 75 75 $this->assertSame( 'empty_term_name', $found->get_error_code() ); 76 76 } … … 81 81 ) ); 82 82 83 $this->assert True( is_wp_error( $found ));83 $this->assertWPError( $found ); 84 84 $this->assertSame( 'missing_parent', $found->get_error_code() ); 85 85 } … … 171 171 // Test an existing term name 172 172 $term2 = self::factory()->tag->create( array( 'name' => 'Bozo' ) ); 173 $this->assert True( is_wp_error( $term2 ));173 $this->assertWPError( $term2 ); 174 174 $this->assertNotEmpty( $term2->errors ); 175 175 … … 180 180 $term6 = self::factory()->tag->create( array( 'name' => 'T$$$$' ) ); 181 181 $term7 = self::factory()->tag->create( array( 'name' => 'T$$$$' ) ); 182 $this->assert True( is_wp_error( $term7 ));182 $this->assertWPError( $term7 ); 183 183 $this->assertNotEmpty( $term7->errors ); 184 184 $this->assertEquals( $term6, $term7->error_data['term_exists'] ); … … 193 193 $term11 = self::factory()->tag->create( array( 'name' => '$$$$' ) ); 194 194 $term12 = self::factory()->tag->create( array( 'name' => '$$$$' ) ); 195 $this->assert True( is_wp_error( $term12 ));195 $this->assertWPError( $term12 ); 196 196 $this->assertNotEmpty( $term12->errors ); 197 197 $this->assertEquals( $term11, $term12->error_data['term_exists'] ); … … 203 203 $this->assertNotWPError( $term13 ); 204 204 $term14 = self::factory()->tag->create( array( 'name' => 'A' ) ); 205 $this->assert True( is_wp_error( $term14 ));205 $this->assertWPError( $term14 ); 206 206 $term15 = self::factory()->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) ); 207 207 $this->assertNotWPError( $term15 ); 208 208 $term16 = self::factory()->tag->create( array( 'name' => 'A+' ) ); 209 $this->assert True( is_wp_error( $term16 ));209 $this->assertWPError( $term16 ); 210 210 $term17 = self::factory()->tag->create( array( 'name' => 'A++' ) ); 211 211 $this->assertNotWPError( $term17 ); … … 213 213 $this->assertNotWPError( $term18 ); 214 214 $term19 = self::factory()->tag->create( array( 'name' => 'A-' ) ); 215 $this->assert True( is_wp_error( $term19 ));215 $this->assertWPError( $term19 ); 216 216 $term20 = self::factory()->tag->create( array( 'name' => 'A--' ) ); 217 217 $this->assertNotWPError( $term20 ); -
trunk/tests/phpunit/tests/term/wpSetObjectTerms.php
r38667 r39174 166 166 // bogus taxonomy 167 167 $result = wp_set_object_terms( self::$post_ids[0], array(rand_str()), rand_str() ); 168 $this->assert True( is_wp_error($result));168 $this->assertWPError( $result ); 169 169 } 170 170 -
trunk/tests/phpunit/tests/term/wpUpdateTerm.php
r37593 r39174 8 8 $found = wp_update_term( 1, 'bar' ); 9 9 10 $this->assert True( is_wp_error( $found ));10 $this->assertWPError( $found ); 11 11 $this->assertSame( 'invalid_taxonomy', $found->get_error_code() ); 12 12 } … … 15 15 $found = wp_update_term( '', 'post_tag' ); 16 16 17 $this->assert True( is_wp_error( $found ));17 $this->assertWPError( $found ); 18 18 $this->assertSame( 'invalid_term', $found->get_error_code() ); 19 19 } … … 61 61 ) ); 62 62 63 $this->assert True( is_wp_error( $found ));63 $this->assertWPError( $found ); 64 64 $this->assertSame( 'empty_term_name', $found->get_error_code() ); 65 65 _unregister_taxonomy( 'wptests_tax' ); -
trunk/tests/phpunit/tests/xmlrpc/wp/editProfile.php
r38938 r39174 52 52 $auth_new = wp_authenticate( 'author', $new_pass ); 53 53 $this->assertInstanceOf( 'WP_User', $auth_old ); 54 $this->assert True( is_wp_error( $auth_new ));54 $this->assertWPError( $auth_new ); 55 55 } 56 56
Note: See TracChangeset
for help on using the changeset viewer.