Ticket #39265: g_folders.2.patch
File g_folders.2.patch, 29.0 KB (added by , 4 years ago) |
---|
-
archives.php
12 12 13 13 /** 14 14 * @ticket 23206 15 * 16 * @covers ::wp_get_archives 15 17 */ 16 18 function test_get_archives_cache() { 17 19 global $wpdb; -
document-title.php
58 58 function _add_title_tag_support() { 59 59 add_theme_support( 'title-tag' ); 60 60 } 61 61 62 /** 63 * @covers ::_wp_render_title_tag 64 */ 62 65 function test__wp_render_title_tag() { 63 66 $this->go_to( '/' ); 64 67 … … 66 69 _wp_render_title_tag(); 67 70 } 68 71 72 /** 73 * @covers ::_wp_render_title_tag 74 */ 69 75 function test__wp_render_title_no_theme_support() { 70 76 $this->go_to( '/' ); 71 77 … … 74 80 $this->expectOutputString( '' ); 75 81 _wp_render_title_tag(); 76 82 } 77 83 84 /** 85 * @covers ::wp_get_document_title 86 */ 78 87 function test_short_circuiting_title() { 79 88 $this->go_to( '/' ); 80 89 … … 86 95 function _short_circuit_title( $title ) { 87 96 return 'A Wild Title'; 88 97 } 89 98 99 /** 100 * @covers ::wp_get_document_title 101 */ 90 102 function test_front_page_title() { 91 103 update_option( 'show_on_front', 'page' ); 92 104 update_option( … … 108 120 $this->go_to( '/' ); 109 121 $this->assertSame( sprintf( '%s – Just another WordPress site', $this->blog_name ), wp_get_document_title() ); 110 122 } 111 123 112 124 function _front_page_title_parts( $parts ) { 113 125 $this->assertArrayHasKey( 'title', $parts ); 114 126 $this->assertArrayHasKey( 'tagline', $parts ); … … 116 128 117 129 return $parts; 118 130 } 119 131 132 /** 133 * @covers ::wp_get_document_title 134 */ 120 135 function test_home_title() { 121 136 $blog_page_id = $this->factory->post->create( 122 137 array( … … 131 146 $this->go_to( get_permalink( $blog_page_id ) ); 132 147 $this->assertSame( sprintf( 'blog-page – %s', $this->blog_name ), wp_get_document_title() ); 133 148 } 134 149 150 /** 151 * @covers ::wp_get_document_title 152 */ 135 153 function test_paged_title() { 136 154 $this->go_to( '?page=4' ); 137 155 … … 148 166 149 167 return $parts; 150 168 } 151 169 170 /** 171 * @covers ::wp_get_document_title 172 */ 152 173 function test_singular_title() { 153 174 $this->go_to( '?p=' . self::$post_id ); 154 175 … … 164 185 165 186 return $parts; 166 187 } 167 188 189 /** 190 * @covers ::wp_get_document_title 191 */ 168 192 function test_category_title() { 169 193 $this->go_to( '?cat=' . self::$category_id ); 170 194 171 195 $this->assertSame( sprintf( 'test_category – %s', $this->blog_name ), wp_get_document_title() ); 172 196 } 173 197 198 /** 199 * @covers ::wp_get_document_title 200 */ 174 201 function test_search_title() { 175 202 $this->go_to( '?s=test_title' ); 176 203 177 204 $this->assertSame( sprintf( 'Search Results for “test_title” – %s', $this->blog_name ), wp_get_document_title() ); 178 205 } 179 206 207 /** 208 * @covers ::wp_get_document_title 209 */ 180 210 function test_author_title() { 181 211 $this->go_to( '?author=' . self::$author_id ); 182 212 183 213 $this->assertSame( sprintf( 'test_author – %s', $this->blog_name ), wp_get_document_title() ); 184 214 } 185 215 216 /** 217 * @covers ::wp_get_document_title 218 */ 186 219 function test_post_type_archive_title() { 187 220 register_post_type( 188 221 'cpt', … … 205 238 206 239 $this->assertSame( sprintf( 'test_cpt – %s', $this->blog_name ), wp_get_document_title() ); 207 240 } 208 241 242 /** 243 * @covers ::wp_get_document_title 244 */ 209 245 function test_year_title() { 210 246 $this->go_to( '?year=2015' ); 211 247 212 248 $this->assertSame( sprintf( '2015 – %s', $this->blog_name ), wp_get_document_title() ); 213 249 } 214 250 251 /** 252 * @covers ::wp_get_document_title 253 */ 215 254 function test_month_title() { 216 255 $this->go_to( '?monthnum=09' ); 217 256 218 257 $this->assertSame( sprintf( 'September 2015 – %s', $this->blog_name ), wp_get_document_title() ); 219 258 } 220 259 260 /** 261 * @covers ::wp_get_document_title 262 */ 221 263 function test_day_title() { 222 264 $this->go_to( '?day=22' ); 223 265 224 266 $this->assertSame( sprintf( 'September 22, 2015 – %s', $this->blog_name ), wp_get_document_title() ); 225 267 } 226 268 269 /** 270 * @covers ::wp_get_document_title 271 */ 227 272 function test_404_title() { 228 273 $this->go_to( '?m=404' ); 229 274 230 275 $this->assertSame( sprintf( 'Page not found – %s', $this->blog_name ), wp_get_document_title() ); 231 276 } 232 277 278 /** 279 * @covers ::wp_get_document_title 280 */ 233 281 function test_paged_post_title() { 234 282 $this->go_to( '?paged=4&p=' . self::$post_id ); 235 283 … … 237 285 238 286 $this->assertSame( sprintf( 'test_title – Page 4 – %s', $this->blog_name ), wp_get_document_title() ); 239 287 } 240 288 241 289 function _paged_post_title_parts( $parts ) { 242 290 $this->assertArrayHasKey( 'page', $parts ); 243 291 $this->assertArrayHasKey( 'site', $parts ); … … 246 294 247 295 return $parts; 248 296 } 249 297 298 /** 299 * @covers ::wp_get_document_title 300 */ 250 301 function test_rearrange_title_parts() { 251 302 $this->go_to( '?p=' . self::$post_id ); 252 303 … … 254 305 255 306 $this->assertSame( sprintf( '%s – test_title', $this->blog_name ), wp_get_document_title() ); 256 307 } 257 308 258 309 function _rearrange_title_parts( $parts ) { 259 310 $parts = array( 260 311 $parts['site'], … … 263 314 264 315 return $parts; 265 316 } 266 317 318 /** 319 * @covers ::wp_get_document_title 320 */ 267 321 function test_change_title_separator() { 268 322 $this->go_to( '?p=' . self::$post_id ); 269 323 -
paginateLinks.php
9 9 10 10 $this->go_to( home_url( '/' ) ); 11 11 } 12 12 13 /** 14 * @covers ::paginate_links 15 */ 13 16 function test_defaults() { 14 17 $page2 = get_pagenum_link( 2 ); 15 18 $page3 = get_pagenum_link( 3 ); … … 27 30 $links = paginate_links( array( 'total' => 50 ) ); 28 31 $this->assertSameIgnoreEOL( $expected, $links ); 29 32 } 30 33 34 /** 35 * @covers ::paginate_links 36 */ 31 37 function test_format() { 32 38 $page2 = home_url( '/page/2/' ); 33 39 $page3 = home_url( '/page/3/' ); … … 50 56 ); 51 57 $this->assertSameIgnoreEOL( $expected, $links ); 52 58 } 53 59 60 /** 61 * @covers ::paginate_links 62 */ 54 63 function test_prev_next_false() { 55 64 $home = home_url( '/' ); 56 65 $page3 = get_pagenum_link( 3 ); … … 75 84 ); 76 85 $this->assertSameIgnoreEOL( $expected, $links ); 77 86 } 78 87 88 /** 89 * @covers ::paginate_links 90 */ 79 91 function test_prev_next_true() { 80 92 $home = home_url( '/' ); 81 93 $page3 = get_pagenum_link( 3 ); … … 109 121 110 122 /** 111 123 * @ticket 25735 124 * 125 * @covers ::paginate_links 112 126 */ 113 127 function test_paginate_links_number_format() { 114 128 $this->i18n_count = 0; … … 131 145 132 146 /** 133 147 * @ticket 24606 148 * 149 * @covers ::paginate_links 134 150 */ 135 151 function test_paginate_links_base_value() { 136 152 … … 212 228 213 229 /** 214 230 * @ticket 29636 231 * 232 * @covers ::paginate_links 215 233 */ 216 234 function test_paginate_links_query_args() { 217 235 add_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) ); … … 250 268 251 269 /** 252 270 * @ticket 30831 271 * 272 * @covers ::paginate_links 253 273 */ 254 274 function test_paginate_links_with_custom_query_args() { 255 275 add_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) ); … … 290 310 291 311 /** 292 312 * @ticket 30831 313 * 314 * @covers ::paginate_links 293 315 */ 294 316 public function test_paginate_links_should_allow_non_default_format_without_add_args() { 295 317 // Fake the query params. … … 316 338 317 339 /** 318 340 * @ticket 30831 341 * 342 * @covers ::paginate_links 319 343 */ 320 344 public function test_paginate_links_should_allow_add_args_to_be_bool_false() { 321 345 // Fake the query params. … … 338 362 339 363 /** 340 364 * @ticket 31939 365 * 366 * @covers ::paginate_links 341 367 */ 342 368 public function test_custom_base_query_arg_should_be_stripped_from_current_url_before_generating_pag_links() { 343 369 // Fake the current URL: example.com?foo. -
resourceHints.php
29 29 add_action( 'wp_default_styles', 'wp_default_styles' ); 30 30 parent::tearDown(); 31 31 } 32 32 33 /** 34 * @covers ::wp_resource_hints 35 */ 33 36 function test_should_have_defaults_on_frontend() { 34 37 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n"; 35 38 … … 37 40 38 41 wp_resource_hints(); 39 42 } 40 43 44 /** 45 * @covers ::wp_resource_hints 46 */ 41 47 function test_dns_prefetching() { 42 48 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 43 49 "<link rel='dns-prefetch' href='//wordpress.org' />\n" . … … 68 74 69 75 /** 70 76 * @ticket 37652 77 * 78 * @covers ::wp_resource_hints 71 79 */ 72 80 function test_preconnect() { 73 81 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . … … 84 92 85 93 $this->assertSame( $expected, $actual ); 86 94 } 87 95 88 96 function _add_preconnect_domains( $hints, $method ) { 89 97 if ( 'preconnect' === $method ) { 90 98 $hints[] = '//wordpress.org'; … … 96 104 97 105 return $hints; 98 106 } 99 107 108 /** 109 * @covers ::wp_resource_hints 110 */ 100 111 function test_prerender() { 101 112 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 102 113 "<link rel='prerender' href='https://make.wordpress.org/great-again' />\n" . … … 122 133 123 134 return $hints; 124 135 } 125 136 137 /** 138 * @covers ::wp_resource_hints 139 */ 126 140 function test_parse_url_dns_prefetch() { 127 141 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 128 142 "<link rel='dns-prefetch' href='//make.wordpress.org' />\n"; … … 143 157 144 158 return $hints; 145 159 } 146 160 161 /** 162 * @covers ::wp_resource_hints 163 */ 147 164 function test_dns_prefetch_styles() { 148 165 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" . 149 166 "<link rel='dns-prefetch' href='//s.w.org' />\n"; … … 162 179 $this->assertSame( $expected, $actual ); 163 180 164 181 } 165 182 183 /** 184 * @covers ::wp_resource_hints 185 */ 166 186 function test_dns_prefetch_scripts() { 167 187 $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" . 168 188 "<link rel='dns-prefetch' href='//s.w.org' />\n"; … … 180 200 181 201 $this->assertSame( $expected, $actual ); 182 202 } 183 203 204 /** 205 * @covers ::wp_resource_hints 206 */ 184 207 function test_dns_prefetch_scripts_does_not_included_registered_only() { 185 208 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n"; 186 209 $unexpected = "<link rel='dns-prefetch' href='//wordpress.org' />\n"; … … 197 220 198 221 /** 199 222 * @ticket 37502 223 * 224 * @covers ::wp_resource_hints 200 225 */ 201 226 function test_deregistered_scripts_are_ignored() { 202 227 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n"; … … 210 235 211 236 /** 212 237 * @ticket 37652 238 * 239 * @covers ::wp_resource_hints 213 240 */ 214 241 function test_malformed_urls() { 215 242 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n"; … … 245 272 246 273 /** 247 274 * @group 38121 275 * 276 * @covers ::wp_resource_hints 248 277 */ 249 278 function test_custom_attributes() { 250 279 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . -
template.php
33 33 34 34 /** 35 35 * @group site_icon 36 * 37 * @covers ::get_site_icon_url 36 38 */ 37 39 function test_get_site_icon_url() { 38 40 $this->assertEmpty( get_site_icon_url() ); … … 46 48 47 49 /** 48 50 * @group site_icon 51 * 52 * @covers ::site_icon_url 49 53 */ 50 54 function test_site_icon_url() { 51 55 $this->expectOutputString( '' ); … … 58 62 59 63 /** 60 64 * @group site_icon 65 * 66 * @covers ::has_site_icon 61 67 */ 62 68 function test_has_site_icon() { 63 69 $this->assertFalse( has_site_icon() ); … … 73 79 * @group site_icon 74 80 * @group multisite 75 81 * @group ms-required 82 * 83 * @covers ::has_site_icon 76 84 */ 77 85 function test_has_site_icon_returns_true_when_called_for_other_site_with_site_icon_set() { 78 86 $blog_id = $this->factory->blog->create(); … … 87 95 * @group site_icon 88 96 * @group multisite 89 97 * @group ms-required 98 * 99 * @covers ::has_site_icon 90 100 */ 91 101 function test_has_site_icon_returns_false_when_called_for_other_site_without_site_icon_set() { 92 102 $blog_id = $this->factory->blog->create(); … … 96 106 97 107 /** 98 108 * @group site_icon 109 * 110 * @covers ::wp_site_icon 99 111 */ 100 112 function test_wp_site_icon() { 101 113 $this->expectOutputString( '' ); … … 117 129 118 130 /** 119 131 * @group site_icon 132 * 133 * @covers ::wp_site_icon 120 134 */ 121 135 function test_wp_site_icon_with_filter() { 122 136 $this->expectOutputString( '' ); … … 132 146 '', 133 147 ); 134 148 $output = implode( "\n", $output ); 135 149 136 150 $this->expectOutputString( $output ); 137 151 add_filter( 'site_icon_meta_tags', array( $this, '_custom_site_icon_meta_tag' ) ); 138 152 wp_site_icon(); … … 142 156 /** 143 157 * @group site_icon 144 158 * @ticket 38377 159 * 160 * @covers ::wp_site_icon 145 161 */ 146 162 function test_customize_preview_wp_site_icon_empty() { 147 163 global $wp_customize; … … 159 175 /** 160 176 * @group site_icon 161 177 * @ticket 38377 178 * 179 * @covers ::wp_site_icon 162 180 */ 163 181 function test_customize_preview_wp_site_icon_dirty() { 164 182 global $wp_customize; … … 243 261 * @group custom_logo 244 262 * 245 263 * @since 4.5.0 264 * 265 * @covers ::has_custom_logo 246 266 */ 247 267 function test_has_custom_logo() { 248 268 $this->assertFalse( has_custom_logo() ); … … 258 278 * @group custom_logo 259 279 * @group multisite 260 280 * @group ms-required 281 * 282 * @covers ::has_custom_logo 261 283 */ 262 284 function test_has_custom_logo_returns_true_when_called_for_other_site_with_custom_logo_set() { 263 285 $blog_id = $this->factory->blog->create(); … … 272 294 * @group custom_logo 273 295 * @group multisite 274 296 * @group ms-required 297 * 298 * @covers ::has_custom_logo 275 299 */ 276 300 function test_has_custom_logo_returns_false_when_called_for_other_site_without_custom_logo_set() { 277 301 $blog_id = $this->factory->blog->create(); … … 283 307 * @group custom_logo 284 308 * 285 309 * @since 4.5.0 310 * 311 * @covers ::get_custom_logo 286 312 */ 287 313 function test_get_custom_logo() { 288 314 $this->assertEmpty( get_custom_logo() ); … … 300 326 * @group custom_logo 301 327 * @group multisite 302 328 * @group ms-required 329 * 330 * @covers ::get_custom_logo 303 331 */ 304 332 function test_get_custom_logo_returns_logo_when_called_for_other_site_with_custom_logo_set() { 305 333 $blog_id = $this->factory->blog->create(); … … 330 358 * @group custom_logo 331 359 * 332 360 * @since 4.5.0 361 * 362 * @covers ::the_custom_logo 333 363 */ 334 364 function test_the_custom_logo() { 335 365 $this->expectOutputString( '' ); … … 357 387 /** 358 388 * @group custom_logo 359 389 * @ticket 38768 390 * 391 * @covers ::the_custom_logo 360 392 */ 361 393 function test_the_custom_logo_with_alt() { 362 394 $this->_set_custom_logo(); … … 420 452 /** 421 453 * @ticket 38253 422 454 * @group ms-required 455 * 456 * @covers ::get_site_icon_url 423 457 */ 424 458 function test_get_site_icon_url_preserves_switched_state() { 425 459 $blog_id = $this->factory->blog->create(); … … 439 473 /** 440 474 * @ticket 38253 441 475 * @group ms-required 476 * 477 * @covers ::has_custom_logo 442 478 */ 443 479 function test_has_custom_logo_preserves_switched_state() { 444 480 $blog_id = $this->factory->blog->create(); … … 458 494 /** 459 495 * @ticket 38253 460 496 * @group ms-required 497 * 498 * @covers ::get_custom_logo 461 499 */ 462 500 function test_get_custom_logo_preserves_switched_state() { 463 501 $blog_id = $this->factory->blog->create(); … … 491 529 492 530 /** 493 531 * @ticket 40969 532 * 533 * @covers ::get_header 494 534 */ 495 535 function test_get_header_returns_nothing_on_success() { 496 536 $this->expectOutputRegex( '/Header/' ); … … 502 542 503 543 /** 504 544 * @ticket 40969 545 * 546 * @covers ::get_footer 505 547 */ 506 548 function test_get_footer_returns_nothing_on_success() { 507 549 $this->expectOutputRegex( '/Footer/' ); … … 513 555 514 556 /** 515 557 * @ticket 40969 558 * 559 * @covers ::get_sidebar 516 560 */ 517 561 function test_get_sidebar_returns_nothing_on_success() { 518 562 $this->expectOutputRegex( '/Sidebar/' ); … … 524 568 525 569 /** 526 570 * @ticket 40969 571 * 572 * @covers ::get_template_part 527 573 */ 528 574 function test_get_template_part_returns_nothing_on_success() { 529 575 $this->expectOutputRegex( '/Template Part/' ); … … 535 581 536 582 /** 537 583 * @ticket 40969 584 * 585 * @covers ::get_template_part 538 586 */ 539 587 function test_get_template_part_returns_false_on_failure() { 540 588 $this->assertFalse( get_template_part( 'non-existing-template' ) ); … … 542 590 543 591 /** 544 592 * @ticket 21676 593 * 594 * @covers ::get_template_part 545 595 */ 546 596 function test_get_template_part_passes_arguments_to_template() { 547 597 $this->expectOutputRegex( '/{"foo":"baz"}/' ); … … 552 602 /** 553 603 * @ticket 9862 554 604 * @dataProvider data_selected_and_checked_with_equal_values 605 * 606 * @covers ::selected 607 * @covers ::checked 555 608 */ 556 609 function test_selected_and_checked_with_equal_values( $selected, $current ) { 557 610 $this->assertSame( " selected='selected'", selected( $selected, $current, false ) ); … … 576 629 /** 577 630 * @ticket 9862 578 631 * @dataProvider data_selected_and_checked_with_non_equal_values 632 * 633 * @covers ::selected 634 * @covers ::checked 579 635 */ 580 636 function test_selected_and_checked_with_non_equal_values( $selected, $current ) { 581 637 $this->assertSame( '', selected( $selected, $current, false ) ); -
wpError.php
24 24 25 25 $this->wp_error = new WP_Error(); 26 26 } 27 27 28 /** 29 * @covers WP_Error::__construct 30 */ 28 31 public function test_WP_Error_should_be_of_type_WP_Error() { 29 32 $this->assertWPError( $this->wp_error ); 30 33 } 31 34 35 /** 36 * @covers WP_Error::errors 37 */ 32 38 public function test_WP_Error_with_default_empty_parameters_should_add_no_errors() { 33 39 $this->assertEmpty( $this->wp_error->errors ); 34 40 } 35 41 42 /** 43 * @covers WP_Error::get_error_code 44 */ 36 45 public function test_WP_Error_with_empty_code_should_add_no_code() { 37 46 $this->assertSame( '', $this->wp_error->get_error_code() ); 38 47 } 39 48 49 /** 50 * @covers WP_Error::get_error_message 51 */ 40 52 public function test_WP_Error_with_empty_code_should_add_no_message() { 41 53 $this->assertSame( '', $this->wp_error->get_error_message() ); 42 54 } 43 55 56 /** 57 * @covers WP_Error::error_data 58 */ 44 59 public function test_WP_Error_with_empty_code_should_add_no_error_data() { 45 60 $this->assertEmpty( $this->wp_error->error_data ); 46 61 } 47 62 63 /** 64 * @covers WP_Error::get_error_code 65 */ 48 66 public function test_WP_Error_with_code_and_empty_message_should_add_error_with_that_code() { 49 67 $wp_error = new WP_Error( 'code' ); 50 68 51 69 $this->assertSame( 'code', $wp_error->get_error_code() ); 52 70 } 53 71 72 /** 73 * @covers WP_Error::get_error_message 74 */ 54 75 public function test_WP_Error_with_code_and_empty_message_should_add_error_with_that_code_and_empty_message() { 55 76 $wp_error = new WP_Error( 'code' ); 56 77 57 78 $this->assertSame( '', $wp_error->get_error_message( 'code' ) ); 58 79 } 59 80 81 /** 82 * @covers WP_Error::get_error_data 83 */ 60 84 public function test_WP_Error_with_code_and_empty_message_and_empty_data_should_add_error_but_not_associated_data() { 61 85 $wp_error = new WP_Error( 'code' ); 62 86 63 87 $this->assertNull( $wp_error->get_error_data( 'code' ) ); 64 88 } 65 89 90 /** 91 * @covers WP_Error::get_error_data 92 */ 66 93 public function test_WP_Error_with_code_and_empty_message_and_non_empty_data_should_add_error_with_empty_message_and_that_stored_data() { 67 94 $wp_error = new WP_Error( 'code', '', 'data' ); 68 95 69 96 $this->assertSame( 'data', $wp_error->get_error_data( 'code' ) ); 70 97 } 71 98 99 /** 100 * @covers WP_Error::get_error_code 101 */ 72 102 public function test_WP_Error_with_code_and_message_should_add_error_with_that_code() { 73 103 $wp_error = new WP_Error( 'code', 'message' ); 74 104 75 105 $this->assertSame( 'code', $wp_error->get_error_code() ); 76 106 } 77 107 108 /** 109 * @covers WP_Error::get_error_message 110 */ 78 111 public function test_WP_Error_with_code_and_message_should_add_error_with_that_message() { 79 112 $wp_error = new WP_Error( 'code', 'message' ); 80 113 81 114 $this->assertSame( 'message', $wp_error->get_error_message( 'code' ) ); 82 115 } 83 116 117 /** 118 * @covers WP_Error::get_error_code 119 */ 84 120 public function test_WP_Error_with_code_and_message_and_data_should_add_error_with_that_code() { 85 121 $wp_error = new WP_Error( 'code', 'message', 'data' ); 86 122 87 123 $this->assertSame( 'code', $wp_error->get_error_code() ); 88 124 } 89 125 126 /** 127 * @covers WP_Error::get_error_message 128 */ 90 129 public function test_WP_Error_with_code_and_message_and_data_should_add_error_with_that_message() { 91 130 $wp_error = new WP_Error( 'code', 'message', 'data' ); 92 131 93 132 $this->assertSame( 'message', $wp_error->get_error_message( 'code' ) ); 94 133 } 95 134 135 /** 136 * @covers WP_Error::get_error_data 137 */ 96 138 public function test_WP_Error_with_code_and_message_and_data_should_add_error_with_that_data() { 97 139 $wp_error = new WP_Error( 'code', 'message', 'data' ); 98 140 … … 100 142 } 101 143 102 144 /** 103 * @covers ::get_error_codes145 * @covers WP_Error::get_error_codes 104 146 */ 105 147 public function test_get_error_codes_with_no_errors_should_return_empty_array() { 106 148 $this->assertEmpty( $this->wp_error->get_error_codes() ); … … 107 149 } 108 150 109 151 /** 110 * @covers ::get_error_codes152 * @covers WP_Error::get_error_codes 111 153 */ 112 154 public function test_get_error_codes_with_one_error_should_return_an_array_with_only_that_code() { 113 155 $this->wp_error->add( 'code', 'message' ); … … 116 158 } 117 159 118 160 /** 119 * @covers ::get_error_codes161 * @covers WP_Error::get_error_codes 120 162 */ 121 163 public function test_get_error_codes_with_multiple_errors_should_return_an_array_of_those_codes() { 122 164 $this->wp_error->add( 'code', 'message' ); … … 128 170 } 129 171 130 172 /** 131 * @covers ::get_error_code173 * @covers WP_Error::get_error_code 132 174 */ 133 175 public function test_get_error_code_with_no_errors_should_return_an_empty_string() { 134 176 $this->assertSame( '', $this->wp_error->get_error_code() ); … … 135 177 } 136 178 137 179 /** 138 * @covers ::get_error_code180 * @covers WP_Error::get_error_code 139 181 */ 140 182 public function test_get_error_code_with_one_error_should_return_that_error_code() { 141 183 $this->wp_error->add( 'code', 'message' ); … … 144 186 } 145 187 146 188 /** 147 * @covers ::get_error_code189 * @covers WP_Error::get_error_code 148 190 */ 149 191 public function test_get_error_code_with_multiple_errors_should_return_only_the_first_error_code() { 150 192 $this->wp_error->add( 'code', 'message' ); … … 154 196 } 155 197 156 198 /** 157 * @covers ::get_error_messages199 * @covers WP_Error::get_error_messages 158 200 */ 159 201 public function test_get_error_messages_with_empty_code_and_no_errors_should_return_an_empty_array() { 160 202 $this->assertEmpty( $this->wp_error->get_error_messages() ); … … 161 203 } 162 204 163 205 /** 164 * @covers ::get_error_messages206 * @covers WP_Error::get_error_messages 165 207 */ 166 208 public function test_get_error_messages_with_empty_code_one_error_should_return_an_array_with_that_message() { 167 209 $this->wp_error->add( 'code', 'message' ); … … 170 212 } 171 213 172 214 /** 173 * @covers ::get_error_messages215 * @covers WP_Error::get_error_messages 174 216 */ 175 217 public function test_get_error_messages_with_empty_code_multiple_errors_should_return_an_array_of_messages() { 176 218 $this->wp_error->add( 'code', 'message' ); … … 180 222 } 181 223 182 224 /** 183 * @covers ::get_error_messages225 * @covers WP_Error::get_error_messages 184 226 */ 185 227 public function test_get_error_messages_with_an_invalid_code_should_return_an_empty_array() { 186 228 $this->assertEmpty( $this->wp_error->get_error_messages( 'code' ) ); … … 187 229 } 188 230 189 231 /** 190 * @covers ::get_error_messages232 * @covers WP_Error::get_error_messages 191 233 */ 192 234 public function test_get_error_messages_with_one_error_should_return_an_array_with_that_message() { 193 235 $this->wp_error->add( 'code', 'message' ); … … 196 238 } 197 239 198 240 /** 199 * @covers ::get_error_messages241 * @covers WP_Error::get_error_messages 200 242 */ 201 243 public function test_get_error_messages_with_multiple_errors_same_code_should_return_an_array_with_all_messages() { 202 244 $this->wp_error->add( 'code', 'message' ); … … 206 248 } 207 249 208 250 /** 209 * @covers ::get_error_message251 * @covers WP_Error::get_error_message 210 252 */ 211 253 public function test_get_error_message_with_empty_code_and_no_errors_should_return_an_empty_string() { 212 254 $this->assertSame( '', $this->wp_error->get_error_message() ); … … 213 255 } 214 256 215 257 /** 216 * @covers ::get_error_message258 * @covers WP_Error::get_error_message 217 259 */ 218 260 public function test_get_error_message_with_empty_code_and_one_error_should_return_that_message() { 219 261 $this->wp_error->add( 'code', 'message' ); … … 222 264 } 223 265 224 266 /** 225 * @covers ::get_error_message267 * @covers WP_Error::get_error_message 226 268 */ 227 269 public function test_get_error_message_with_empty_code_and_multiple_errors_should_return_the_first_message() { 228 270 $this->wp_error->add( 'code', 'message' ); … … 232 274 } 233 275 234 276 /** 235 * @covers ::get_error_message277 * @covers WP_Error::get_error_message 236 278 */ 237 279 public function test_get_error_message_with_empty_code_and_multiple_errors_multiple_codes_should_return_the_first_message() { 238 280 $this->wp_error->add( 'code', 'message' ); … … 243 285 } 244 286 245 287 /** 246 * @covers ::get_error_message288 * @covers WP_Error::get_error_message 247 289 */ 248 290 public function test_get_error_message_with_invalid_code_and_no_errors_should_return_empty_string() { 249 291 $this->assertSame( '', $this->wp_error->get_error_message( 'invalid' ) ); … … 250 292 } 251 293 252 294 /** 253 * @covers ::get_error_message295 * @covers WP_Error::get_error_message 254 296 */ 255 297 public function test_get_error_message_with_invalid_code_and_one_error_should_return_an_empty_string() { 256 298 $this->wp_error->add( 'code', 'message' ); … … 259 301 } 260 302 261 303 /** 262 * @covers ::get_error_message304 * @covers WP_Error::get_error_message 263 305 */ 264 306 public function test_get_error_message_with_invalid_code_and_multiple_errors_should_return_an_empty_string() { 265 307 $this->wp_error->add( 'code', 'message' ); … … 269 311 } 270 312 271 313 /** 272 * @covers ::get_error_data314 * @covers WP_Error::get_error_data 273 315 */ 274 316 public function test_get_error_data_with_empty_code_and_no_errors_should_evaluate_as_null() { 275 317 $this->assertNull( $this->wp_error->get_error_data() ); … … 276 318 } 277 319 278 320 /** 279 * @covers ::get_error_data321 * @covers WP_Error::get_error_data 280 322 */ 281 323 public function test_get_error_data_with_empty_code_one_error_no_data_should_evaluate_as_null() { 282 324 $this->wp_error->add( 'code', 'message' ); … … 285 327 } 286 328 287 329 /** 288 * @covers ::get_error_data330 * @covers WP_Error::get_error_data 289 331 */ 290 332 public function test_get_error_data_with_empty_code_multiple_errors_no_data_should_evaluate_as_null() { 291 333 $this->wp_error->add( 'code', 'message' ); … … 295 337 } 296 338 297 339 /** 298 * @covers ::get_error_data340 * @covers WP_Error::get_error_data 299 341 */ 300 342 public function test_get_error_data_with_empty_code_and_one_error_with_data_should_return_that_data() { 301 343 $expected = array( 'data-key' => 'data-value' ); … … 305 347 } 306 348 307 349 /** 308 * @covers ::get_error_data350 * @covers WP_Error::get_error_data 309 351 */ 310 352 public function test_get_error_data_with_empty_code_and_multiple_errors_different_codes_should_return_the_last_data_of_the_first_code() { 311 353 $expected = array( 'data-key' => 'data-value' ); … … 316 358 } 317 359 318 360 /** 319 * @covers ::get_error_data361 * @covers WP_Error::get_error_data 320 362 */ 321 363 public function test_get_error_data_with_empty_code_and_multiple_errors_same_code_should_return_the_last_data_of_the_first_code() { 322 364 $this->wp_error->add( 'code', 'message', 'data' ); … … 327 369 } 328 370 329 371 /** 330 * @covers ::get_error_data372 * @covers WP_Error::get_error_data 331 373 */ 332 374 public function test_get_error_data_with_code_and_no_errors_should_evaluate_as_null() { 333 375 $this->assertNull( $this->wp_error->get_error_data( 'code' ) ); … … 334 376 } 335 377 336 378 /** 337 * @covers ::get_error_data379 * @covers WP_Error::get_error_data 338 380 */ 339 381 public function test_get_error_data_with_code_and_one_error_with_no_data_should_evaluate_as_null() { 340 382 $this->wp_error->add( 'code', 'message' ); … … 343 385 } 344 386 345 387 /** 346 * @covers ::get_error_data388 * @covers WP_Error::get_error_data 347 389 */ 348 390 public function test_get_error_data_with_code_and_one_error_with_data_should_return_that_data() { 349 391 $expected = array( 'data-key' => 'data-value' ); … … 353 395 } 354 396 355 397 /** 356 * @covers ::get_error_data398 * @covers WP_Error::get_error_data 357 399 */ 358 400 public function test_get_error_data_with_code_and_multiple_errors_different_codes_should_return_the_last_stored_data_of_the_code() { 359 401 $expected = array( 'data3' ); … … 365 407 } 366 408 367 409 /** 368 * @covers ::get_error_data410 * @covers WP_Error::get_error_data 369 411 */ 370 412 public function test_get_error_data_with_code_and_multiple_errors_same_code_should_return_the_last_stored_data() { 371 413 $this->wp_error->add( 'code', 'message', 'data' ); … … 376 418 } 377 419 378 420 /** 379 * @covers ::has_errors421 * @covers WP_Error::has_errors 380 422 */ 381 423 public function test_has_errors_with_no_errors_returns_false() { 382 424 $this->assertFalse( $this->wp_error->has_errors() ); … … 383 425 } 384 426 385 427 /** 386 * @covers ::has_errors428 * @covers WP_Error::has_errors 387 429 */ 388 430 public function test_has_errors_with_errors_returns_true() { 389 431 $this->wp_error->add( 'code', 'message', 'data' ); … … 391 433 } 392 434 393 435 /** 394 * @covers ::add436 * @covers WP_Error::add 395 437 */ 396 438 public function test_add_with_empty_code_empty_message_empty_data_should_add_empty_key_to_errors_array() { 397 439 $this->wp_error->add( '', '', 'data' );