Ticket #39265: p-folders.patch
File p-folders.patch, 133.7 KB (added by , 4 years ago) |
---|
-
tests/phpunit/tests/pomo/mo.php
5 5 */ 6 6 class Tests_POMO_MO extends WP_UnitTestCase { 7 7 8 /** 9 * @covers MO::headers 10 * @covers MO::import_from_file 11 */ 8 12 function test_mo_simple() { 9 13 $mo = new MO(); 10 14 $mo->import_from_file( DIR_TESTDATA . '/pomo/simple.mo' ); … … 20 24 $this->assertSame( array( 'yes' ), $mo->entries["kuku\nruku"]->translations ); 21 25 } 22 26 27 /** 28 * @covers MO::translate_plural 29 */ 23 30 function test_mo_plural() { 24 31 $mo = new MO(); 25 32 $mo->import_from_file( DIR_TESTDATA . '/pomo/plural.mo' ); … … 46 53 $this->assertSame( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) ); 47 54 } 48 55 56 /** 57 * @covers Translation_Entry::context 58 */ 49 59 function test_mo_context() { 50 60 $mo = new MO(); 51 61 $mo->import_from_file( DIR_TESTDATA . '/pomo/context.mo' ); … … 73 83 74 84 } 75 85 86 /** 87 * @covers Translation_Entry::merge_with 88 */ 76 89 function test_translations_merge() { 77 90 $host = new Translations(); 78 91 $host->add_entry( new Translation_Entry( array( 'singular' => 'pink' ) ) ); … … 85 98 $this->assertSame( array(), array_diff( array( 'pink', 'green', 'red' ), array_keys( $host->entries ) ) ); 86 99 } 87 100 101 /** 102 * @covers MO::export_to_file 103 */ 88 104 function test_export_mo_file() { 89 105 $entries = array(); 90 106 $entries[] = new Translation_Entry( … … 143 159 } 144 160 } 145 161 162 /** 163 * @covers MO::export_to_file 164 */ 146 165 function test_export_should_not_include_empty_translations() { 147 166 $entries = array(); 148 167 $mo = new MO; … … 162 181 $this->assertSame( 0, count( $again->entries ) ); 163 182 } 164 183 184 /** 185 * @covers MO::translate_plural 186 */ 165 187 function test_nplurals_with_backslashn() { 166 188 $mo = new MO(); 167 189 $mo->import_from_file( DIR_TESTDATA . '/pomo/bad_nplurals.mo' ); … … 170 192 $this->assertSame( '%d foros', $mo->translate_plural( '%d forum', '%d forums', -1 ) ); 171 193 } 172 194 195 /** 196 * @covers MO::import_from_file 197 */ 173 198 function disabled_test_performance() { 174 199 $start = microtime( true ); 175 200 $mo = new MO(); … … 177 202 // echo "\nPerformance: ".(microtime(true) - $start)."\n"; 178 203 } 179 204 205 /** 206 * @covers Translation_Entry::translations 207 */ 180 208 function test_overloaded_mb_functions() { 181 209 if ( ( ini_get( 'mbstring.func_overload' ) & 2 ) === 0 ) { 182 210 $this->markTestSkipped( __METHOD__ . ' only runs when mbstring.func_overload is enabled.' ); … … 187 215 $this->assertSame( array( 'Табло' ), $mo->entries['Dashboard']->translations ); 188 216 } 189 217 218 /** 219 * @covers MO::import_from_file 220 */ 190 221 function test_load_pot_file() { 191 222 $mo = new MO(); 192 223 $this->assertFalse( $mo->import_from_file( DIR_TESTDATA . '/pomo/mo.pot' ) ); -
tests/phpunit/tests/pomo/noopTranslations.php
17 17 ); 18 18 } 19 19 20 /** 21 * @covers NOOP_Translations::get_header 22 */ 20 23 function test_get_header() { 21 24 $this->assertFalse( $this->noop->get_header( 'Content-Type' ) ); 22 25 } 23 26 27 /** 28 * @covers NOOP_Translations::add_entry 29 */ 24 30 function test_add_entry() { 25 31 $this->noop->add_entry( $this->entry ); 26 32 $this->assertSame( array(), $this->noop->entries ); 27 33 } 28 34 35 /** 36 * @covers NOOP_Translations::set_header 37 */ 29 38 function test_set_header() { 30 39 $this->noop->set_header( 'header', 'value' ); 31 40 $this->assertSame( array(), $this->noop->headers ); 32 41 } 33 42 43 /** 44 * @covers NOOP_Translations::translate_entry 45 */ 34 46 function test_translate_entry() { 35 47 $this->noop->add_entry( $this->entry ); 36 48 $this->assertFalse( $this->noop->translate_entry( $this->entry ) ); 37 49 } 38 50 51 /** 52 * @covers NOOP_Translations::translate 53 */ 39 54 function test_translate() { 40 55 $this->noop->add_entry( $this->entry ); 41 56 $this->assertSame( 'baba', $this->noop->translate( 'baba' ) ); 42 57 } 43 58 59 /** 60 * @covers NOOP_Translations::translate_plural 61 */ 44 62 function test_plural() { 45 63 $this->noop->add_entry( $this->plural_entry ); 46 64 $this->assertSame( 'dyado', $this->noop->translate_plural( 'dyado', 'dyados', 1 ) ); -
tests/phpunit/tests/pomo/pluralForms.php
40 40 /** 41 41 * @ticket 41562 42 42 * @group external-http 43 * 44 * @covers GP_Locales::locales 43 45 */ 44 46 public function test_locales_provider() { 45 47 $locales = self::locales_provider(); … … 72 74 * @ticket 41562 73 75 * @dataProvider locales_provider 74 76 * @group external-http 77 * 78 * @covers Plural_Forms::__construct 75 79 */ 76 80 public function test_regression( $lang, $nplurals, $expression ) { 77 81 require_once dirname( dirname( __DIR__ ) ) . '/includes/plural-form-function.php'; … … 145 149 /** 146 150 * @ticket 41562 147 151 * @dataProvider simple_provider 152 * 153 * @covers Plural_Forms::__construct 148 154 */ 149 155 public function test_simple( $expression, $expected ) { 150 156 $plural_forms = new Plural_Forms( $expression ); … … 201 207 * 202 208 * @ticket 41562 203 209 * @dataProvider data_exceptions 210 * 211 * @covers Plural_Forms::__construct 204 212 */ 205 213 public function test_exceptions( $expression, $expected_message, $call_get ) { 206 214 $this->expectException( 'Exception' ); -
tests/phpunit/tests/pomo/po.php
41 41 $this->po_a90 = "\"$this->a90\""; 42 42 } 43 43 44 /** 45 * @covers PO::prepend_each_line 46 */ 44 47 function test_prepend_each_line() { 45 48 $po = new PO(); 46 49 $this->assertSame( 'baba_', $po->prepend_each_line( '', 'baba_' ) ); … … 48 51 $this->assertSame( "# baba\n# dyado\n# \n", $po->prepend_each_line( "baba\ndyado\n\n", '# ' ) ); 49 52 } 50 53 54 /** 55 * @covers PO::poify 56 */ 51 57 function test_poify() { 52 58 $po = new PO(); 53 59 // Simple. … … 67 73 $this->assertSameIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) ); 68 74 } 69 75 76 /** 77 * @covers PO::unpoify 78 */ 70 79 function test_unpoify() { 71 80 $po = new PO(); 72 81 $this->assertSame( 'baba', $po->unpoify( '"baba"' ) ); … … 78 87 $this->assertSameIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) ); 79 88 } 80 89 90 /** 91 * @covers PO::export_entry 92 */ 81 93 function test_export_entry() { 82 94 $po = new PO(); 83 95 $entry = new Translation_Entry( array( 'singular' => 'baba' ) ); … … 203 215 ); 204 216 } 205 217 218 /** 219 * @covers PO::export_entries 220 */ 206 221 function test_export_entries() { 207 222 $entry = new Translation_Entry( array( 'singular' => 'baba' ) ); 208 223 $entry2 = new Translation_Entry( array( 'singular' => 'dyado' ) ); … … 212 227 $this->assertSame( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export_entries() ); 213 228 } 214 229 230 /** 231 * @covers PO::export_headers 232 */ 215 233 function test_export_headers() { 216 234 $po = new PO(); 217 235 $po->set_header( 'Project-Id-Version', 'WordPress 2.6-bleeding' ); … … 219 237 $this->assertSame( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"", $po->export_headers() ); 220 238 } 221 239 240 /** 241 * @covers PO::export 242 */ 222 243 function test_export() { 223 244 $po = new PO(); 224 245 $entry = new Translation_Entry( array( 'singular' => 'baba' ) ); … … 232 253 } 233 254 234 255 256 /** 257 * @covers PO::export_to_file 258 */ 235 259 function test_export_to_file() { 236 260 $po = new PO(); 237 261 $entry = new Translation_Entry( array( 'singular' => 'baba' ) ); … … 250 274 $this->assertSame( $po->export(), file_get_contents( $temp_fn2 ) ); 251 275 } 252 276 277 /** 278 * @covers PO::import_from_file 279 */ 253 280 function test_import_from_file() { 254 281 $po = new PO(); 255 282 $res = $po->import_from_file( DIR_TESTDATA . '/pomo/simple.po' ); … … 309 336 $this->assertEquals( $end_quote_entry, $po->entries[ $end_quote_entry->key() ] ); 310 337 } 311 338 339 /** 340 * @covers PO::import_from_file 341 */ 312 342 function test_import_from_entry_file_should_give_false() { 313 343 $po = new PO(); 314 344 $this->assertFalse( $po->import_from_file( DIR_TESTDATA . '/pomo/empty.po' ) ); 315 345 } 316 346 347 /** 348 * @covers PO::import_from_file 349 */ 317 350 function test_import_from_file_with_windows_line_endings_should_work_as_with_unix_line_endings() { 318 351 $po = new PO(); 319 352 $this->assertTrue( $po->import_from_file( DIR_TESTDATA . '/pomo/windows-line-endings.po' ) ); -
tests/phpunit/tests/pomo/translationEntry.php
5 5 */ 6 6 class Tests_POMO_TranslationEntry extends WP_UnitTestCase { 7 7 8 /** 9 * @covers Translation_Entry::singular 10 * @covers Translation_Entry::plural 11 * @covers Translation_Entry::is_plural 12 * @covers Translation_Entry::translations 13 * @covers Translation_Entry::references 14 * @covers Translation_Entry::flags 15 */ 8 16 function test_create_entry() { 9 17 // No singular => empty object. 10 18 $entry = new Translation_Entry(); … … 29 37 $this->assertSame( array(), $entry->flags ); 30 38 } 31 39 40 /** 41 * @covers Translation_Entry::key 42 */ 32 43 function test_key() { 33 44 $entry_baba = new Translation_Entry( array( 'singular' => 'baba' ) ); 34 45 $entry_dyado = new Translation_Entry( array( 'singular' => 'dyado' ) ); -
tests/phpunit/tests/pomo/translations.php
5 5 */ 6 6 class Tests_POMO_Translations extends WP_UnitTestCase { 7 7 8 /** 9 * @covers Translation_Entry::add_entry 10 */ 8 11 function test_add_entry() { 9 12 $entry = new Translation_Entry( array( 'singular' => 'baba' ) ); 10 13 $entry2 = new Translation_Entry( array( 'singular' => 'dyado' ) ); … … 42 45 $this->assertSame( $entry->key(), $entries[0]->key() ); 43 46 } 44 47 48 /** 49 * @covers Translation_Entry::translate 50 */ 45 51 function test_translate() { 46 52 $entry1 = new Translation_Entry( 47 53 array( … … 65 71 $this->assertSame( 'babaz', $domain->translate( 'babaz' ) ); 66 72 } 67 73 74 /** 75 * @covers Translation_Entry::translate_plural 76 */ 68 77 function test_translate_plural() { 69 78 $entry_incomplete = new Translation_Entry( 70 79 array( … … 105 114 $this->assertSame( 'dyadoy', $domain->translate_plural( 'dyado', 'dyados', -18881 ) ); 106 115 } 107 116 117 /** 118 * @covers Translation_Entry::translate 119 * @covers Translation_Entry::merge_with 120 */ 108 121 function test_digit_and_merge() { 109 122 $entry_digit_1 = new Translation_Entry( 110 123 array( -
tests/phpunit/tests/post/attachments.php
13 13 parent::tearDown(); 14 14 } 15 15 16 /** 17 * @covers ::wp_upload_bits 18 */ 16 19 function test_insert_bogus_image() { 17 20 $filename = rand_str() . '.jpg'; 18 21 $contents = rand_str(); … … 21 24 $this->assertTrue( empty( $upload['error'] ) ); 22 25 } 23 26 27 /** 28 * @covers ::wp_insert_attachment 29 */ 24 30 function test_insert_image_no_thumb() { 25 31 26 32 // This image is smaller than the thumbnail size so it won't have one. … … 56 62 57 63 /** 58 64 * @requires function imagejpeg 65 * 66 * @covers ::wp_insert_attachment 59 67 */ 60 68 function test_insert_image_thumb_only() { 61 69 update_option( 'medium_size_w', 0 ); … … 107 115 108 116 /** 109 117 * @requires function imagejpeg 118 * 119 * @covers ::wp_insert_attachment 110 120 */ 111 121 function test_insert_image_medium_sizes() { 112 122 update_option( 'medium_size_w', 400 ); … … 164 174 165 175 /** 166 176 * @requires function imagejpeg 177 * 178 * @covers ::wp_insert_attachment 167 179 */ 168 180 function test_insert_image_delete() { 169 181 update_option( 'medium_size_w', 400 ); … … 212 224 * 213 225 * @ticket 18310 214 226 * @ticket 21963 227 * 228 * @covers ::wp_insert_attachment 215 229 */ 216 230 function test_insert_image_without_guid() { 217 231 // This image is smaller than the thumbnail size so it won't have one. … … 256 270 257 271 /** 258 272 * @ticket 29646 273 * 274 * @covers ::wp_insert_attachment 259 275 */ 260 276 function test_update_orphan_attachment_parent() { 261 277 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); … … 285 301 286 302 /** 287 303 * @ticket 15928 304 * 305 * @covers ::wp_get_attachment_url 288 306 */ 289 307 public function test_wp_get_attachment_url_should_not_force_https_when_current_page_is_non_ssl_and_siteurl_is_non_ssl() { 290 308 $siteurl = get_option( 'siteurl' ); … … 310 328 * @ticket 15928 311 329 * 312 330 * This situation (current request is non-SSL but siteurl is https) should never arise. 331 * 332 * @covers ::wp_get_attachment_url 313 333 */ 314 334 public function test_wp_get_attachment_url_should_not_force_https_when_current_page_is_non_ssl_and_siteurl_is_ssl() { 315 335 $siteurl = get_option( 'siteurl' ); … … 335 355 * @ticket 15928 336 356 * 337 357 * Canonical siteurl is non-SSL, but SSL support is available/optional. 358 * 359 * @covers ::wp_get_attachment_url 338 360 */ 339 361 public function test_wp_get_attachment_url_should_force_https_with_https_on_same_host_when_siteurl_is_non_ssl_but_ssl_is_available() { 340 362 $siteurl = get_option( 'siteurl' ); … … 363 385 364 386 /** 365 387 * @ticket 15928 388 * 389 * @covers ::wp_get_attachment_url 366 390 */ 367 391 public function test_wp_get_attachment_url_with_https_on_same_host_when_siteurl_is_https() { 368 392 $siteurl = get_option( 'siteurl' ); … … 391 415 392 416 /** 393 417 * @ticket 15928 418 * 419 * @covers ::wp_get_attachment_url 394 420 */ 395 421 public function test_wp_get_attachment_url_should_not_force_https_when_administering_over_https_but_siteurl_is_not_https() { 396 422 $siteurl = get_option( 'siteurl' ); … … 418 444 419 445 /** 420 446 * @ticket 15928 447 * 448 * @covers ::wp_get_attachment_url 421 449 */ 422 450 public function test_wp_get_attachment_url_should_force_https_when_administering_over_https_and_siteurl_is_https() { 423 451 // Set https upload URL. … … 444 472 $this->assertSame( 'https', parse_url( $url, PHP_URL_SCHEME ) ); 445 473 } 446 474 475 /** 476 * @covers ::wp_attachment_is_image 477 * @covers ::wp_attachment_is 478 */ 447 479 public function test_wp_attachment_is() { 448 480 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 449 481 $contents = file_get_contents( $filename ); … … 479 511 } 480 512 } 481 513 514 /** 515 * @covers ::wp_upload_bits 516 */ 482 517 public function test_upload_mimes_filter_is_applied() { 483 518 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 484 519 $contents = file_get_contents( $filename ); … … 508 543 509 544 /** 510 545 * @ticket 33012 546 * 547 * @covers ::wp_mime_type_icon 511 548 */ 512 549 public function test_wp_mime_type_icon() { 513 550 $icon = wp_mime_type_icon(); … … 517 554 518 555 /** 519 556 * @ticket 33012 557 * 558 * @covers ::wp_mime_type_icon 520 559 */ 521 560 public function test_wp_mime_type_icon_video() { 522 561 $icon = wp_mime_type_icon( 'video/mp4' ); -
tests/phpunit/tests/post/bodyClass.php
12 12 $this->post_id = self::factory()->post->create(); 13 13 } 14 14 15 /** 16 * @covers ::get_body_class 17 */ 15 18 public function test_body_class() { 16 19 $expected = 'class="' . implode( ' ', get_body_class( '', $this->post_id ) ) . '"'; 17 20 $this->expectOutputString( $expected ); … … 18 21 body_class( '', $this->post_id ); 19 22 } 20 23 24 /** 25 * @covers ::get_body_class 26 */ 21 27 public function test_body_class_extra_esc_attr() { 22 28 $classes = get_body_class( '', $this->post_id ); 23 29 $escaped_again = array_map( 'esc_attr', $classes ); -
tests/phpunit/tests/post/filtering.php
22 22 parent::tearDown(); 23 23 } 24 24 25 // A simple test to make sure unclosed tags are fixed. 25 /** 26 * A simple test to make sure unclosed tags are fixed. 27 * 28 * @covers ::wp_insert_post 29 */ 26 30 function test_post_content_unknown_tag() { 27 31 28 32 $content = <<<EOF … … 39 43 $this->assertSame( $expected, $post->post_content ); 40 44 } 41 45 42 // A simple test to make sure unbalanced tags are fixed. 46 /** 47 * A simple test to make sure unbalanced tags are fixed. 48 * 49 * @covers ::wp_insert_post 50 */ 43 51 function test_post_content_unbalanced_tag() { 44 52 45 53 $content = <<<EOF … … 56 64 $this->assertSame( $expected, $post->post_content ); 57 65 } 58 66 59 // Test KSES filtering of disallowed attribute. 67 /** 68 * Test KSES filtering of disallowed attribute. 69 * 70 * @covers ::wp_insert_post 71 */ 72 60 73 function test_post_content_disallowed_attr() { 61 74 62 75 $content = <<<EOF … … 77 90 * test kses bug. xhtml does not require space before closing empty element 78 91 * 79 92 * @ticket 12394 93 * 94 * @covers ::wp_insert_post 80 95 */ 81 96 function test_post_content_xhtml_empty_elem() { 82 97 $content = <<<EOF … … 93 108 $this->assertSame( $expected, $post->post_content ); 94 109 } 95 110 96 // Make sure unbalanced tags are untouched when the balance option is off. 111 // 112 113 /** 114 * Make sure unbalanced tags are untouched when the balance option is off. 115 * 116 * 117 * @covers ::wp_insert_post 118 */ 97 119 function test_post_content_nobalance_nextpage_more() { 98 120 99 121 update_option( 'use_balanceTags', 0 ); -
tests/phpunit/tests/post/formats.php
8 8 parent::setUp(); 9 9 } 10 10 11 /** 12 * @covers ::get_post_format 13 */ 11 14 function test_set_get_post_format_for_post() { 12 15 $post_id = self::factory()->post->create(); 13 16 … … 35 38 36 39 /** 37 40 * @ticket 22473 41 * 42 * @covers ::get_post_format 38 43 */ 39 44 function test_set_get_post_format_for_page() { 40 45 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); … … 68 73 remove_post_type_support( 'page', 'post-formats' ); 69 74 } 70 75 76 /** 77 * @covers ::has_post_format 78 */ 71 79 function test_has_format() { 72 80 $post_id = self::factory()->post->create(); 73 81 … … 96 104 97 105 /** 98 106 * @ticket 23570 107 * 108 * @covers ::get_url_in_content 99 109 */ 100 110 function test_get_url_in_content() { 101 111 $link = 'http://nytimes.com'; -
tests/phpunit/tests/post/getBodyClass.php
14 14 15 15 /** 16 16 * @ticket 30883 17 * 18 * @covers ::get_body_class 17 19 */ 18 20 public function test_with_utf8_category_slugs() { 19 21 $cat_id1 = self::factory()->category->create( array( 'name' => 'Первая рубрика' ) ); -
tests/phpunit/tests/post/getLastPostDate.php
7 7 8 8 /** 9 9 * @ticket 47777 10 * 11 * @covers ::get_lastpostdate 10 12 */ 11 13 public function test_get_lastpostdate() { 12 14 $post_post_date_first = '2020-01-30 16:09:28'; -
tests/phpunit/tests/post/getLastPostModified.php
7 7 8 8 /** 9 9 * @ticket 47777 10 * 11 * @covers ::get_lastpostmodified 10 12 */ 11 13 public function test_get_lastpostmodified() { 12 14 global $wpdb; -
tests/phpunit/tests/post/getPageByPath.php
6 6 class Tests_Post_GetPageByPath extends WP_UnitTestCase { 7 7 /** 8 8 * @ticket 15665 9 * 10 * @covers ::get_page_by_path 9 11 */ 10 12 public function test_get_page_by_path_priority() { 11 13 global $wpdb; … … 44 46 $this->assertEquals( $other_att, get_page_by_path( 'some-other-page' ) ); 45 47 } 46 48 49 /** 50 * @covers ::get_page_by_path 51 */ 47 52 public function test_should_match_top_level_page() { 48 53 $page = self::factory()->post->create( 49 54 array( … … 57 62 $this->assertSame( $page, $found->ID ); 58 63 } 59 64 65 /** 66 * @covers ::get_page_by_path 67 */ 60 68 public function test_should_obey_post_type() { 61 69 register_post_type( 'wptests_pt' ); 62 70 … … 74 82 $this->assertSame( $page, $found->ID ); 75 83 } 76 84 85 /** 86 * @covers ::get_page_by_path 87 */ 77 88 public function test_should_match_nested_page() { 78 89 $p1 = self::factory()->post->create( 79 90 array( … … 103 114 $this->assertSame( $p3, $found->ID ); 104 115 } 105 116 117 /** 118 * @covers ::get_page_by_path 119 */ 106 120 public function test_should_not_make_partial_match() { 107 121 $p1 = self::factory()->post->create( 108 122 array( … … 132 146 $this->assertNull( $found ); 133 147 } 134 148 149 /** 150 * @covers ::get_page_by_path 151 */ 135 152 public function test_should_not_match_parts_out_of_order() { 136 153 $p1 = self::factory()->post->create( 137 154 array( … … 163 180 164 181 /** 165 182 * @ticket 36711 183 * 184 * @covers ::get_page_by_path 166 185 */ 167 186 public function test_should_hit_cache() { 168 187 global $wpdb; … … 187 206 188 207 /** 189 208 * @ticket 36711 209 * 210 * @covers ::get_page_by_path 190 211 */ 191 212 public function test_bad_path_should_be_cached() { 192 213 global $wpdb; … … 204 225 205 226 /** 206 227 * @ticket 36711 228 * 229 * @covers ::get_page_by_path 207 230 */ 208 231 public function test_bad_path_served_from_cache_should_not_fall_back_on_current_post() { 209 232 global $wpdb, $post; … … 226 249 227 250 /** 228 251 * @ticket 36711 252 * 253 * @covers ::get_page_by_path 229 254 */ 230 255 public function test_cache_should_not_match_post_in_different_post_type_with_same_path() { 231 256 global $wpdb; … … 260 285 261 286 /** 262 287 * @ticket 36711 288 * 289 * @covers ::get_page_by_path 263 290 */ 264 291 public function test_cache_should_be_invalidated_when_post_name_is_edited() { 265 292 global $wpdb; … … 292 319 293 320 /** 294 321 * @ticket 37611 322 * 323 * @covers ::get_page_by_path 295 324 */ 296 325 public function test_output_param_should_be_obeyed_for_cached_value() { 297 326 $page = self::factory()->post->create( -
tests/phpunit/tests/post/getPageChildren.php
65 65 ); 66 66 } 67 67 68 /** 69 * @covers ::get_page_children 70 */ 68 71 public function test_page_id_0_should_return_all_pages_in_tree_and_exclude_pages_not_in_tree() { 69 72 $expected = array( 100, 101, 102, 103, 105, 106, 107, 108 ); 70 73 $actual = get_page_children( 0, $this->pages ); … … 71 74 $this->assertSameSets( $expected, wp_list_pluck( $actual, 'ID' ) ); 72 75 } 73 76 77 /** 78 * @covers ::get_page_children 79 */ 74 80 public function test_hierarchical_order_should_be_respected_in_results() { 75 81 $expected = array( 100, 101, 103, 102, 106, 107, 108, 105 ); 76 82 $actual = get_page_children( 0, $this->pages ); … … 77 83 $this->assertSame( $expected, wp_list_pluck( $actual, 'ID' ) ); 78 84 } 79 85 86 /** 87 * @covers ::get_page_children 88 */ 80 89 public function test_not_all_pages_should_be_returned_when_page_id_is_in_the_middle_of_the_tree() { 81 90 $expected = array( 106, 107, 108 ); 82 91 $actual = get_page_children( 102, $this->pages ); … … 83 92 $this->assertSame( $expected, wp_list_pluck( $actual, 'ID' ) ); 84 93 } 85 94 95 /** 96 * @covers ::get_page_children 97 */ 86 98 public function test_page_id_that_is_a_leaf_should_return_empty_array() { 87 99 $actual = get_page_children( 103, $this->pages ); 88 100 $this->assertSame( array(), $actual ); 89 101 } 90 102 103 /** 104 * @covers ::get_page_children 105 */ 91 106 public function test_nonzero_page_id_not_matching_any_actual_post_id_should_return_empty_array() { 92 107 $actual = get_page_children( 200, $this->pages ); 93 108 $this->assertSame( array(), $actual ); -
tests/phpunit/tests/post/getPages.php
11 11 12 12 /** 13 13 * @ticket 23167 14 * 15 * @covers ::get_pages 14 16 */ 15 17 function test_get_pages_cache() { 16 18 global $wpdb; … … 105 107 106 108 /** 107 109 * @ticket 40669 110 * 111 * @covers ::get_pages 108 112 */ 109 113 public function test_cache_should_be_invalidated_by_add_post_meta() { 110 114 $posts = self::factory()->post->create_many( … … 141 145 142 146 /** 143 147 * @ticket 40669 148 * 149 * @covers ::get_pages 144 150 */ 145 151 public function test_cache_should_be_invalidated_by_update_post_meta() { 146 152 $posts = self::factory()->post->create_many( … … 178 184 179 185 /** 180 186 * @ticket 40669 187 * 188 * @covers ::get_pages 181 189 */ 182 190 public function test_cache_should_be_invalidated_by_delete_post_meta() { 183 191 $posts = self::factory()->post->create_many( … … 215 223 216 224 /** 217 225 * @ticket 40669 226 * 227 * @covers ::get_pages 218 228 */ 219 229 public function test_cache_should_be_invalidated_by_delete_post_meta_by_key() { 220 230 $posts = self::factory()->post->create_many( … … 252 262 253 263 /** 254 264 * @ticket 20376 265 * 266 * @covers ::get_pages 255 267 */ 256 268 function test_get_pages_meta() { 257 269 $posts = self::factory()->post->create_many( 3, array( 'post_type' => 'page' ) ); … … 286 298 287 299 /** 288 300 * @ticket 22074 301 * 302 * @covers ::get_pages 289 303 */ 290 304 function test_get_pages_include_exclude() { 291 305 $page_ids = array(); … … 312 326 313 327 /** 314 328 * @ticket 9470 329 * 330 * @covers ::get_pages 315 331 */ 316 332 function test_get_pages_parent() { 317 333 $page_id1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); … … 370 386 371 387 /** 372 388 * @ticket 22389 389 * 390 * @covers ::get_pages 373 391 */ 374 392 function test_wp_dropdown_pages() { 375 393 self::factory()->post->create_many( 5, array( 'post_type' => 'page' ) ); … … 381 399 382 400 /** 383 401 * @ticket 22208 402 * 403 * @covers ::get_pages 384 404 */ 385 405 function test_get_chidren_fields_ids() { 386 406 $post_id = self::factory()->post->create(); … … 397 417 398 418 /** 399 419 * @ticket 25750 420 * 421 * @covers ::get_pages 400 422 */ 401 423 function test_get_pages_hierarchical_and_no_parent() { 402 424 global $wpdb; … … 447 469 448 470 /** 449 471 * @ticket 18701 472 * 473 * @covers ::get_pages 450 474 */ 451 475 public function test_get_pages_hierarchical_empty_child_of() { 452 476 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); … … 493 517 494 518 /** 495 519 * @ticket 18701 520 * 521 * @covers ::get_pages 496 522 */ 497 523 public function test_get_pages_non_hierarchical_empty_child_of() { 498 524 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); … … 529 555 530 556 /** 531 557 * @ticket 18701 558 * 559 * @covers ::get_pages 532 560 */ 533 561 public function test_get_pages_hierarchical_non_empty_child_of() { 534 562 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); … … 572 600 573 601 /** 574 602 * @ticket 18701 603 * 604 * @covers ::get_pages 575 605 */ 576 606 public function test_get_pages_non_hierarchical_non_empty_child_of() { 577 607 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); … … 622 652 623 653 } 624 654 655 /** 656 * @covers ::wp_list_pages 657 */ 625 658 function test_wp_list_pages_classes() { 626 659 $type = 'taco'; 627 660 register_post_type( … … 655 688 _unregister_post_type( $type ); 656 689 } 657 690 691 /** 692 * @covers ::get_pages 693 */ 658 694 function test_exclude_tree() { 659 695 $post_id1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 660 696 $post_id2 = self::factory()->post->create( … … 704 740 705 741 /** 706 742 * @ticket 43514 743 * 744 * @covers ::get_pages 707 745 */ 708 746 function test_get_pages_cache_empty() { 709 747 global $wpdb; -
tests/phpunit/tests/post/getPageUri.php
7 7 8 8 /** 9 9 * @ticket 22883 10 * 11 * @covers ::get_page_uri 10 12 */ 11 13 function test_get_page_uri_with_stdclass_post_object() { 12 14 $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) ); … … 21 23 22 24 /** 23 25 * @ticket 24491 26 * 27 * @covers ::get_page_uri 24 28 */ 25 29 function test_get_page_uri_with_nonexistent_post() { 26 30 global $wpdb; … … 30 34 31 35 /** 32 36 * @ticket 15963 37 * 38 * @covers ::get_page_uri 33 39 */ 34 40 function test_get_post_uri_check_orphan() { 35 41 $parent_id = self::factory()->post->create( array( 'post_name' => 'parent' ) ); … … 53 59 54 60 /** 55 61 * @ticket 36174 62 * 63 * @covers ::get_page_uri 56 64 */ 57 65 function test_get_page_uri_with_a_draft_parent_with_empty_slug() { 58 66 $parent_id = self::factory()->post->create( array( 'post_name' => 'parent' ) ); … … 76 84 77 85 /** 78 86 * @ticket 26284 87 * 88 * @covers ::get_page_uri 79 89 */ 80 90 function test_get_page_uri_without_argument() { 81 91 $post_id = self::factory()->post->create( -
tests/phpunit/tests/post/getPostClass.php
12 12 $this->post_id = self::factory()->post->create(); 13 13 } 14 14 15 /** 16 * @covers ::get_post_class 17 */ 15 18 public function test_with_tags() { 16 19 wp_set_post_terms( $this->post_id, array( 'foo', 'bar' ), 'post_tag' ); 17 20 … … 21 24 $this->assertContains( 'tag-bar', $found ); 22 25 } 23 26 27 /** 28 * @covers ::get_post_class 29 */ 24 30 public function test_with_categories() { 25 31 $cats = self::factory()->category->create_many( 2 ); 26 32 wp_set_post_terms( $this->post_id, $cats, 'category' ); … … 34 40 $this->assertContains( 'category-' . $cat1->slug, $found ); 35 41 } 36 42 43 /** 44 * @covers ::get_post_class 45 */ 37 46 public function test_with_custom_taxonomy() { 38 47 register_taxonomy( 'wptests_tax', 'post' ); 39 48 wp_set_post_terms( $this->post_id, array( 'foo', 'bar' ), 'wptests_tax' ); … … 46 55 47 56 /** 48 57 * @ticket 22271 58 * 59 * @covers ::get_post_class 49 60 */ 50 61 public function test_with_custom_classes_and_no_post() { 51 62 $this->assertSame( array(), get_post_class( '', null ) ); … … 55 66 56 67 /** 57 68 * @ticket 30883 69 * 70 * @covers ::get_post_class 58 71 */ 59 72 public function test_with_utf8_category_slugs() { 60 73 $cat_id1 = self::factory()->category->create( array( 'name' => 'Первая рубрика' ) ); … … 71 84 72 85 /** 73 86 * @ticket 30883 87 * 88 * @covers ::get_post_class 74 89 */ 75 90 public function test_with_utf8_tag_slugs() { 76 91 $tag_id1 = self::factory()->tag->create( array( 'name' => 'Первая метка' ) ); … … 87 102 88 103 /** 89 104 * @ticket 30883 105 * 106 * @covers ::get_post_class 90 107 */ 91 108 public function test_with_utf8_term_slugs() { 92 109 register_taxonomy( 'wptests_tax', 'post' ); … … 119 136 120 137 /** 121 138 * @group cache 139 * 140 * @covers ::get_post_class 122 141 */ 123 142 public function test_taxonomy_classes_hit_cache() { 124 143 global $wpdb; -
tests/phpunit/tests/post/getPosts.php
5 5 * @group query 6 6 */ 7 7 class Tests_Post_GetPosts extends WP_UnitTestCase { 8 9 /** 10 * @covers ::get_posts 11 */ 8 12 public function test_offset_should_be_null_by_default() { 9 13 $p1 = self::factory()->post->create( 10 14 array( … … 29 33 $this->assertSame( array( $p1 ), $found ); 30 34 } 31 35 36 /** 37 * @covers ::get_posts 38 */ 32 39 public function test_offset_0_should_be_respected() { 33 40 $p1 = self::factory()->post->create( 34 41 array( … … 54 61 $this->assertSame( array( $p1 ), $found ); 55 62 } 56 63 64 /** 65 * @covers ::get_posts 66 */ 57 67 public function test_offset_non_0_should_be_respected() { 58 68 $p1 = self::factory()->post->create( 59 69 array( … … 81 91 82 92 /** 83 93 * @ticket 34060 94 * 95 * @covers ::get_posts 84 96 */ 85 97 public function test_paged_should_not_be_overridden_by_default_offset() { 86 98 $p1 = self::factory()->post->create( … … 107 119 $this->assertSame( array( $p2 ), $found ); 108 120 } 109 121 122 /** 123 * @covers ::get_posts 124 */ 110 125 public function test_explicit_offset_0_should_override_paged() { 111 126 $p1 = self::factory()->post->create( 112 127 array( … … 133 148 $this->assertSame( array( $p1 ), $found ); 134 149 } 135 150 151 /** 152 * @covers ::get_posts 153 */ 136 154 public function test_explicit_offset_non_0_should_override_paged() { 137 155 $p1 = self::factory()->post->create( 138 156 array( -
tests/phpunit/tests/post/getPostsByAuthorSql.php
5 5 */ 6 6 class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase { 7 7 8 /** 9 * @covers ::get_posts_by_author_sql 10 */ 8 11 public function test_post_type_post() { 9 12 $maybe_string = get_posts_by_author_sql( 'post' ); 10 13 $this->assertContains( "post_type = 'post'", $maybe_string ); 11 14 } 12 15 16 /** 17 * @covers ::get_posts_by_author_sql 18 */ 13 19 public function test_post_type_page() { 14 20 $maybe_string = get_posts_by_author_sql( 'page' ); 15 21 $this->assertContains( "post_type = 'page'", $maybe_string ); 16 22 } 17 23 24 /** 25 * @covers ::get_posts_by_author_sql 26 */ 18 27 public function test_non_existent_post_type() { 19 28 $maybe_string = get_posts_by_author_sql( 'non_existent_post_type' ); 20 29 $this->assertContains( '1 = 0', $maybe_string ); 21 30 } 22 31 32 /** 33 * @covers ::get_posts_by_author_sql 34 */ 23 35 public function test_multiple_post_types() { 24 36 register_post_type( 'foo' ); 25 37 register_post_type( 'bar' ); … … 32 44 _unregister_post_type( 'bar' ); 33 45 } 34 46 47 /** 48 * @covers ::get_posts_by_author_sql 49 */ 35 50 public function test_full_true() { 36 51 $maybe_string = get_posts_by_author_sql( 'post', true ); 37 52 $this->assertRegExp( '/^WHERE /', $maybe_string ); 38 53 } 39 54 55 /** 56 * @covers ::get_posts_by_author_sql 57 */ 40 58 public function test_full_false() { 41 59 $maybe_string = get_posts_by_author_sql( 'post', false ); 42 60 $this->assertNotRegExp( '/^WHERE /', $maybe_string ); 43 61 } 44 62 63 /** 64 * @covers ::get_posts_by_author_sql 65 */ 45 66 public function test_post_type_clause_should_be_included_when_full_is_true() { 46 67 $maybe_string = get_posts_by_author_sql( 'post', true ); 47 68 $this->assertContains( "post_type = 'post'", $maybe_string ); 48 69 } 49 70 71 /** 72 * @covers ::get_posts_by_author_sql 73 */ 50 74 public function test_post_type_clause_should_be_included_when_full_is_false() { 51 75 $maybe_string = get_posts_by_author_sql( 'post', false ); 52 76 $this->assertContains( "post_type = 'post'", $maybe_string ); 53 77 } 54 78 79 /** 80 * @covers ::get_posts_by_author_sql 81 */ 55 82 public function test_post_author_should_create_post_author_clause() { 56 83 $maybe_string = get_posts_by_author_sql( 'post', true, 1 ); 57 84 $this->assertContains( 'post_author = 1', $maybe_string ); 58 85 } 59 86 87 /** 88 * @covers ::get_posts_by_author_sql 89 */ 60 90 public function test_public_only_true_should_not_allow_any_private_posts_for_loggedin_user() { 61 91 $current_user = get_current_user_id(); 62 92 $u = self::factory()->user->create(); … … 68 98 wp_set_current_user( $current_user ); 69 99 } 70 100 101 /** 102 * @covers ::get_posts_by_author_sql 103 */ 71 104 public function test_public_only_should_default_to_false() { 72 105 $current_user = get_current_user_id(); 73 106 $u = self::factory()->user->create(); … … 78 111 wp_set_current_user( $current_user ); 79 112 } 80 113 114 /** 115 * @covers ::get_posts_by_author_sql 116 */ 81 117 public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_current_user_matches_post_author() { 82 118 $current_user = get_current_user_id(); 83 119 $u = self::factory()->user->create(); … … 89 125 wp_set_current_user( $current_user ); 90 126 } 91 127 128 /** 129 * @covers ::get_posts_by_author_sql 130 */ 92 131 public function test_public_only_false_should_not_allow_access_to_private_posts_if_current_user_is_not_post_author() { 93 132 $current_user = get_current_user_id(); 94 133 $u1 = self::factory()->user->create(); … … 101 140 wp_set_current_user( $current_user ); 102 141 } 103 142 143 /** 144 * @covers ::get_posts_by_author_sql 145 */ 104 146 public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_post_author_is_not_provided() { 105 147 $current_user = get_current_user_id(); 106 148 $u = self::factory()->user->create(); … … 113 155 wp_set_current_user( $current_user ); 114 156 } 115 157 158 /** 159 * @covers ::get_posts_by_author_sql 160 */ 116 161 public function test_administrator_should_have_access_to_private_posts_when_public_only_is_false() { 117 162 $current_user = get_current_user_id(); 118 163 $u = self::factory()->user->create( array( 'role' => 'administrator' ) ); … … 125 170 wp_set_current_user( $current_user ); 126 171 } 127 172 173 /** 174 * @covers ::get_posts_by_author_sql 175 */ 128 176 public function test_user_has_access_only_to_private_posts_for_certain_post_types() { 129 177 register_post_type( 'foo', array( 'capabilities' => array( 'read_private_posts' => 'read_private_foo' ) ) ); 130 178 register_post_type( 'bar', array( 'capabilities' => array( 'read_private_posts' => 'read_private_bar' ) ) ); -
tests/phpunit/tests/post/getPostTypeLabels.php
4 4 * @group post 5 5 */ 6 6 class Tests_Post_GetPostTypeLabels extends WP_UnitTestCase { 7 8 /** 9 * @covers ::get_post_type_labels 10 */ 7 11 public function test_returns_an_object() { 8 12 $this->assertInternalType( 9 13 'object', … … 17 21 ); 18 22 } 19 23 24 /** 25 * @covers ::get_post_type_labels 26 */ 20 27 public function test_returns_hierachical_labels() { 21 28 $labels = get_post_type_labels( 22 29 (object) array( … … 29 36 $this->assertSame( 'Pages', $labels->name ); 30 37 } 31 38 39 /** 40 * @covers ::get_post_type_labels 41 */ 32 42 public function test_existing_labels_are_not_overridden() { 33 43 $labels = get_post_type_labels( 34 44 (object) array( … … 43 53 $this->assertSame( 'Foo', $labels->singular_name ); 44 54 } 45 55 56 /** 57 * @covers ::get_post_type_labels 58 */ 46 59 public function test_name_admin_bar_label_should_fall_back_to_singular_name() { 47 60 $labels = get_post_type_labels( 48 61 (object) array( … … 58 71 } 59 72 60 73 74 /** 75 * @covers ::get_post_type_labels 76 */ 61 77 public function test_name_admin_bar_label_should_fall_back_to_post_type_name() { 62 78 $labels = get_post_type_labels( 63 79 (object) array( … … 70 86 $this->assertSame( 'bar', $labels->name_admin_bar ); 71 87 } 72 88 89 /** 90 * @covers ::get_post_type_labels 91 */ 73 92 public function test_menu_name_should_fall_back_to_name() { 74 93 $labels = get_post_type_labels( 75 94 (object) array( … … 84 103 $this->assertSame( 'Bar', $labels->menu_name ); 85 104 } 86 105 106 /** 107 * @covers ::get_post_type_labels 108 */ 87 109 public function test_labels_should_be_added_when_registering_a_post_type() { 88 110 $post_type_object = register_post_type( 89 111 'foo', … … 101 123 $this->assertObjectHasAttribute( 'not_found_in_trash', $post_type_object->labels ); 102 124 } 103 125 126 /** 127 * @covers ::get_post_type_labels 128 */ 104 129 public function test_label_should_be_derived_from_labels_when_registering_a_post_type() { 105 130 $post_type_object = register_post_type( 106 131 'foo', … … 118 143 119 144 /** 120 145 * @ticket 33543 146 * 147 * @covers ::get_post_type_labels 121 148 */ 122 149 public function test_should_fall_back_on_defaults_when_filtered_labels_do_not_contain_the_keys() { 123 150 add_filter( 'post_type_labels_foo', array( $this, 'filter_post_type_labels' ) ); -
tests/phpunit/tests/post/getTheContent.php
7 7 class Tests_Post_GetTheContent extends WP_UnitTestCase { 8 8 /** 9 9 * @ticket 42814 10 * 11 * @covers ::get_the_content 10 12 */ 11 13 public function test_argument_back_compat_more_link_text() { 12 14 $text = 'Foo<!--more-->Bar'; … … 24 26 25 27 /** 26 28 * @ticket 42814 29 * 30 * @covers ::get_the_content 27 31 */ 28 32 public function test_argument_back_compat_strip_teaser() { 29 33 $text = 'Foo<!--more-->Bar'; … … 43 47 44 48 /** 45 49 * @ticket 42814 50 * 51 * @covers ::get_the_content 46 52 */ 47 53 public function test_content_other_post() { 48 54 $text_1 = 'Foo<!--nextpage-->Bar<!--nextpage-->Baz'; … … 58 64 59 65 /** 60 66 * @ticket 42814 67 * 68 * @covers ::get_the_content 61 69 */ 62 70 public function test_should_respect_pagination_of_inner_post() { 63 71 $text_1 = 'Foo<!--nextpage-->Bar<!--nextpage-->Baz'; … … 78 86 79 87 /** 80 88 * @ticket 47824 89 * 90 * @covers ::get_the_content 81 91 */ 82 92 public function test_should_fall_back_to_post_global_outside_of_the_loop() { 83 93 $GLOBALS['post'] = self::factory()->post->create( array( 'post_content' => 'Foo' ) ); -
tests/phpunit/tests/post/getTheExcerpt.php
8 8 9 9 /** 10 10 * @ticket 27246 11 * 12 * @covers ::get_the_excerpt 11 13 */ 12 14 public function test_the_excerpt_invalid_post() { 13 15 $this->assertSame( '', get_echo( 'the_excerpt' ) ); … … 17 19 /** 18 20 * @ticket 27246 19 21 * @expectedDeprecated get_the_excerpt 22 * 23 * @covers ::get_the_excerpt 20 24 */ 21 25 public function test_the_excerpt_deprecated() { 22 26 $this->assertSame( '', get_the_excerpt( true ) ); … … 25 29 26 30 /** 27 31 * @ticket 27246 32 * 33 * @covers ::get_the_excerpt 28 34 */ 29 35 public function test_the_excerpt() { 30 36 $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Post excerpt' ) ); … … 35 41 /** 36 42 * @ticket 27246 37 43 * @ticket 35486 44 * 45 * @covers ::get_the_excerpt 38 46 */ 39 47 public function test_the_excerpt_password_protected_post() { 40 48 $post = self::factory()->post->create_and_get( … … 51 59 52 60 /** 53 61 * @ticket 27246 62 * 63 * @covers ::get_the_excerpt 54 64 */ 55 65 public function test_the_excerpt_specific_post() { 56 66 $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Foo' ) ); … … 60 70 61 71 /** 62 72 * @ticket 42814 73 * 74 * @covers ::get_the_excerpt 63 75 */ 64 76 public function test_should_fall_back_on_post_content_if_excerpt_is_empty_and_post_is_inferred_from_context() { 65 77 $post_id = self::factory()->post->create( … … 85 97 86 98 /** 87 99 * @ticket 42814 100 * 101 * @covers ::get_the_excerpt 88 102 */ 89 103 public function test_should_fall_back_on_post_content_if_excerpt_is_empty_and_post_is_provided() { 90 104 $GLOBALS['post'] = self::factory()->post->create_and_get( … … 98 112 99 113 /** 100 114 * @ticket 42814 115 * 116 * @covers ::get_the_excerpt 101 117 */ 102 118 public function test_should_respect_post_parameter_in_the_loop() { 103 119 $p1 = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Foo' ) ); … … 118 134 119 135 /** 120 136 * @ticket 42814 137 * 138 * @covers ::get_the_excerpt 121 139 */ 122 140 public function test_should_respect_post_parameter_in_the_loop_when_falling_back_on_post_content() { 123 141 $p1 = self::factory()->post->create_and_get( -
tests/phpunit/tests/post/isPostTypeViewable.php
4 4 * @group post 5 5 */ 6 6 class Tests_Post_IsPostTypeViewable extends WP_UnitTestCase { 7 8 /** 9 * @covers ::is_post_type_viewable 10 */ 7 11 public function test_should_return_false_for_non_publicly_queryable_types() { 8 12 register_post_type( 9 13 'wptests_pt', … … 19 23 $this->assertFalse( is_post_type_viewable( $pt ) ); 20 24 } 21 25 26 /** 27 * @covers ::is_post_type_viewable 28 */ 22 29 public function test_should_return_true_for_publicly_queryable_types() { 23 30 register_post_type( 24 31 'wptests_pt', … … 34 41 $this->assertTrue( is_post_type_viewable( $pt ) ); 35 42 } 36 43 44 /** 45 * @covers ::is_post_type_viewable 46 */ 37 47 public function test_should_return_false_for_builtin_nonpublic_types() { 38 48 register_post_type( 39 49 'wptests_pt', … … 49 59 $this->assertFalse( is_post_type_viewable( $pt ) ); 50 60 } 51 61 62 /** 63 * @covers ::is_post_type_viewable 64 */ 52 65 public function test_should_return_false_for_nonbuiltin_public_types() { 53 66 register_post_type( 54 67 'wptests_pt', … … 64 77 $this->assertFalse( is_post_type_viewable( $pt ) ); 65 78 } 66 79 80 /** 81 * @covers ::is_post_type_viewable 82 */ 67 83 public function test_should_return_true_for_builtin_public_types() { 68 84 register_post_type( 69 85 'wptests_pt', … … 79 95 $this->assertTrue( is_post_type_viewable( $pt ) ); 80 96 } 81 97 98 /** 99 * @covers ::is_post_type_viewable 100 */ 82 101 public function test_postpage_should_be_viewable() { 83 102 $post = get_post_type_object( 'post' ); 84 103 $this->assertTrue( is_post_type_viewable( $post ) ); … … 89 108 90 109 /** 91 110 * @ticket 35609 111 * 112 * @covers ::is_post_type_viewable 92 113 */ 93 114 public function test_should_accept_post_type_name() { 94 115 register_post_type( … … 105 126 106 127 /** 107 128 * @ticket 35609 129 * 130 * @covers ::is_post_type_viewable 108 131 */ 109 132 public function test_should_return_false_for_bad_post_type_name() { 110 133 $this->assertFalse( is_post_type_viewable( 'foo' ) ); -
tests/phpunit/tests/post/meta.php
44 44 self::delete_user( self::$author ); 45 45 } 46 46 47 /** 48 * @covers ::add_post_meta 49 */ 47 50 function test_unique_postmeta() { 48 51 // Add a unique post meta item. 49 52 $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique', 'value', true ) ); … … 67 70 68 71 } 69 72 73 /** 74 * @covers ::add_post_meta 75 */ 70 76 function test_nonunique_postmeta() { 71 77 // Add two non-unique post meta items. 72 78 $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'nonunique', 'value' ) ); … … 104 110 $this->assertTrue( delete_post_meta_by_key( 'nonunique' ) ); 105 111 } 106 112 113 /** 114 * @covers ::update_post_meta 115 */ 107 116 function test_update_post_meta() { 108 117 // Add a unique post meta item. 109 118 $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique_update', 'value', true ) ); … … 131 140 132 141 } 133 142 143 /** 144 * @covers ::delete_post_meta 145 */ 134 146 function test_delete_post_meta() { 135 147 // Add two unique post meta items. 136 148 $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique_delete', 'value', true ) ); … … 148 160 149 161 } 150 162 163 /** 164 * @covers ::delete_post_meta 165 */ 151 166 function test_delete_post_meta_by_key() { 152 167 // Add two unique post meta items. 153 168 $this->assertInternalType( 'integer', add_post_meta( self::$post_id, 'unique_delete_by_key', 'value', true ) ); … … 165 180 $this->assertSame( '', get_post_meta( self::$post_id_2, 'unique_delete_by_key', true ) ); 166 181 } 167 182 183 /** 184 * @covers ::get_post_meta_by_id 185 */ 168 186 function test_get_post_meta_by_id() { 169 187 $mid = add_post_meta( self::$post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true ); 170 188 $this->assertInternalType( 'integer', $mid ); … … 185 203 delete_metadata_by_mid( 'post', $mid ); 186 204 } 187 205 206 /** 207 * @covers ::delete_meta 208 */ 188 209 function test_delete_meta() { 189 210 $mid = add_post_meta( self::$post_id, 'delete_meta', 'delete_meta_value', true ); 190 211 $this->assertInternalType( 'integer', $mid ); … … 195 216 $this->assertFalse( delete_meta( 123456789 ) ); 196 217 } 197 218 219 /** 220 * @covers ::update_meta 221 */ 198 222 function test_update_meta() { 199 223 // Add a unique post meta item. 200 224 $this->assertInternalType( 'integer', $mid1 = add_post_meta( self::$post_id, 'unique_update', 'value', true ) ); … … 229 253 230 254 /** 231 255 * @ticket 12860 256 * 257 * @covers ::add_post_meta 232 258 */ 233 259 function test_funky_post_meta() { 234 260 $classy = new StdClass(); … … 252 278 /** 253 279 * @ticket 38323 254 280 * @dataProvider data_register_post_meta 281 * 282 * @covers ::register_post_meta 255 283 */ 256 284 public function test_register_post_meta( $post_type, $meta_key, $args ) { 257 285 add_filter( 'register_meta_args', array( $this, 'filter_register_meta_args_set_last_register_meta_call' ), 10, 4 ); … … 287 315 /** 288 316 * @ticket 38323 289 317 * @dataProvider data_unregister_post_meta 318 * 319 * @covers ::unregister_post_meta 290 320 */ 291 321 public function test_unregister_post_meta( $post_type, $meta_key ) { 292 322 global $wp_meta_keys; … … 312 342 313 343 /** 314 344 * @ticket 44467 345 * 346 * @covers ::add_metadata 315 347 */ 316 348 public function test_add_metadata_sets_posts_last_changed() { 317 349 $post_id = self::factory()->post->create(); … … 324 356 325 357 /** 326 358 * @ticket 44467 359 * 360 * @covers ::update_metadata 327 361 */ 328 362 public function test_update_metadata_sets_posts_last_changed() { 329 363 $post_id = self::factory()->post->create(); … … 336 370 337 371 /** 338 372 * @ticket 44467 373 * 374 * @covers ::delete_metadata 339 375 */ 340 376 public function test_delete_metadata_sets_posts_last_changed() { 341 377 $post_id = self::factory()->post->create(); -
tests/phpunit/tests/post/nav-menu.php
17 17 18 18 /** 19 19 * @ticket 32464 20 * 21 * @covers ::wp_nav_menu 20 22 */ 21 23 public function test_wp_nav_menu_empty_container() { 22 24 $tag_id = self::factory()->tag->create(); … … 43 45 $this->assertSame( 0, strpos( $menu, '<ul' ) ); 44 46 } 45 47 48 /** 49 * @covers ::wp_get_associated_nav_menu_items 50 */ 46 51 function test_wp_get_associated_nav_menu_items() { 47 52 $tag_id = self::factory()->tag->create(); 48 53 $cat_id = self::factory()->category->create(); … … 139 144 140 145 /** 141 146 * @ticket 27113 147 * 148 * @covers ::wp_get_nav_menu_items 142 149 */ 143 150 function test_orphan_nav_menu_item() { 144 151 … … 173 180 174 181 } 175 182 183 /** 184 * @covers ::wp_get_nav_menu_items 185 */ 176 186 public function test_wp_get_nav_menu_items_with_taxonomy_term() { 177 187 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 178 188 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); … … 204 214 205 215 /** 206 216 * @ticket 13910 217 * 218 * @covers ::wp_get_nav_menu_name 207 219 */ 208 220 function test_wp_get_nav_menu_name() { 209 221 // Register a nav menu location. … … 223 235 224 236 /** 225 237 * @ticket 29460 238 * 239 * @covers ::wp_get_nav_menus 226 240 */ 227 241 function test_orderby_name_by_default() { 228 242 // We are going to create a random number of menus (min 2, max 10). … … 252 266 253 267 /** 254 268 * @ticket 35324 269 * 270 * @covers ::wp_setup_nav_menu_item 255 271 */ 256 272 function test_wp_setup_nav_menu_item_for_post_type_archive() { 257 273 … … 285 301 286 302 /** 287 303 * @ticket 35324 304 * 305 * @covers ::wp_setup_nav_menu_item 288 306 */ 289 307 function test_wp_setup_nav_menu_item_for_post_type_archive_no_description() { 290 308 … … 316 334 317 335 /** 318 336 * @ticket 35324 337 * 338 * @covers ::wp_setup_nav_menu_item 319 339 */ 320 340 function test_wp_setup_nav_menu_item_for_post_type_archive_custom_description() { 321 341 … … 351 371 352 372 /** 353 373 * @ticket 35324 374 * 375 * @covers ::wp_setup_nav_menu_item 354 376 */ 355 377 function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() { 356 378 … … 372 394 373 395 /** 374 396 * @ticket 19038 397 * 398 * @covers ::wp_setup_nav_menu_item 375 399 */ 376 400 function test_wp_setup_nav_menu_item_for_trashed_post() { 377 401 $post_id = self::factory()->post->create( … … 398 422 399 423 /** 400 424 * @ticket 35206 425 * 426 * @covers ::wp_nav_menu 401 427 */ 402 428 function test_wp_nav_menu_whitespace_options() { 403 429 $post_id1 = self::factory()->post->create(); … … 485 511 * backward compatibility. 486 512 * 487 513 * @ticket 24587 514 * 515 * @covers ::wp_nav_menu 488 516 */ 489 517 function test_wp_nav_menu_filters_are_passed_args_object() { 490 518 $tag_id = self::factory()->tag->create(); … … 573 601 574 602 /** 575 603 * @ticket 35272 604 * 605 * @covers ::wp_get_nav_menu_items 576 606 */ 577 607 function test_no_front_page_class_applied() { 578 608 $page_id = self::factory()->post->create( … … 604 634 605 635 /** 606 636 * @ticket 35272 637 * 638 * @covers ::wp_get_nav_menu_items 607 639 */ 608 640 function test_class_applied_to_front_page_item() { 609 641 $page_id = self::factory()->post->create( … … 637 669 638 670 /** 639 671 * @ticket 35272 672 * 673 * @covers ::wp_get_nav_menu_items 640 674 */ 641 675 function test_class_not_applied_to_taxonomies_with_same_id_as_front_page_item() { 642 676 global $wpdb; … … 734 768 735 769 /** 736 770 * @ticket 39800 771 * 772 * @covers ::wp_get_nav_menu_items 737 773 */ 738 774 function test_parent_ancestor_for_post_archive() { 739 775 … … 835 871 /** 836 872 * @ticket 43401 837 873 * @dataProvider get_iri_current_menu_items 874 * 875 * @covers ::wp_get_nav_menu_items 838 876 */ 839 877 function test_iri_current_menu_item( $custom_link, $current = true ) { 840 878 wp_update_nav_menu_item( … … 864 902 /** 865 903 * @ticket 44005 866 904 * @group privacy 905 * 906 * @covers ::wp_get_nav_menu_items 867 907 */ 868 908 function test_no_privacy_policy_class_applied() { 869 909 $page_id = self::factory()->post->create( … … 895 935 /** 896 936 * @ticket 44005 897 937 * @group privacy 938 * 939 * @covers ::wp_get_nav_menu_items 898 940 */ 899 941 function test_class_applied_to_privacy_policy_page_item() { 900 942 $page_id = self::factory()->post->create( … … 929 971 /** 930 972 * @ticket 47723 931 973 * @dataProvider data_trim_url_for_custom_item 974 * 975 * @covers ::wp_get_nav_menu_items 932 976 */ 933 977 function test_trim_url_for_custom_item( $custom_url, $correct_url ) { 934 978 $custom_item_id = wp_update_nav_menu_item( … … 963 1007 * be empty, as the item should get the title from the category object itself. 964 1008 * 965 1009 * @ticket 48011 1010 * 1011 * @covers ::wp_get_nav_menu_item 966 1012 */ 967 1013 function test_wp_update_nav_menu_item_with_special_characters_in_category_name() { 968 1014 $category_name = 'Test Cat - \"Pre-Slashed\" Cat Name & >'; -
tests/phpunit/tests/post/objects.php
5 5 */ 6 6 class Tests_Post_Objects extends WP_UnitTestCase { 7 7 8 /** 9 * @covers ::get_post 10 */ 8 11 function test_get_post() { 9 12 $id = self::factory()->post->create(); 10 13 … … 66 69 $this->assertNull( get_post( false ) ); 67 70 } 68 71 72 /** 73 * @covers ::get_post_ancestors 74 */ 69 75 function test_get_post_ancestors() { 70 76 $parent_id = self::factory()->post->create(); 71 77 $child_id = self::factory()->post->create(); … … 100 106 101 107 /** 102 108 * @ticket 22882 109 * 110 * @covers ::get_post_ancestors 103 111 */ 104 112 function test_get_post_ancestors_with_falsey_values() { 105 113 foreach ( array( null, 0, false, '0', '' ) as $post_id ) { … … 108 116 } 109 117 } 110 118 119 /** 120 * @covers ::get_post 121 */ 111 122 function test_get_post_category_property() { 112 123 $post_id = self::factory()->post->create(); 113 124 $post = get_post( $post_id ); … … 127 138 $this->assertSame( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post['post_category'] ); 128 139 } 129 140 141 /** 142 * @covers ::get_post 143 */ 130 144 function test_get_tags_input_property() { 131 145 $post_id = self::factory()->post->create(); 132 146 $post = get_post( $post_id ); … … 144 158 $this->assertSame( array( 'Bar', 'Baz', 'Foo' ), $post['tags_input'] ); 145 159 } 146 160 161 /** 162 * @covers ::get_post_meta 163 */ 147 164 function test_get_page_template_property() { 148 165 $post_id = self::factory()->post->create(); 149 166 $post = get_post( $post_id ); … … 157 174 $this->assertSame( $template, $post->page_template ); 158 175 } 159 176 177 /** 178 * @covers ::get_post 179 */ 160 180 function test_get_post_filter() { 161 181 $post = get_post( 162 182 self::factory()->post->create( … … 184 204 $this->assertSame( esc_js( "Mary's home" ), $raw_post->post_title ); 185 205 } 186 206 207 /** 208 * @covers ::get_post 209 */ 187 210 function test_get_post_identity() { 188 211 $post = get_post( self::factory()->post->create() ); 189 212 … … 193 216 $this->assertSame( 'bar', get_post( $post, OBJECT, 'display' )->foo ); 194 217 } 195 218 219 /** 220 * @covers ::get_post 221 */ 196 222 function test_get_post_array() { 197 223 $id = self::factory()->post->create(); 198 224 … … 205 231 206 232 /** 207 233 * @ticket 22223 234 * 235 * @covers ::get_post 208 236 */ 209 237 function test_get_post_cache() { 210 238 global $wpdb; -
tests/phpunit/tests/post/output.php
39 39 return "<p class='{$processed_atts['class']}'>$content</p>\n"; 40 40 } 41 41 42 /** 43 * @covers ::the_content 44 */ 42 45 function test_the_content() { 43 46 $post_content = <<<EOF 44 47 <i>This is the excerpt.</i> … … 62 65 $this->assertSame( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) ); 63 66 } 64 67 68 /** 69 * @covers ::the_content 70 */ 65 71 function test_the_content_shortcode() { 66 72 $post_content = <<<EOF 67 73 [dumptag foo="bar" baz="123"] … … 128 134 $this->assertSame( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) ); 129 135 } 130 136 137 /** 138 * @covers ::the_content 139 */ 131 140 function test_the_content_attribute_filtering() { 132 141 kses_init_filters(); 133 142 … … 152 161 kses_remove_filters(); 153 162 } 154 163 164 /** 165 * @covers ::the_content 166 */ 155 167 function test_the_content_attribute_value_with_colon() { 156 168 kses_init_filters(); 157 169 … … 182 194 * @ticket 46471 183 195 * 184 196 * @group blocks 197 * 198 * @covers ::the_content 185 199 */ 186 200 public function test_the_content_should_handle_more_block_on_singular() { 187 201 $post_content = <<<EOF … … 231 245 * @ticket 46471 232 246 * 233 247 * @group blocks 248 * 249 * @covers ::the_content 234 250 */ 235 251 public function test_the_content_should_handle_more_block_when_noteaser_on_singular() { 236 252 $post_content = <<<EOF … … 275 291 * @ticket 46471 276 292 * 277 293 * @group blocks 294 * 295 * @covers ::the_content 278 296 */ 279 297 public function test_the_content_should_handle_more_block_when_non_singular() { 280 298 $post_content = <<<EOF … … 320 338 * @ticket 46471 321 339 * 322 340 * @group blocks 341 * 342 * @covers ::the_content 323 343 */ 324 344 public function test_the_content_should_handle_more_block_when_noteaser_on_non_singular() { 325 345 $post_content = <<<EOF -
tests/phpunit/tests/post/pings.php
6 6 */ 7 7 class Tests_Post_Pings extends WP_UnitTestCase { 8 8 9 /** 10 * @covers ::get_to_ping 11 */ 9 12 public function test_returns_to_ping_sites_from_post_id() { 10 13 $post_id = self::factory()->post->create( 11 14 array( … … 16 19 $this->assertSame( array( 'http://www.example.com', 'http://www.otherexample.com' ), get_to_ping( $post_id ) ); 17 20 } 18 21 22 /** 23 * @covers ::get_to_ping 24 */ 19 25 public function test_returns_to_ping_sites_from_post_object() { 20 26 $post_id = self::factory()->post->create( 21 27 array( … … 27 33 $this->assertSame( array( 'http://www.example.com', 'http://www.otherexample.com' ), get_to_ping( $post ) ); 28 34 } 29 35 36 /** 37 * @covers ::get_pung 38 */ 30 39 public function test_returns_pinged_sites_from_post_id() { 31 40 $post_id = self::factory()->post->create( array( 'pinged' => 'foo bar baz' ) ); 32 41 $this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post_id ) ); 33 42 } 34 43 44 /** 45 * @covers ::get_pung 46 */ 35 47 public function test_returns_pinged_sites_from_post_object() { 36 48 $post_id = self::factory()->post->create( array( 'pinged' => 'foo bar baz' ) ); 37 49 $post = get_post( $post_id ); … … 38 50 $this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post ) ); 39 51 } 40 52 53 /** 54 * @covers ::get_pung 55 */ 41 56 public function test_add_ping_with_post_id() { 42 57 $post_id = self::factory()->post->create(); 43 58 add_ping( $post_id, 'foo' ); … … 46 61 $this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post_id ) ); 47 62 } 48 63 64 /** 65 * @covers ::get_pung 66 */ 49 67 public function test_add_ping_array_with_post_id() { 50 68 $post_id = self::factory()->post->create(); 51 69 add_ping( $post_id, array( 'foo', 'bar', 'baz' ) ); … … 52 70 $this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post_id ) ); 53 71 } 54 72 73 /** 74 * @covers ::get_pung 75 */ 55 76 public function test_add_ping_with_post_object() { 56 77 $post_id = self::factory()->post->create(); 57 78 $post = get_post( $post_id ); -
tests/phpunit/tests/post/postClass.php
12 12 $this->post_id = self::factory()->post->create(); 13 13 } 14 14 15 /** 16 * @covers ::post_class 17 */ 15 18 public function test_post_class() { 16 19 $expected = 'class="' . implode( ' ', get_post_class( '', $this->post_id ) ) . '"'; 17 20 $this->expectOutputString( $expected ); … … 18 21 post_class( '', $this->post_id ); 19 22 } 20 23 24 /** 25 * @covers ::post_class 26 */ 21 27 public function test_post_class_extra_esc_attr() { 22 28 $classes = get_post_class( '', $this->post_id ); 23 29 $escaped_again = array_map( 'esc_attr', $classes ); -
tests/phpunit/tests/post/query.php
7 7 class Tests_Post_Query extends WP_UnitTestCase { 8 8 /** 9 9 * @group taxonomy 10 * 11 * @covers WP_Query::get 10 12 */ 11 13 function test_category__and_var() { 12 14 $q = new WP_Query(); … … 49 51 /** 50 52 * @ticket 28099 51 53 * @group taxonomy 54 * 55 * @covers WP_Query::get 52 56 */ 53 57 function test_empty_category__in() { 54 58 $cat_id = self::factory()->category->create(); … … 78 82 79 83 /** 80 84 * @ticket 22448 85 * 86 * @covers WP_Query::__construct 81 87 */ 82 88 function test_the_posts_filter() { 83 89 // Create posts and clear their caches. … … 128 134 return $posts; 129 135 } 130 136 137 /** 138 * @covers WP_Query::__construct 139 */ 131 140 function test_post__in_ordering() { 132 141 $post_id1 = self::factory()->post->create( 133 142 array( … … 176 185 177 186 /** 178 187 * @ticket 38034 188 * 189 * @covers WP_Query::__construct 179 190 */ 180 191 public function test_orderby_post__in_array() { 181 192 $posts = self::factory()->post->create_many( 4 ); … … 194 205 195 206 /** 196 207 * @ticket 38034 208 * 209 * @covers WP_Query::__construct 197 210 */ 198 211 public function test_orderby_post__in_array_with_implied_order() { 199 212 $posts = self::factory()->post->create_many( 4 ); … … 210 223 $this->assertSame( $ordered, wp_list_pluck( $q->posts, 'ID' ) ); 211 224 } 212 225 226 /** 227 * @covers WP_Query::__construct 228 */ 213 229 function test_post__in_attachment_ordering() { 214 230 $post_id = self::factory()->post->create(); 215 231 $att_ids = array(); … … 273 289 274 290 /** 275 291 * @ticket 36515 292 * 293 * @covers WP_Query::__construct 276 294 */ 277 295 public function test_post_name__in_ordering() { 278 296 $post_id1 = self::factory()->post->create( … … 308 326 $this->assertSame( $ordered, wp_list_pluck( $q->posts, 'post_name' ) ); 309 327 } 310 328 329 /** 330 * @covers WP_Query::__construct 331 */ 311 332 function test_post_status() { 312 333 $statuses1 = get_post_stati(); 313 334 $this->assertContains( 'auto-draft', $statuses1 ); … … 330 351 331 352 /** 332 353 * @ticket 17065 354 * 355 * @covers WP_Query::__construct 333 356 */ 334 357 function test_orderby_array() { 335 358 global $wpdb; … … 366 389 367 390 /** 368 391 * @ticket 17065 392 * 393 * @covers WP_Query::__construct 369 394 */ 370 395 function test_order() { 371 396 global $wpdb; … … 406 431 407 432 /** 408 433 * @ticket 29629 434 * 435 * @covers WP_Query::__construct 409 436 */ 410 437 function test_orderby() { 411 438 // 'rand' is a valid value. … … 441 468 442 469 /** 443 470 * @ticket 35692 471 * 472 * @covers WP_Query::__construct 444 473 */ 445 474 public function test_orderby_rand_with_seed() { 446 475 $q = new WP_Query( … … 454 483 455 484 /** 456 485 * @ticket 35692 486 * 487 * @covers WP_Query::__construct 457 488 */ 458 489 public function test_orderby_rand_should_ignore_invalid_seed() { 459 490 $q = new WP_Query( … … 467 498 468 499 /** 469 500 * @ticket 35692 501 * 502 * @covers WP_Query::__construct 470 503 */ 471 504 public function test_orderby_rand_with_seed_should_be_case_insensitive() { 472 505 $q = new WP_Query( … … 482 515 * Tests the post_name__in attribute of WP_Query. 483 516 * 484 517 * @ticket 33065 518 * 519 * @covers WP_Query::__construct 485 520 */ 486 521 public function test_post_name__in() { 487 522 $q = new WP_Query(); … … 534 569 535 570 /** 536 571 * @ticket 36687 572 * 573 * @covers WP_Query::__construct 537 574 */ 538 575 public function test_posts_pre_query_filter_should_bypass_database_query() { 539 576 global $wpdb; … … 560 597 561 598 /** 562 599 * @ticket 36687 600 * 601 * @covers WP_Query::__construct 563 602 */ 564 603 public function test_posts_pre_query_filter_should_respect_set_found_posts() { 565 604 global $wpdb; … … 595 634 596 635 /** 597 636 * @ticket 36687 637 * 638 * @covers WP_Query::__construct 598 639 */ 599 640 public function test_set_found_posts_fields_ids() { 600 641 register_post_type( 'wptests_pt' ); … … 619 660 620 661 /** 621 662 * @ticket 36687 663 * 664 * @covers WP_Query::__construct 622 665 */ 623 666 public function test_set_found_posts_fields_idparent() { 624 667 register_post_type( 'wptests_pt' ); … … 642 685 643 686 /** 644 687 * @ticket 36687 688 * 689 * @covers WP_Query::__construct 645 690 */ 646 691 public function test_set_found_posts_fields_split_the_query() { 647 692 register_post_type( 'wptests_pt' ); … … 668 713 669 714 /** 670 715 * @ticket 36687 716 * 717 * @covers WP_Query::__construct 671 718 */ 672 719 public function test_set_found_posts_fields_not_split_the_query() { 673 720 register_post_type( 'wptests_pt' ); … … 707 754 * @ticket 42860 708 755 * 709 756 * @dataProvider set_found_posts_provider 757 * 758 * @covers WP_Query::__construct 710 759 */ 711 760 public function test_set_found_posts_not_posts_as_an_array( $posts, $expected ) { 712 761 $q = new WP_Query( … … 727 776 728 777 /** 729 778 * @ticket 42469 779 * 780 * @covers WP_Query::__construct 730 781 */ 731 782 public function test_found_posts_should_be_integer_not_string() { 732 783 $this->post_id = self::factory()->post->create(); … … 742 793 743 794 /** 744 795 * @ticket 42469 796 * 797 * @covers WP_Query::__construct 745 798 */ 746 799 public function test_found_posts_should_be_integer_even_if_found_posts_filter_returns_string_value() { 747 800 $this->post_id = self::factory()->post->create(); -
tests/phpunit/tests/post/revisions.php
30 30 * 31 31 * @ticket 20982 32 32 * @ticket 16215 33 * 34 * @covers ::wp_restore_post_revision 33 35 */ 34 36 function test_revision_restore_updates_edit_last_post_meta() { 35 37 // Create a post as Author. … … 73 75 /** 74 76 * @ticket 7392 75 77 * @ticket 9843 78 * 79 * @covers ::wp_update_post 76 80 */ 77 81 function test_revision_dont_save_revision_if_unchanged() { 78 82 $post = get_default_post_to_edit( 'post', true ); … … 143 147 /** 144 148 * @ticket 7392 145 149 * @ticket 9843 150 * 151 * @covers ::wp_update_post 146 152 */ 147 153 function test_revision_force_save_revision_even_if_unchanged() { 148 154 add_filter( 'wp_save_post_revision_check_for_changes', '__return_false' ); … … 218 224 * Tests the Caps used in the action=view case of wp-admin/revision.php 219 225 * 220 226 * @ticket 16847 227 * 228 * @covers ::user_can 221 229 */ 222 230 function test_revision_view_caps_post() { 223 231 $post_id = self::factory()->post->create( … … 251 259 * Tests the Caps used in the action=restore case of wp-admin/revision.php 252 260 * 253 261 * @ticket 16847 262 * 263 * @covers ::user_can 254 264 */ 255 265 function test_revision_restore_caps_post() { 256 266 $post_id = self::factory()->post->create( … … 282 292 * Tests the Caps used in the action=diff case of wp-admin/revision.php 283 293 * 284 294 * @ticket 16847 295 * 296 * @covers ::user_can 285 297 */ 286 298 function test_revision_diff_caps_post() { 287 299 $post_id = self::factory()->post->create( … … 320 332 * Tests the Caps used in the action=view case of wp-admin/revision.php with a CPT with Custom Capabilities 321 333 * 322 334 * @ticket 16847 335 * 336 * @covers ::user_can 323 337 */ 324 338 function test_revision_view_caps_cpt() { 325 339 register_post_type( … … 362 376 * Tests the Caps used in the action=restore case of wp-admin/revision.php 363 377 * 364 378 * @ticket 16847 379 * 380 * @covers ::user_can 365 381 */ 366 382 function test_revision_restore_caps_cpt() { 367 383 register_post_type( … … 408 424 * Tests the Caps used in the action=restore case of wp-admin/revision.php 409 425 * 410 426 * @ticket 16847 427 * 428 * @covers ::user_can 411 429 */ 412 430 function test_revision_restore_caps_before_publish() { 413 431 register_post_type( … … 468 486 * Tests the Caps used in the action=diff case of wp-admin/revision.php 469 487 * 470 488 * @ticket 16847 489 * 490 * @covers ::user_can 471 491 */ 472 492 function test_revision_diff_caps_cpt() { 473 493 register_post_type( … … 513 533 514 534 /** 515 535 * @ticket 26042 536 * 537 * @covers ::wp_get_post_revisions 516 538 */ 517 539 function test_wp_get_post_revisions_should_order_by_post_date() { 518 540 global $wpdb; … … 549 571 550 572 /** 551 573 * @ticket 26042 574 * 575 * @covers ::wp_get_post_revisions 552 576 */ 553 577 function test_wp_get_post_revisions_should_order_by_ID_when_post_date_matches() { 554 578 $post = self::factory()->post->create_and_get( -
tests/phpunit/tests/post/slashes.php
32 32 33 33 /** 34 34 * Tests the controller function that expects slashed data. 35 * 36 * @covers ::edit_post 35 37 */ 36 38 function test_edit_post() { 37 39 $post_id = self::$post_id; … … 69 71 70 72 /** 71 73 * Tests the model function that expects slashed data. 74 * 75 * @covers ::wp_insert_post 72 76 */ 73 77 function test_wp_insert_post() { 74 78 $post_id = wp_insert_post( … … 105 109 106 110 /** 107 111 * Tests the model function that expects slashed data. 112 * 113 * @covers ::wp_update_post 108 114 */ 109 115 function test_wp_update_post() { 110 116 $post_id = self::$post_id; … … 140 146 141 147 /** 142 148 * @ticket 27550 149 * 150 * @covers ::wp_trash_post 151 * @covers ::wp_untrash_post 143 152 */ 144 153 function test_wp_trash_untrash() { 145 154 $post = array( -
tests/phpunit/tests/post/template.php
5 5 */ 6 6 class Tests_Post_Template extends WP_UnitTestCase { 7 7 8 /** 9 * @covers ::wp_link_pages 10 */ 8 11 function test_wp_link_pages() { 9 12 $contents = array( 'One', 'Two', 'Three' ); 10 13 $content = implode( '<!--nextpage-->', $contents ); … … 131 134 $this->assertSame( $pagelink, $output ); 132 135 } 133 136 137 /** 138 * @covers ::wp_dropdown_pages 139 */ 134 140 function test_wp_dropdown_pages() { 135 141 $none = wp_dropdown_pages( array( 'echo' => 0 ) ); 136 142 $this->assertEmpty( $none ); … … 222 228 223 229 /** 224 230 * @ticket 12494 231 * 232 * @covers ::wp_dropdown_pages 225 233 */ 226 234 public function test_wp_dropdown_pages_value_field_should_default_to_ID() { 227 235 $p = self::factory()->post->create( … … 242 250 243 251 /** 244 252 * @ticket 12494 253 * 254 * @covers ::wp_dropdown_pages 245 255 */ 246 256 public function test_wp_dropdown_pages_value_field_ID() { 247 257 $p = self::factory()->post->create( … … 262 272 263 273 /** 264 274 * @ticket 12494 275 * 276 * @covers ::wp_dropdown_pages 265 277 */ 266 278 public function test_wp_dropdown_pages_value_field_post_name() { 267 279 $p = self::factory()->post->create( … … 283 295 284 296 /** 285 297 * @ticket 12494 298 * 299 * @covers ::wp_dropdown_pages 286 300 */ 287 301 public function test_wp_dropdown_pages_value_field_should_fall_back_on_ID_when_an_invalid_value_is_provided() { 288 302 $p = self::factory()->post->create( … … 304 318 305 319 /** 306 320 * @ticket 30082 321 * 322 * @covers ::wp_dropdown_pages 307 323 */ 308 324 public function test_wp_dropdown_pages_should_not_contain_class_attribute_when_no_class_is_passed() { 309 325 $p = self::factory()->post->create( … … 324 340 325 341 /** 326 342 * @ticket 30082 343 * 344 * @covers ::wp_dropdown_pages 327 345 */ 328 346 public function test_wp_dropdown_pages_should_obey_class_parameter() { 329 347 $p = self::factory()->post->create( … … 345 363 346 364 /** 347 365 * @ticket 31389 366 * 367 * @covers ::get_page_template_slug 348 368 */ 349 369 public function test_get_page_template_slug_by_id() { 350 370 $page_id = self::factory()->post->create( … … 364 384 365 385 /** 366 386 * @ticket 31389 387 * 388 * @covers ::get_page_template_slug 367 389 */ 368 390 public function test_get_page_template_slug_from_loop() { 369 391 $page_id = self::factory()->post->create( … … 381 403 /** 382 404 * @ticket 31389 383 405 * @ticket 18375 406 * 407 * @covers ::get_page_template_slug 384 408 */ 385 409 public function test_get_page_template_slug_non_page() { 386 410 $post_id = self::factory()->post->create(); … … 397 421 398 422 /** 399 423 * @ticket 18375 424 * 425 * @covers ::get_page_template_slug 400 426 */ 401 427 public function test_get_page_template_slug_non_page_from_loop() { 402 428 $post_id = self::factory()->post->create(); … … 411 437 /** 412 438 * @ticket 11095 413 439 * @ticket 33974 440 * 441 * @covers ::wp_nav_menu 414 442 */ 415 443 public function test_wp_page_menu_wp_nav_menu_fallback() { 416 444 $pages = self::factory()->post->create_many( 3, array( 'post_type' => 'page' ) ); -
tests/phpunit/tests/post/thumbnails.php
31 31 parent::tearDownAfterClass(); 32 32 } 33 33 34 /** 35 * @covers ::has_post_thumbnail 36 */ 34 37 function test_has_post_thumbnail() { 35 38 $this->assertFalse( has_post_thumbnail( self::$post ) ); 36 39 $this->assertFalse( has_post_thumbnail( self::$post->ID ) ); … … 53 56 $this->assertTrue( has_post_thumbnail() ); 54 57 } 55 58 59 /** 60 * @covers ::get_post_thumbnail_id 61 */ 56 62 function test_get_post_thumbnail_id() { 57 63 $this->assertSame( 0, get_post_thumbnail_id( self::$post ) ); 58 64 $this->assertSame( 0, get_post_thumbnail_id( self::$post->ID ) ); … … 68 74 $this->assertSame( self::$attachment_id, get_post_thumbnail_id() ); 69 75 } 70 76 77 /** 78 * @covers ::update_post_thumbnail_cache 79 */ 71 80 function test_update_post_thumbnail_cache() { 72 81 set_post_thumbnail( self::$post, self::$attachment_id ); 73 82 … … 88 97 89 98 /** 90 99 * @ticket 12235 100 * 101 * @covers ::get_the_post_thumbnail_caption 91 102 */ 92 103 function test_get_the_post_thumbnail_caption() { 93 104 $this->assertSame( '', get_the_post_thumbnail_caption() ); … … 112 123 113 124 /** 114 125 * @ticket 12235 126 * 127 * @covers ::get_the_post_thumbnail_caption 115 128 */ 116 129 function test_get_the_post_thumbnail_caption_empty() { 117 130 $post_id = self::factory()->post->create(); … … 132 145 133 146 /** 134 147 * @ticket 12235 148 * 149 * @covers ::get_the_post_thumbnail_caption 135 150 */ 136 151 function test_the_post_thumbnail_caption() { 137 152 $caption = 'This is a caption.'; … … 153 168 the_post_thumbnail_caption( $post_id ); 154 169 } 155 170 171 /** 172 * @covers ::get_the_post_thumbnail 173 */ 156 174 function test_get_the_post_thumbnail() { 157 175 $this->assertSame( '', get_the_post_thumbnail() ); 158 176 $this->assertSame( '', get_the_post_thumbnail( self::$post ) ); … … 174 192 $this->assertSame( $expected, get_the_post_thumbnail() ); 175 193 } 176 194 195 /** 196 * @covers ::the_post_thumbnail 197 */ 177 198 function test_the_post_thumbnail() { 178 199 179 200 $this->expectOutputString( '' ); … … 201 222 202 223 /** 203 224 * @ticket 33070 225 * 226 * @covers ::get_the_post_thumbnail_url 204 227 */ 205 228 function test_get_the_post_thumbnail_url() { 206 229 $this->assertFalse( has_post_thumbnail( self::$post ) ); … … 219 242 220 243 /** 221 244 * @ticket 33070 245 * 246 * @covers ::get_the_post_thumbnail_url 222 247 */ 223 248 function test_get_the_post_thumbnail_url_with_invalid_post() { 224 249 set_post_thumbnail( self::$post, self::$attachment_id ); … … 233 258 234 259 /** 235 260 * @ticket 33070 261 * 262 * @covers ::the_post_thumbnail_url 236 263 */ 237 264 function test_the_post_thumbnail_url() { 238 265 $GLOBALS['post'] = self::$post; … … 248 275 249 276 /** 250 277 * @ticket 12922 278 * 279 * @covers ::_wp_preview_post_thumbnail_filter 251 280 */ 252 281 function test__wp_preview_post_thumbnail_filter() { 253 282 $old_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null; … … 268 297 269 298 /** 270 299 * @ticket 37697 300 * 301 * @covers ::_wp_preview_post_thumbnail_filter 271 302 */ 272 303 function test__wp_preview_post_thumbnail_filter_secondary_post() { 273 304 $old_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null; … … 294 325 295 326 /** 296 327 * @ticket 12922 328 * 329 * @covers ::wp_insert_post 297 330 */ 298 331 function test_insert_post_with_post_thumbnail() { 299 332 $post_id = wp_insert_post( … … 325 358 326 359 /** 327 360 * @ticket 37658 361 * 362 * @covers ::wp_insert_post 328 363 */ 329 364 function test_insert_attachment_with_post_thumbnail() { 330 365 // Audio files support featured images. … … 364 399 365 400 /** 366 401 * @ticket 39030 402 * 403 * @covers ::get_the_post_thumbnail 367 404 */ 368 405 function test_post_thumbnail_size_filter_simple() { 369 406 $this->current_size_filter_data = 'medium'; … … 385 422 /** 386 423 * @ticket 39030 387 424 * @dataProvider data_post_thumbnail_size_filter_complex 425 * 426 * @covers ::get_the_post_thumbnail 388 427 */ 389 428 function test_post_thumbnail_size_filter_complex( $which_post, $expected ) { 390 429 $this->current_size_filter_data = array( -
tests/phpunit/tests/post/types.php
24 24 $this->post_type = rand_str( 20 ); 25 25 } 26 26 27 /** 28 * @covers ::register_post_type 29 */ 27 30 function test_register_post_type() { 28 31 $this->assertNull( get_post_type_object( 'foo' ) ); 29 32 register_post_type( 'foo' ); … … 41 44 42 45 /** 43 46 * @ticket 48558 47 * 48 * @covers ::register_post_type 44 49 */ 45 50 function test_register_post_type_return_value() { 46 51 $this->assertInstanceOf( 'WP_Post_Type', register_post_type( 'foo' ) ); … … 50 55 * @ticket 31134 51 56 * 52 57 * @expectedIncorrectUsage register_post_type 58 * 59 * @covers ::register_post_type 53 60 */ 54 61 function test_register_post_type_with_too_long_name() { 55 62 // Post type too long. … … 60 67 * @ticket 31134 61 68 * 62 69 * @expectedIncorrectUsage register_post_type 70 * 71 * @covers ::register_post_type 63 72 */ 64 73 function test_register_post_type_with_empty_name() { 65 74 // Post type too short. … … 68 77 69 78 /** 70 79 * @ticket 35985 80 * 71 81 * @covers ::register_post_type 72 82 */ 73 83 function test_register_post_type_exclude_from_search_should_default_to_opposite_value_of_public() { … … 82 92 83 93 /** 84 94 * @ticket 35985 95 * 85 96 * @covers ::register_post_type 86 97 */ 87 98 function test_register_post_type_publicly_queryable_should_default_to_value_of_public() { … … 96 107 97 108 /** 98 109 * @ticket 35985 110 * 99 111 * @covers ::register_post_type 100 112 */ 101 113 function test_register_post_type_show_ui_should_default_to_value_of_public() { … … 110 122 111 123 /** 112 124 * @ticket 35985 125 * 113 126 * @covers ::register_post_type 114 127 */ 115 128 function test_register_post_type_show_in_menu_should_default_to_value_of_show_ui() { … … 129 142 130 143 /** 131 144 * @ticket 35985 145 * 132 146 * @covers ::register_post_type 133 147 */ 134 148 function test_register_post_type_show_in_nav_menus_should_default_to_value_of_public() { … … 143 157 144 158 /** 145 159 * @ticket 35985 160 * 146 161 * @covers ::register_post_type 147 162 */ 148 163 function test_register_post_type_show_in_admin_bar_should_default_to_value_of_show_in_menu() { … … 163 178 $this->assertSame( $public, $args->show_in_admin_bar ); 164 179 } 165 180 181 /** 182 * @covers ::register_taxonomy_for_object_type 183 */ 166 184 function test_register_taxonomy_for_object_type() { 167 185 global $wp_taxonomies; 168 186 … … 185 203 _unregister_post_type( 'bar' ); 186 204 } 187 205 206 /** 207 * @covers ::post_type_exists 208 */ 188 209 function test_post_type_exists() { 189 210 $this->assertFalse( post_type_exists( 'notaposttype' ) ); 190 211 $this->assertTrue( post_type_exists( 'post' ) ); 191 212 } 192 213 214 /** 215 * @covers ::post_type_supports 216 */ 193 217 function test_post_type_supports() { 194 218 $this->assertTrue( post_type_supports( 'post', 'post-formats' ) ); 195 219 $this->assertFalse( post_type_supports( 'page', 'post-formats' ) ); … … 200 224 201 225 /** 202 226 * @ticket 21586 227 * 228 * @covers ::post_type_supports 203 229 */ 204 230 function test_post_type_with_no_support() { 205 231 register_post_type( 'foo', array( 'supports' => array() ) ); … … 215 241 216 242 /** 217 243 * @ticket 23302 244 * 245 * @covers ::register_post_type 218 246 */ 219 247 function test_post_type_with_no_feed() { 220 248 global $wp_rewrite; … … 228 256 229 257 /** 230 258 * @ticket 30013 259 * 260 * @covers ::get_post_type_object 231 261 */ 232 262 public function test_get_post_type_object_with_non_scalar_values() { 233 263 $this->assertFalse( post_type_exists( 'foo' ) ); … … 248 278 249 279 /** 250 280 * @ticket 33023 281 * 282 * @covers ::get_post_type_object 251 283 */ 252 284 public function test_get_post_type_object_casting() { 253 285 register_post_type( 'foo' ); … … 265 297 266 298 /** 267 299 * @ticket 38844 300 * 301 * @covers ::get_post_type_object 268 302 */ 269 303 public function test_get_post_type_object_includes_menu_icon_for_builtin_post_types() { 270 304 $this->assertSame( 'dashicons-admin-post', get_post_type_object( 'post' )->menu_icon ); … … 274 308 275 309 /** 276 310 * @ticket 14761 311 * 312 * @covers ::unregister_post_type 277 313 */ 278 314 public function test_unregister_post_type() { 279 315 register_post_type( 'foo' ); … … 282 318 283 319 /** 284 320 * @ticket 14761 321 * 322 * @covers ::unregister_post_type 285 323 */ 286 324 public function test_unregister_post_type_unknown_post_type() { 287 325 $this->assertWPError( unregister_post_type( 'foo' ) ); … … 289 327 290 328 /** 291 329 * @ticket 14761 330 * 331 * @covers ::unregister_post_type 292 332 */ 293 333 public function test_unregister_post_type_twice() { 294 334 register_post_type( 'foo' ); … … 298 338 299 339 /** 300 340 * @ticket 14761 341 * 342 * @covers ::unregister_post_type 301 343 */ 302 344 public function test_unregister_post_type_disallow_builtin_post_type() { 303 345 $this->assertWPError( unregister_post_type( 'post' ) ); … … 309 351 310 352 /** 311 353 * @ticket 14761 354 * 355 * @covers ::unregister_post_type 312 356 */ 313 357 public function test_unregister_post_type_removes_query_vars() { 314 358 global $wp; … … 328 372 329 373 /** 330 374 * @ticket 14761 375 * 376 * @covers ::unregister_post_type 331 377 */ 332 378 public function test_unregister_post_type_removes_rewrite_tags() { 333 379 $this->set_permalink_structure( '/%postname%' ); … … 354 400 355 401 /** 356 402 * @ticket 14761 403 * 404 * @covers ::unregister_post_type 357 405 */ 358 406 public function test_unregister_post_type_removes_rewrite_rules() { 359 407 $this->set_permalink_structure( '/%postname%' ); … … 375 423 376 424 /** 377 425 * @ticket 14761 426 * 427 * @covers ::unregister_post_type 378 428 */ 379 429 public function test_unregister_post_type_removes_custom_meta_capabilities() { 380 430 global $post_type_meta_caps; … … 401 451 402 452 /** 403 453 * @ticket 14761 454 * 455 * @covers ::unregister_post_type 404 456 */ 405 457 public function test_unregister_post_type_removes_post_type_supports() { 406 458 global $_wp_post_type_features; … … 427 479 428 480 /** 429 481 * @ticket 14761 482 * 483 * @covers ::unregister_post_type 430 484 */ 431 485 public function test_unregister_post_type_removes_post_type_from_taxonomies() { 432 486 global $wp_taxonomies; … … 449 503 450 504 /** 451 505 * @ticket 14761 506 * 507 * @covers ::unregister_post_type 452 508 */ 453 509 public function test_unregister_post_type_removes_the_future_post_hooks() { 454 510 global $wp_filter; … … 468 524 469 525 /** 470 526 * @ticket 14761 527 * 528 * @covers ::unregister_post_type 471 529 */ 472 530 public function test_unregister_post_type_removes_meta_box_callback() { 473 531 global $wp_filter; … … 488 546 489 547 /** 490 548 * @ticket 14761 549 * 550 * @covers ::unregister_post_type 491 551 */ 492 552 public function test_unregister_post_type_removes_post_type_from_global() { 493 553 global $wp_post_types; … … 510 570 511 571 /** 512 572 * @ticket 14761 573 * 574 * @covers ::unregister_post_type 575 * @covers ::post_type_exists 513 576 */ 514 577 public function test_post_type_does_not_exist_after_unregister_post_type() { 515 578 register_post_type( … … 526 589 527 590 /** 528 591 * @ticket 34010 592 * 593 * @covers ::get_post_types_by_support 529 594 */ 530 595 public function test_get_post_types_by_support_single_feature() { 531 596 $this->assertContains( 'post', get_post_types_by_support( 'title' ) ); … … 536 601 537 602 /** 538 603 * @ticket 34010 604 * 605 * @covers ::get_post_types_by_support 539 606 */ 540 607 public function test_get_post_types_by_support_multiple_features() { 541 608 $this->assertContains( 'post', get_post_types_by_support( array( 'thumbnail', 'author' ) ) ); … … 544 611 545 612 /** 546 613 * @ticket 34010 614 * 615 * @covers ::get_post_types_by_support 547 616 */ 548 617 public function test_get_post_types_by_support_or_operator() { 549 618 $this->assertContains( 'post', get_post_types_by_support( array( 'post-formats', 'page-attributes' ), 'or' ) ); … … 552 621 553 622 /** 554 623 * @ticket 34010 624 * 625 * @covers ::get_post_types_by_support 555 626 */ 556 627 public function test_get_post_types_by_support_not_operator() { 557 628 $this->assertContains( 'attachment', get_post_types_by_support( array( 'thumbnail' ), 'not' ) ); … … 561 632 562 633 /** 563 634 * @ticket 34010 635 * 636 * @covers ::get_post_types_by_support 564 637 */ 565 638 public function test_get_post_types_by_support_excluding_features() { 566 639 $this->assertSameSets( array(), get_post_types_by_support( array( 'post-formats', 'page-attributes' ) ) ); … … 568 641 569 642 /** 570 643 * @ticket 34010 644 * 645 * @covers ::get_post_types_by_support 571 646 */ 572 647 public function test_get_post_types_by_support_non_existant_feature() { 573 648 $this->assertSameSets( array(), get_post_types_by_support( 'somefeature' ) ); -
tests/phpunit/tests/post/walkerPage.php
25 25 * @ticket 47720 26 26 * 27 27 * @dataProvider data_start_el_with_empty_attributes 28 * 29 * @covers Walker_Page::start_el 28 30 */ 29 31 public function test_start_el_with_empty_attributes( $value, $expected ) { 30 32 $output = ''; -
tests/phpunit/tests/post/wpGetPostParentId.php
23 23 self::$post_id = $factory->post->create( array( 'post_parent' => self::$parent_post_id ) ); 24 24 } 25 25 26 /** 27 * @covers ::wp_get_post_parent_id 28 */ 26 29 public function test_wp_get_post_parent_id_with_post_object() { 27 30 $post = get_post( self::$post_id ); 28 31 $this->assertInstanceOf( 'WP_Post', $post ); … … 29 32 $this->assertSame( self::$parent_post_id, wp_get_post_parent_id( $post ) ); 30 33 } 31 34 35 /** 36 * @covers ::wp_get_post_parent_id 37 */ 32 38 public function test_wp_get_post_parent_id_with_post_id() { 33 39 $this->assertSame( self::$parent_post_id, wp_get_post_parent_id( self::$post_id ) ); 34 40 } 35 41 42 /** 43 * @covers ::wp_get_post_parent_id 44 */ 36 45 public function test_wp_get_post_parent_id_with_non_existing_id_default_to_global_post_id() { 37 46 $GLOBALS['post'] = get_post( self::$post_id ); 38 47 $this->assertSame( self::$parent_post_id, wp_get_post_parent_id( 0 ) ); 39 48 } 40 49 50 /** 51 * @covers ::wp_get_post_parent_id 52 */ 41 53 public function test_wp_get_post_parent_id_with_boolean_default_to_global_post_id() { 42 54 $GLOBALS['post'] = get_post( self::$post_id ); 43 55 $this->assertSame( self::$parent_post_id, wp_get_post_parent_id( false ) ); 44 56 } 45 57 58 /** 59 * @covers ::wp_get_post_parent_id 60 */ 46 61 public function test_wp_get_post_parent_id_with_string_default_to_false() { 47 62 $GLOBALS['post'] = get_post( self::$post_id ); 48 63 $this->assertFalse( wp_get_post_parent_id( 'string' ) ); -
tests/phpunit/tests/post/wpInsertPost.php
67 67 68 68 /** 69 69 * @ticket 11863 70 * 71 * @covers ::wp_trash_post 70 72 */ 71 73 function test_trashing_a_post_should_add_trashed_suffix_to_post_name() { 72 74 $trashed_about_page_id = self::factory()->post->create( … … 76 78 'post_status' => 'publish', 77 79 ) 78 80 ); 79 wp_trash_post( $trashed_about_page_id );81 ( $trashed_about_page_id ); 80 82 $this->assertSame( 'about__trashed', get_post( $trashed_about_page_id )->post_name ); 81 83 } 82 84 83 85 /** 84 86 * @ticket 11863 87 * 88 * @covers ::wp_trash_post 85 89 */ 86 90 public function test_trashed_suffix_should_be_added_to_post_with__trashed_in_slug() { 87 91 $trashed_about_page_id = self::factory()->post->create( … … 98 102 99 103 /** 100 104 * @ticket 11863 105 * 106 * @covers ::wp_untrash_post 101 107 */ 102 108 function test_trashed_posts_original_post_name_should_be_reassigned_after_untrashing() { 103 109 $about_page_id = self::factory()->post->create( … … 115 121 116 122 /** 117 123 * @ticket 11863 124 * 125 * @covers ::wp_insert_post 118 126 */ 119 127 function test_creating_a_new_post_should_add_trashed_suffix_to_post_name_of_trashed_posts_with_the_desired_slug() { 120 128 $trashed_about_page_id = self::factory()->post->create( … … 139 147 140 148 /** 141 149 * @ticket 11863 150 * 151 * @covers ::wp_untrash_post 142 152 */ 143 153 function test_untrashing_a_post_with_a_stored_desired_post_name_should_get_its_post_name_suffixed_if_another_post_has_taken_the_desired_post_name() { 144 154 $about_page_id = self::factory()->post->create( … … 173 183 /** 174 184 * @ticket 23022 175 185 * @dataProvider data_various_post_statuses 186 * 187 * @covers ::wp_untrash_post 176 188 */ 177 189 function test_untrashing_a_post_should_always_restore_it_to_draft_status( $post_status ) { 178 190 $page_id = self::factory()->post->create( … … 191 203 /** 192 204 * @ticket 23022 193 205 * @dataProvider data_various_post_statuses 206 * 207 * @covers ::wp_untrash_post 194 208 */ 195 209 function test_wp_untrash_post_status_filter_restores_post_to_correct_status( $post_status ) { 196 210 add_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 ); … … 256 270 * 257 271 * @ticket 42464 258 272 * @dataProvider data_various_post_types 273 * 274 * @covers ::wp_insert_post 275 * @covers ::wp_update_post 259 276 */ 260 277 function test_contributor_cannot_set_post_slug( $post_type ) { 261 278 wp_set_current_user( self::$user_ids['contributor'] ); … … 295 312 * 296 313 * @ticket 42464 297 314 * @dataProvider data_various_post_types 315 * 316 * @covers ::wp_insert_post 317 * @covers ::wp_update_post 298 318 */ 299 319 function test_administrator_can_set_post_slug( $post_type ) { 300 320 wp_set_current_user( self::$user_ids['administrator'] ); … … 336 356 * These assertions failed prior to ticket #42464. 337 357 * 338 358 * @ticket 42464 359 * 360 * @covers ::wp_insert_post 361 * @covers ::wp_update_post 339 362 */ 340 363 function test_administrator_cannot_set_post_slug_on_post_type_they_cannot_publish() { 341 364 wp_set_current_user( self::$user_ids['administrator'] ); … … 372 395 373 396 /** 374 397 * @ticket 25347 398 * 399 * @covers ::wp_insert_post 375 400 */ 376 401 function test_scheduled_post_with_a_past_date_should_be_published() { 377 402 -
tests/phpunit/tests/post/wpListPages.php
115 115 } 116 116 } 117 117 118 /** 119 * @covers ::wp_list_pages 120 */ 118 121 function test_wp_list_pages_default() { 119 122 $args = array( 120 123 'echo' => false, … … 146 149 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 147 150 } 148 151 152 /** 153 * @covers ::wp_list_pages 154 */ 149 155 function test_wp_list_pages_depth() { 150 156 $args = array( 151 157 'echo' => false, … … 176 182 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 177 183 } 178 184 185 /** 186 * @covers ::wp_list_pages 187 */ 179 188 function test_wp_list_pages_date_format() { 180 189 $args = array( 181 190 'echo' => false, … … 224 233 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 225 234 } 226 235 236 /** 237 * @covers ::wp_list_pages 238 */ 227 239 function test_wp_list_pages_exclude() { 228 240 $args = array( 229 241 'echo' => false, … … 252 264 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 253 265 } 254 266 267 /** 268 * @covers ::wp_list_pages 269 */ 255 270 function test_wp_list_pages_title_li() { 256 271 $args = array( 257 272 'echo' => false, … … 267 282 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 268 283 } 269 284 285 /** 286 * @covers ::wp_list_pages 287 */ 270 288 function test_wp_list_pages_echo() { 271 289 $args = array( 272 290 'echo' => true, … … 282 300 wp_list_pages( $args ); 283 301 } 284 302 303 /** 304 * @covers ::wp_list_pages 305 */ 285 306 function test_wp_list_pages_authors() { 286 307 $args = array( 287 308 'echo' => false, … … 294 315 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 295 316 } 296 317 318 /** 319 * @covers ::wp_list_pages 320 */ 297 321 function test_wp_list_pages_number() { 298 322 $args = array( 299 323 'echo' => false, … … 307 331 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 308 332 } 309 333 334 /** 335 * @covers ::wp_list_pages 336 */ 310 337 function test_wp_list_pages_sort_column() { 311 338 $args = array( 312 339 'echo' => false, … … 323 350 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 324 351 } 325 352 353 /** 354 * @covers ::wp_list_pages 355 */ 326 356 function test_wp_list_pages_link_before() { 327 357 $args = array( 328 358 'echo' => false, … … 355 385 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 356 386 } 357 387 388 /** 389 * @covers ::wp_list_pages 390 */ 358 391 function test_wp_list_pages_link_after() { 359 392 $args = array( 360 393 'echo' => false, … … 388 421 } 389 422 390 423 424 /** 425 * @covers ::wp_list_pages 426 */ 391 427 function test_wp_list_pages_include() { 392 428 $args = array( 393 429 'echo' => false, … … 401 437 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 402 438 } 403 439 440 /** 441 * @covers ::wp_list_pages 442 */ 404 443 function test_wp_list_pages_exclude_tree() { 405 444 $args = array( 406 445 'echo' => false, … … 419 458 $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) ); 420 459 } 421 460 461 /** 462 * @covers ::wp_list_pages 463 */ 422 464 function test_wp_list_pages_discarded_whitespace() { 423 465 $args = array( 424 466 'echo' => false, -
tests/phpunit/tests/post/wpPost.php
25 25 26 26 /** 27 27 * @ticket 37738 28 * 29 * @covers WP_Post::get_instance 28 30 */ 29 31 public function test_get_instance_should_work_for_numeric_string() { 30 32 $found = WP_Post::get_instance( (string) self::$post_id ); … … 34 36 35 37 /** 36 38 * @ticket 37738 39 * 40 * @covers WP_Post::get_instance 37 41 */ 38 42 public function test_get_instance_should_fail_for_negative_number() { 39 43 $found = WP_Post::get_instance( -self::$post_id ); … … 43 47 44 48 /** 45 49 * @ticket 37738 50 * 51 * @covers WP_Post::get_instance 46 52 */ 47 53 public function test_get_instance_should_fail_for_non_numeric_string() { 48 54 $found = WP_Post::get_instance( 'abc' ); … … 52 58 53 59 /** 54 60 * @ticket 37738 61 * 62 * @covers WP_Post::get_instance 55 63 */ 56 64 public function test_get_instance_should_succeed_for_float_that_is_equal_to_post_id() { 57 65 $found = WP_Post::get_instance( 1.0 ); -
tests/phpunit/tests/post/wpPostType.php
12 12 } 13 13 } 14 14 15 /** 16 * @covers WP_Post_Type::add_supports 17 * @covers WP_Post_Type::remove_supports 18 */ 15 19 public function test_add_supports_defaults() { 16 20 $post_type = 'cpt'; 17 21 $post_type_object = new WP_Post_Type( $post_type ); … … 32 36 $this->assertSameSets( array(), $post_type_supports_after ); 33 37 } 34 38 39 /** 40 * @covers WP_Post_Type::add_supports 41 * @covers WP_Post_Type::remove_supports 42 */ 35 43 public function test_add_supports_custom() { 36 44 $post_type = 'cpt'; 37 45 $post_type_object = new WP_Post_Type( … … 66 74 * Test that supports can optionally receive nested args. 67 75 * 68 76 * @ticket 40413 77 * 78 * @covers WP_Post_Type::add_supports 79 * @covers WP_Post_Type::remove_supports 69 80 */ 70 81 public function test_add_supports_custom_with_args() { 71 82 $post_type = 'cpt'; … … 103 114 $this->assertSameSets( array(), $post_type_supports_after ); 104 115 } 105 116 117 /** 118 * @covers WP_Post_Type::__construct 119 * @covers WP_Post_Type::add_rewrite_rules 120 */ 106 121 public function test_does_not_add_query_var_if_not_public() { 107 122 $this->set_permalink_structure( '/%postname%' ); 108 123 … … 122 137 $this->assertFalse( in_array( 'foobar', $wp->public_query_vars, true ) ); 123 138 } 124 139 140 /** 141 * @covers WP_Post_Type::__construct 142 * @covers WP_Post_Type::add_rewrite_rules 143 */ 125 144 public function test_adds_query_var_if_public() { 126 145 $this->set_permalink_structure( '/%postname%' ); 127 146 … … 148 167 $this->assertFalse( $in_array_after ); 149 168 } 150 169 170 /** 171 * @covers WP_Post_Type::add_rewrite_rules 172 * @covers WP_Post_Type::remove_rewrite_rules 173 */ 151 174 public function test_adds_rewrite_rules() { 152 175 $this->set_permalink_structure( '/%postname%' ); 153 176 … … 173 196 $this->assertFalse( array_search( "%$post_type%", $rewrite_tags_after, true ) ); 174 197 } 175 198 199 /** 200 * @covers WP_Post_Type::register_meta_boxes 201 * @covers WP_Post_Type::unregister_meta_boxes 202 */ 176 203 public function test_register_meta_boxes() { 177 204 $post_type = 'cpt'; 178 205 $post_type_object = new WP_Post_Type( $post_type, array( 'register_meta_box_cb' => '__return_false' ) ); … … 186 213 $this->assertFalse( $has_action_after ); 187 214 } 188 215 216 /** 217 * @covers WP_Post_Type::add_hooks 218 * @covers WP_Post_Type::remove_hooks 219 */ 189 220 public function test_adds_future_post_hook() { 190 221 $post_type = 'cpt'; 191 222 $post_type_object = new WP_Post_Type( $post_type ); … … 198 229 $this->assertFalse( $has_action_after ); 199 230 } 200 231 232 /** 233 * @covers WP_Post_Type::register_taxonomies 234 * @covers WP_Post_Type::unregister_taxonomies 235 */ 201 236 public function test_register_taxonomies() { 202 237 global $wp_post_types; 203 238 -
tests/phpunit/tests/post/wpPublishPost.php
25 25 * Ensure wp_publish_post does not add default category in error. 26 26 * 27 27 * @ticket 51292 28 * 29 * @covers ::wp_publish_post 28 30 */ 29 31 function test_wp_publish_post_respects_current_categories() { 30 32 $post_id = self::$auto_draft_id; … … 43 45 44 46 /** 45 47 * Ensure wp_publish_post adds default category. 48 * @ticket 51292 46 49 * 47 50 * @covers ::wp_publish_post 48 * @ticket 5129249 51 */ 50 52 function test_wp_publish_post_adds_default_category() { 51 53 $post_id = self::$auto_draft_id; … … 63 65 64 66 /** 65 67 * Ensure wp_publish_post adds default category when tagged. 68 * @ticket 51292 66 69 * 67 70 * @covers ::wp_publish_post 68 * @ticket 5129269 71 */ 70 72 function test_wp_publish_post_adds_default_category_when_tagged() { 71 73 $post_id = self::$auto_draft_id; … … 84 86 85 87 /** 86 88 * Ensure wp_publish_post does not add default term in error. 89 * @ticket 51292 87 90 * 88 91 * @covers ::wp_publish_post 89 * @ticket 5129290 92 */ 91 93 function test_wp_publish_post_respects_current_terms() { 92 94 // Create custom taxonomy to test with. … … 119 121 120 122 /** 121 123 * Ensure wp_publish_post adds default term. 124 * @ticket 51292 122 125 * 123 126 * @covers ::wp_publish_post 124 * @ticket 51292125 127 */ 126 128 function test_wp_publish_post_adds_default_term() { 127 129 // Create custom taxonomy to test with. -
tests/phpunit/tests/post/wpUniquePostSlug.php
8 8 9 9 /** 10 10 * @ticket 21013 11 * 12 * @covers ::wp_insert_post 11 13 */ 12 14 public function test_non_latin_slugs() { 13 15 $author_id = self::factory()->user->create( array( 'role' => 'editor' ) ); … … 42 44 43 45 /** 44 46 * @ticket 18962 47 * 48 * @covers ::wp_unique_post_slug 45 49 */ 46 50 public function test_with_multiple_hierarchies() { 47 51 register_post_type( 'post-type-1', array( 'hierarchical' => true ) ); … … 68 72 69 73 /** 70 74 * @ticket 30339 75 * 76 * @covers ::wp_unique_post_slug 71 77 */ 72 78 public function test_with_hierarchy() { 73 79 register_post_type( 'post-type-1', array( 'hierarchical' => true ) ); … … 91 97 92 98 /** 93 99 * @ticket 18962 100 * 101 * @covers ::wp_unique_post_slug 94 102 */ 95 103 function test_wp_unique_post_slug_with_hierarchy_and_attachments() { 96 104 register_post_type( 'post-type-1', array( 'hierarchical' => true ) ); … … 129 137 130 138 /** 131 139 * @dataProvider allowed_post_statuses 140 * 141 * @covers ::wp_unique_post_slug 132 142 */ 133 143 public function test_allowed_post_statuses_should_not_be_forced_to_be_unique( $status ) { 134 144 $p1 = self::factory()->post->create( … … 157 167 ); 158 168 } 159 169 170 /** 171 * @covers ::wp_unique_post_slug 172 */ 160 173 public function test_revisions_should_not_be_forced_to_be_unique() { 161 174 $p1 = self::factory()->post->create( 162 175 array( … … 178 191 179 192 /** 180 193 * @ticket 5305 194 * 195 * @covers ::wp_unique_post_slug 181 196 */ 182 197 public function test_slugs_resulting_in_permalinks_that_resemble_year_archives_should_be_suffixed() { 183 198 $this->set_permalink_structure( '/%postname%/' ); … … 195 210 196 211 /** 197 212 * @ticket 5305 213 * 214 * @covers ::wp_unique_post_slug 198 215 */ 199 216 public function test_slugs_resulting_in_permalinks_that_resemble_year_archives_should_not_be_suffixed_for_already_published_posts() { 200 217 $this->set_permalink_structure( '/%postname%/' ); … … 213 230 214 231 /** 215 232 * @ticket 5305 233 * 234 * @covers ::wp_unique_post_slug 216 235 */ 217 236 public function test_yearlike_slugs_should_not_be_suffixed_if_permalink_structure_does_not_result_in_a_clash_with_year_archives() { 218 237 $this->set_permalink_structure( '/%year%/%postname%/' ); … … 230 249 231 250 /** 232 251 * @ticket 5305 252 * 253 * @covers ::wp_unique_post_slug 233 254 */ 234 255 public function test_slugs_resulting_in_permalinks_that_resemble_month_archives_should_be_suffixed() { 235 256 $this->set_permalink_structure( '/%year%/%postname%/' ); … … 247 268 248 269 /** 249 270 * @ticket 5305 271 * 272 * @covers ::wp_unique_post_slug 250 273 */ 251 274 public function test_monthlike_slugs_should_not_be_suffixed_if_permalink_structure_does_not_result_in_a_clash_with_month_archives() { 252 275 $this->set_permalink_structure( '/%year%/foo/%postname%/' ); … … 264 287 265 288 /** 266 289 * @ticket 5305 290 * 291 * @covers ::wp_unique_post_slug 267 292 */ 268 293 public function test_monthlike_slugs_should_not_be_suffixed_for_invalid_month_numbers() { 269 294 $this->set_permalink_structure( '/%year%/%postname%/' ); … … 281 306 282 307 /** 283 308 * @ticket 5305 309 * 310 * @covers ::wp_unique_post_slug 284 311 */ 285 312 public function test_slugs_resulting_in_permalinks_that_resemble_day_archives_should_be_suffixed() { 286 313 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); … … 298 325 299 326 /** 300 327 * @ticket 5305 328 * 329 * @covers ::wp_unique_post_slug 301 330 */ 302 331 public function test_daylike_slugs_should_not_be_suffixed_if_permalink_structure_does_not_result_in_a_clash_with_day_archives() { 303 332 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); … … 315 344 316 345 /** 317 346 * @ticket 5305 347 * 348 * @covers ::wp_unique_post_slug 318 349 */ 319 350 public function test_daylike_slugs_should_not_be_suffixed_for_invalid_day_numbers() { 320 351 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); … … 332 363 333 364 /** 334 365 * @ticket 34971 366 * 367 * @covers ::wp_unique_post_slug 335 368 */ 336 369 public function test_embed_slug_should_be_suffixed_for_posts() { 337 370 $this->set_permalink_structure( '/%postname%/' ); … … 349 382 350 383 /** 351 384 * @ticket 34971 385 * 386 * @covers ::wp_unique_post_slug 352 387 */ 353 388 public function test_embed_slug_should_be_suffixed_for_pages() { 354 389 $this->set_permalink_structure( '/%postname%/' ); … … 366 401 367 402 /** 368 403 * @ticket 34971 404 * 405 * @covers ::wp_unique_post_slug 369 406 */ 370 407 public function test_embed_slug_should_be_suffixed_for_attachments() { 371 408 $this->set_permalink_structure( '/%postname%/' ); -
tests/phpunit/tests/privacy/wpCreateUserRequest.php
84 84 * Ensure a WP_Error is returned when an invalid email is passed. 85 85 * 86 86 * @ticket 44707 87 * 88 * @covers ::wp_create_user_request 87 89 */ 88 90 public function test_invalid_email() { 89 91 $actual = wp_create_user_request( 'not-a-valid-email', 'export_personal_data' ); … … 96 98 * Ensure a WP_Error is returned when no action is passed. 97 99 * 98 100 * @ticket 46536 101 * 102 * @covers ::wp_create_user_request 99 103 */ 100 104 public function test_missing_action() { 101 105 $actual = wp_create_user_request( self::$registered_user_email, false ); … … 109 113 * 110 114 * @ticket 44707 111 115 * @ticket 46536 116 * 117 * @covers ::wp_create_user_request 112 118 */ 113 119 public function test_invalid_action() { 114 120 $actual = wp_create_user_request( self::$registered_user_email, 'invalid_action_name' ); … … 121 127 * When there are incomplete requests for a registered user, a WP_Error should be returned. 122 128 * 123 129 * @ticket 44707 130 * 131 * @covers ::wp_create_user_request 124 132 */ 125 133 public function test_failure_due_to_incomplete_registered_user() { 126 134 // Second request (duplicated). … … 134 142 * When there are incomplete requests for an non-registered user, a WP_Error should be returned. 135 143 * 136 144 * @ticket 44707 145 * 146 * @covers ::wp_create_user_request 137 147 */ 138 148 public function test_failure_due_to_incomplete_unregistered_user() { 139 149 // Update first request. … … 156 166 * Ensure emails are properly sanitized. 157 167 * 158 168 * @ticket 44707 169 * 170 * @covers ::wp_create_user_request 159 171 */ 160 172 public function test_sanitized_email() { 161 173 $actual = wp_create_user_request( 'some(email<withinvalid\characters@local.test', 'export_personal_data' ); … … 172 184 * Ensure action names are properly sanitized. 173 185 * 174 186 * @ticket 44707 187 * 188 * @covers ::wp_create_user_request 175 189 */ 176 190 public function test_sanitized_action_name() { 177 191 $actual = wp_create_user_request( self::$non_registered_user_email, 'export[_person*al_\data' ); … … 188 202 * Test a user request is created successfully for a registered user. 189 203 * 190 204 * @ticket 44707 205 * 206 * @covers ::wp_create_user_request 191 207 */ 192 208 public function test_create_request_registered_user() { 193 209 wp_delete_post( self::$request_id, true ); … … 215 231 * Test a user request is created successfully for an non-registered user. 216 232 * 217 233 * @ticket 44707 234 * 235 * @covers ::wp_create_user_request 218 236 */ 219 237 public function test_create_request_unregistered_user() { 220 238 wp_delete_post( self::$request_id, true ); … … 243 261 * block a new request. 244 262 * 245 263 * @ticket 44707 264 * 265 * @covers ::wp_create_user_request 246 266 */ 247 267 public function test_completed_request_does_not_block_new_request() { 248 268 // Update first request. … … 270 290 * block a new request. 271 291 * 272 292 * @ticket 44707 293 * 294 * @covers ::wp_create_user_request 273 295 */ 274 296 public function test_completed_request_does_not_block_new_request_for_unregistered_user() { 275 297 wp_update_post( … … 298 320 * Test that an error from `wp_insert_post()` is returned. 299 321 * 300 322 * @ticket 44707 323 * 324 * @covers ::wp_create_user_request 301 325 */ 302 326 public function test_wp_error_returned_from_wp_insert_post() { 303 327 wp_delete_post( self::$request_id, true ); -
tests/phpunit/tests/privacy/wpPrivacyCompletedRequest.php
38 38 * The function should return error for invalid request ID. 39 39 * 40 40 * @ticket 43913 41 * 42 * @covers ::_wp_privacy_completed_request 41 43 */ 42 44 public function test_wp_privacy_completed_request_should_return_error_for_invalid_request_id() { 43 45 $actual = _wp_privacy_completed_request( 0 ); … … 53 55 * The function should mark a request as completed. 54 56 * 55 57 * @ticket 43913 58 * 59 * @covers ::_wp_privacy_completed_request 56 60 */ 57 61 public function test_wp_privacy_completed_request_should_mark_request_completed() { 58 62 $this->assertSame( 'request-pending', get_post_status( self::$request_id ) ); … … 64 68 * The function should log the request timestamp. 65 69 * 66 70 * @ticket 43913 71 * 72 * @covers ::_wp_privacy_completed_request 67 73 */ 68 74 public function test_wp_privacy_completed_request_should_log_request_timestamp() { 69 75 $this->assertEmpty( get_post_meta( self::$request_id, '_wp_user_request_completed_timestamp', true ) ); -
tests/phpunit/tests/privacy/wpPrivacyDeleteOldExportFiles.php
83 83 * The function should not throw notices when the exports directory doesn't exist. 84 84 * 85 85 * @since 4.9.6 86 * 87 * @covers ::wp_privacy_delete_old_export_files 86 88 */ 87 89 public function test_non_existent_folders_should_not_cause_errors() { 88 90 add_filter( 'wp_privacy_exports_dir', array( $this, 'filter_bad_exports_dir' ) ); … … 115 117 * The function should delete files that are past the expiration date. 116 118 * 117 119 * @since 4.9.6 120 * 121 * @covers ::wp_privacy_delete_old_export_files 118 122 */ 119 123 public function test_expired_files_should_be_deleted() { 120 124 wp_privacy_delete_old_export_files(); … … 126 130 * The function should not delete files that are not past the expiration date. 127 131 * 128 132 * @since 4.9.6 133 * 134 * @covers ::wp_privacy_delete_old_export_files 129 135 */ 130 136 public function test_unexpired_files_should_not_be_deleted() { 131 137 wp_privacy_delete_old_export_files(); … … 137 143 * The function should never delete the index file, even if it's past the expiration date. 138 144 * 139 145 * @since 4.9.6 146 * 147 * @covers ::wp_privacy_delete_old_export_files 140 148 */ 141 149 public function test_index_file_should_never_be_deleted() { 142 150 wp_privacy_delete_old_export_files(); … … 148 156 * Test the correct files are deleted when the expiration time is filtered. 149 157 * 150 158 * @since 4.9.9 159 * 160 * @covers ::wp_privacy_delete_old_export_files 151 161 */ 152 162 public function test_filtered_expiration_time() { 153 163 add_filter( 'wp_privacy_export_expiration', array( $this, 'filter_export_file_expiration_time' ) ); -
tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
159 159 * When a remove request ID is passed to the export function an error should be displayed. 160 160 * 161 161 * @ticket 44233 162 * 163 * @covers ::wp_privacy_generate_personal_data_export_file 162 164 */ 163 165 public function test_rejects_remove_requests() { 164 166 $request_id = wp_create_user_request( 'removal-requester@example.com', 'remove_personal_data' ); … … 172 174 * When an invalid request ID is passed an error should be displayed. 173 175 * 174 176 * @ticket 44233 177 * 178 * @covers ::wp_privacy_generate_personal_data_export_file 175 179 */ 176 180 public function test_invalid_request_id() { 177 181 $this->expectException( 'WPDieException' ); … … 183 187 * When the request post title is not a valid email an error should be displayed. 184 188 * 185 189 * @ticket 44233 190 * 191 * @covers ::wp_privacy_generate_personal_data_export_file 186 192 */ 187 193 public function test_rejects_requests_with_bad_email_addresses() { 188 194 $request_id = wp_create_user_request( 'bad-email-requester@example.com', 'export_personal_data' ); … … 203 209 * When the export directory fails to be created an error should be displayed. 204 210 * 205 211 * @ticket 44233 212 * 213 * @covers ::wp_privacy_generate_personal_data_export_file 206 214 */ 207 215 public function test_detect_cannot_create_folder() { 208 216 // Create a file with the folder name to ensure the function cannot create a folder. … … 217 225 * Test that an index.html file can be added to the export directory. 218 226 * 219 227 * @ticket 44233 228 * 229 * @covers ::wp_privacy_generate_personal_data_export_file 220 230 */ 221 231 public function test_creates_index_in_export_folder() { 222 232 $this->expectOutputString( '' ); … … 229 239 * Test that an export file is successfully created. 230 240 * 231 241 * @ticket 44233 242 * 243 * @covers ::wp_privacy_generate_personal_data_export_file 232 244 */ 233 245 public function test_can_succeed() { 234 246 wp_privacy_generate_personal_data_export_file( self::$export_request_id ); … … 240 252 * Test the export HTML file has all the expected parts. 241 253 * 242 254 * @ticket 44233 255 * 256 * @covers ::wp_privacy_generate_personal_data_export_file 243 257 */ 244 258 public function test_html_contents() { 245 259 $this->expectOutputString( '' ); … … 269 283 * Test the export JSON file has all the expected parts. 270 284 * 271 285 * @ticket 49029 286 * 287 * @covers ::wp_privacy_generate_personal_data_export_file 272 288 */ 273 289 public function test_json_contents() { 274 290 $this->expectOutputString( '' ); … … 299 315 * Test the export HTML file containing one export group has no table of contents. 300 316 * 301 317 * @ticket 46894 318 * 319 * @covers ::wp_privacy_generate_personal_data_export_file 302 320 */ 303 321 public function test_single_group_export_no_toc_or_return_to_top() { 304 322 $this->expectOutputString( '' ); … … 328 346 * Test the export HTML file containing ore than one export group has a table of contents. 329 347 * 330 348 * @ticket 46894 349 * 350 * @covers ::wp_privacy_generate_personal_data_export_file 331 351 */ 332 352 public function test_multiple_group_export_has_toc_and_return_to_top() { 333 353 $this->expectOutputString( '' ); … … 405 425 * has a table of contents with group count. 406 426 * 407 427 * @ticket 46894 428 * 429 * @covers ::wp_privacy_generate_personal_data_export_file 408 430 */ 409 431 public function test_multiple_group_export_multiple_items_group_count_in_toc() { 410 432 $this->expectOutputString( '' ); … … 547 569 * has a table of contents without group count. 548 570 * 549 571 * @ticket 46894 572 * 573 * @covers ::wp_privacy_generate_personal_data_export_file 550 574 */ 551 575 public function test_multiple_group_export_single_items_no_group_count_in_toc() { 552 576 $this->expectOutputString( '' ); -
tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportGroupHtml.php
21 21 * Test when a single data item is passed. 22 22 * 23 23 * @ticket 44044 24 * 25 * @covers ::wp_privacy_generate_personal_data_export_group_html 24 26 */ 25 27 public function test_group_html_generation_single_data_item() { 26 28 $data = array( … … 51 53 * 52 54 * @ticket 44044 53 55 * @ticket 46895 Updated to remove </h2> from test to avoid Count introducing failure. 56 * 57 * @covers ::wp_privacy_generate_personal_data_export_group_html 54 58 */ 55 59 public function test_group_html_generation_multiple_data_items() { 56 60 $data = array( … … 95 99 * Values that appear to be links should be wrapped in `<a>` tags. 96 100 * 97 101 * @ticket 44044 102 * 103 * @covers ::wp_privacy_generate_personal_data_export_group_html 98 104 */ 99 105 public function test_links_become_anchors() { 100 106 $data = array( … … 128 134 * HTML in group labels should be escaped. 129 135 * 130 136 * @ticket 44044 137 * 138 * @covers ::wp_privacy_generate_personal_data_export_group_html 131 139 */ 132 140 public function test_group_labels_escaped() { 133 141 $data = array( … … 144 152 * Test that the exported data should contain allowed HTML. 145 153 * 146 154 * @ticket 44044 155 * 156 * @covers ::wp_privacy_generate_personal_data_export_group_html 147 157 */ 148 158 public function test_allowed_html_not_stripped() { 149 159 $data = array( … … 171 181 * Test that the exported data should not contain disallowed HTML. 172 182 * 173 183 * @ticket 44044 184 * 185 * @covers ::wp_privacy_generate_personal_data_export_group_html 174 186 */ 175 187 public function test_disallowed_html_is_stripped() { 176 188 $data = array( … … 202 214 * Test group count is displayed for multiple items. 203 215 * 204 216 * @ticket 46895 217 * 218 * @covers ::wp_privacy_generate_personal_data_export_group_html 205 219 */ 206 220 public function test_group_html_generation_should_display_group_count_when_multiple_items() { 207 221 $data = array( … … 233 247 * Test group count is not displayed for a single item. 234 248 * 235 249 * @ticket 46895 250 * 251 * @covers ::wp_privacy_generate_personal_data_export_group_html 236 252 */ 237 253 public function test_group_html_generation_should_not_display_group_count_when_single_item() { 238 254 $data = array( -
tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php
268 268 * @dataProvider data_wp_privacy_process_personal_data_export_page 269 269 * 270 270 * @param string|array $expected_response The response from the personal data exporter for the given test. 271 * 272 * @covers ::wp_privacy_process_personal_data_export_page 271 273 */ 272 274 public function test_wp_privacy_process_personal_data_export_page( $expected_response ) { 273 275 $actual_response = wp_privacy_process_personal_data_export_page( … … 358 360 * @dataProvider data_send_as_email_options 359 361 * 360 362 * @param bool Whether the final results of the export should be emailed to the user. 363 * 364 * @covers ::wp_privacy_process_personal_data_export_page 361 365 */ 362 366 public function test_send_error_when_invalid_request_id( $send_as_email ) { 363 367 $response = array( … … 388 392 * @dataProvider data_send_as_email_options 389 393 * 390 394 * @param bool Whether the final results of the export should be emailed to the user. 395 * 396 * @covers ::wp_privacy_process_personal_data_export_page 391 397 */ 392 398 public function test_send_error_when_invalid_request_action_name( $send_as_email ) { 393 399 $response = array( … … 421 427 * 422 428 * @param bool Whether the final results of the export should be emailed to the user. 423 429 * 430 * @covers ::wp_privacy_process_personal_data_export_page 431 * 424 432 */ 425 433 public function test_raw_data_post_meta( $send_as_email ) { 426 434 $this->assertEmpty( get_post_meta( self::$request_id, '_export_data_raw', true ) ); … … 461 469 * @dataProvider data_send_as_email_options 462 470 * 463 471 * @param bool Whether the final results of the export should be emailed to the user. 472 * 473 * @covers ::wp_privacy_process_personal_data_export_page 464 474 */ 465 475 public function test_add_post_meta_with_groups_data_only_available_when_export_file_generated( $send_as_email ) { 466 476 // Adds post meta when processing data, given the first exporter on the first page and send as email. … … 496 506 * When mail delivery fails, the function should send a JSON error on the last page of the last exporter. 497 507 * 498 508 * @ticket 44233 509 * 510 * @covers ::wp_privacy_process_personal_data_export_page 499 511 */ 500 512 public function test_send_error_on_last_page_of_last_exporter_when_mail_delivery_fails() { 501 513 // Cause `wp_mail()` to return false, to simulate mail delivery failure. Filter removed in tearDown. … … 520 532 * for the last exporter on the last page. 521 533 * 522 534 * @ticket 44233 535 * 536 * @covers ::wp_privacy_process_personal_data_export_page 523 537 */ 524 538 public function test_return_response_with_export_file_url_when_not_sent_as_email_for_last_exporter_on_last_page() { 525 539 update_post_meta( self::$request_id, '_export_file_name', self::$export_file_name ); … … 546 560 * for the last exporter on the last page. 547 561 * 548 562 * @ticket 44233 563 * 564 * @covers ::wp_privacy_process_personal_data_export_page 549 565 */ 550 566 public function test_return_response_without_export_file_url_when_sent_as_email_for_last_exporter_on_last_page() { 551 567 update_post_meta( self::$request_id, '_export_file_name', self::$export_file_name ); … … 579 595 * @param string $page_index The page index to pass. Options are 'first' and 'last'. Default 'first'. 580 596 * @param bool $send_as_email If the response should be sent as an email. 581 597 * @param string $exporter_key The slug (key) of the exporter to pass. 598 * 599 * @covers ::wp_privacy_process_personal_data_export_page 582 600 */ 583 601 public function test_request_status_transitions_correctly( $expected_status, $response_page, $exporter_index, $page_index, $send_as_email, $exporter_key ) { 584 602 if ( 'first' === $response_page ) { -
tests/phpunit/tests/privacy/wpPrivacySendErasureFulfillmentNotification.php
108 108 * The function should send an email when a valid request ID is passed. 109 109 * 110 110 * @ticket 44234 111 * 112 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 111 113 */ 112 114 public function test_should_send_email_no_privacy_policy() { 113 115 … … 129 131 * The email should include a link to the site's privacy policy when set. 130 132 * 131 133 * @ticket 44234 134 * 135 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 132 136 */ 133 137 public function test_should_send_email_with_privacy_policy() { 134 138 $privacy_policy = $this->factory->post->create( … … 154 158 * The function should send a fulfillment email only once. 155 159 * 156 160 * @ticket 44234 161 * 162 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 157 163 */ 158 164 public function test_should_send_email_only_once() { 159 165 // First function call. … … 182 188 * The email address of the recipient of the fulfillment notification should be filterable. 183 189 * 184 190 * @ticket 44234 191 * 192 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 185 193 */ 186 194 public function test_email_address_of_recipient_should_be_filterable() { 187 195 add_filter( 'user_erasure_fulfillment_email_to', array( $this, 'filter_email_address' ) ); … … 208 216 * The email subject of the fulfillment notification should be filterable. 209 217 * 210 218 * @ticket 44234 219 * 220 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 211 221 */ 212 222 public function test_email_subject_should_be_filterable() { 213 223 add_filter( 'user_erasure_complete_email_subject', array( $this, 'filter_email_subject' ) ); … … 234 244 * The email body text of the fulfillment notification should be filterable. 235 245 * 236 246 * @ticket 44234 247 * 248 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 237 249 */ 238 250 public function test_email_body_text_should_be_filterable() { 239 251 add_filter( 'user_confirmed_action_email_content', array( $this, 'filter_email_body_text' ) ); … … 262 274 * @since 5.4.0 263 275 * 264 276 * @ticket 44501 277 * 278 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 265 279 */ 266 280 public function test_email_headers_should_be_filterable() { 267 281 add_filter( 'user_erasure_complete_email_headers', array( $this, 'modify_email_headers' ) ); … … 292 306 * The function should not send an email when the request ID does not exist. 293 307 * 294 308 * @ticket 44234 309 * 310 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 295 311 */ 296 312 public function test_should_not_send_email_when_passed_invalid_request_id() { 297 313 _wp_privacy_send_erasure_fulfillment_notification( 1234567890 ); … … 305 321 * The function should not send an email when the ID passed does not correspond to a user request. 306 322 * 307 323 * @ticket 44234 324 * 325 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 308 326 */ 309 327 public function test_should_not_send_email_when_not_user_request() { 310 328 $post_id = $this->factory->post->create( … … 323 341 * The function should not send an email when the request is not completed. 324 342 * 325 343 * @ticket 44234 344 * 345 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 326 346 */ 327 347 public function test_should_not_send_email_when_request_not_completed() { 328 348 wp_update_post( … … 346 366 * @since 5.2.0 347 367 * @ticket 44721 348 368 * @group l10n 369 * 370 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 349 371 */ 350 372 public function test_should_send_fulfillment_email_in_user_locale() { 351 373 update_user_meta( self::$request_user->ID, 'locale', 'es_ES' ); … … 363 385 * @since 5.2.0 364 386 * @ticket 44721 365 387 * @group l10n 388 * 389 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 366 390 */ 367 391 public function test_should_send_fulfillment_email_in_user_locale_when_site_is_not_en_us() { 368 392 update_option( 'WPLANG', 'es_ES' ); … … 384 408 * @since 5.2.0 385 409 * @ticket 44721 386 410 * @group l10n 411 * 412 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 387 413 */ 388 414 public function test_should_send_fulfillment_email_in_user_locale_when_admin_and_site_have_different_locales() { 389 415 update_option( 'WPLANG', 'es_ES' ); … … 405 431 * @since 5.2.0 406 432 * @ticket 44721 407 433 * @group l10n 434 * 435 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 408 436 */ 409 437 public function test_should_send_fulfillment_email_in_user_locale_when_both_have_different_locales_than_site() { 410 438 update_option( 'WPLANG', 'es_ES' ); … … 428 456 * @since 5.2.0 429 457 * @ticket 44721 430 458 * @group l10n 459 * 460 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 431 461 */ 432 462 public function test_should_send_fulfillment_email_in_site_locale() { 433 463 update_user_meta( self::$admin_user->ID, 'locale', 'es_ES' ); … … 454 484 * @since 5.2.0 455 485 * @ticket 44721 456 486 * @group l10n 487 * 488 * @covers ::_wp_privacy_send_erasure_fulfillment_notification 457 489 */ 458 490 public function test_should_send_fulfillment_email_in_site_locale_when_not_en_us_and_admin_has_different_locale() { 459 491 update_option( 'WPLANG', 'es_ES' ); -
tests/phpunit/tests/privacy/wpPrivacySendPersonalDataExportEmail.php
102 102 103 103 /** 104 104 * The function should send an export link to the requester when the user request is confirmed. 105 * 106 * @covers ::wp_privacy_send_personal_data_export_email 105 107 */ 106 108 public function test_function_should_send_export_link_to_requester() { 107 109 $exports_url = wp_privacy_exports_url(); … … 124 126 * The function should error when the request ID is invalid. 125 127 * 126 128 * @since 4.9.6 129 * 130 * @covers ::wp_privacy_send_personal_data_export_email 127 131 */ 128 132 public function test_function_should_error_when_request_id_invalid() { 129 133 $request_id = 0; … … 141 145 * The function should error when the email was not sent. 142 146 * 143 147 * @since 4.9.6 148 * 149 * @covers ::wp_privacy_send_personal_data_export_email 144 150 */ 145 151 public function test_return_wp_error_when_send_fails() { 146 152 add_filter( 'wp_mail_from', '__return_empty_string' ); // Cause `wp_mail()` to return false. … … 154 160 * The export expiration should be filterable. 155 161 * 156 162 * @since 4.9.6 163 * 164 * @covers ::wp_privacy_send_personal_data_export_email 157 165 */ 158 166 public function test_export_expiration_should_be_filterable() { 159 167 add_filter( 'wp_privacy_export_expiration', array( $this, 'modify_export_expiration' ) ); … … 180 188 * The email address of the recipient of the personal data export notification should be filterable. 181 189 * 182 190 * @ticket 46303 191 * 192 * @covers ::wp_privacy_send_personal_data_export_email 183 193 */ 184 194 public function test_email_address_of_recipient_should_be_filterable() { 185 195 add_filter( 'wp_privacy_personal_data_email_to', array( $this, 'filter_email_address' ) ); … … 206 216 * The email subject of the personal data export notification should be filterable. 207 217 * 208 218 * @ticket 46303 219 * 220 * @covers ::wp_privacy_send_personal_data_export_email 209 221 */ 210 222 public function test_email_subject_should_be_filterable() { 211 223 add_filter( 'wp_privacy_personal_data_email_subject', array( $this, 'filter_email_subject' ) ); … … 232 244 * The email content should be filterable. 233 245 * 234 246 * @since 4.9.6 247 * 248 * @covers ::wp_privacy_send_personal_data_export_email 235 249 */ 236 250 public function test_email_content_should_be_filterable() { 237 251 add_filter( 'wp_privacy_personal_data_email_content', array( $this, 'modify_email_content' ), 10, 2 ); … … 260 274 * @since 5.4.0 261 275 * 262 276 * @ticket 44501 277 * 278 * @covers ::wp_privacy_send_personal_data_export_email 263 279 */ 264 280 public function test_email_headers_should_be_filterable() { 265 281 add_filter( 'wp_privacy_personal_data_email_headers', array( $this, 'modify_email_headers' ) ); … … 290 306 * The email content should be filterable using the $email_data 291 307 * 292 308 * @ticket 46303 309 * 310 * @covers ::wp_privacy_send_personal_data_export_email 293 311 */ 294 312 public function test_email_content_should_be_filterable_using_email_data() { 295 313 add_filter( 'wp_privacy_personal_data_email_content', array( $this, 'modify_email_content_with_email_data' ), 10, 3 ); … … 333 351 * @since 5.2.0 334 352 * @ticket 46056 335 353 * @group l10n 354 * 355 * @covers ::wp_privacy_send_personal_data_export_email 336 356 */ 337 357 public function test_should_send_personal_data_export_email_in_user_locale() { 338 358 update_user_meta( self::$request_user->ID, 'locale', 'es_ES' ); … … 351 371 * @since 5.2.0 352 372 * @ticket 46056 353 373 * @group l10n 374 * 375 * @covers ::wp_privacy_send_personal_data_export_email 354 376 */ 355 377 public function test_should_send_personal_data_export_email_in_user_locale_when_site_is_not_en_us() { 356 378 update_option( 'WPLANG', 'es_ES' ); … … 373 395 * @since 5.2.0 374 396 * @ticket 46056 375 397 * @group l10n 398 * 399 * @covers ::wp_privacy_send_personal_data_export_email 376 400 */ 377 401 public function test_should_send_personal_data_export_email_in_user_locale_when_admin_and_site_have_different_locales() { 378 402 update_option( 'WPLANG', 'es_ES' ); … … 395 419 * @since 5.2.0 396 420 * @ticket 46056 397 421 * @group l10n 422 * 423 * @covers ::wp_privacy_send_personal_data_export_email 398 424 */ 399 425 public function test_should_send_personal_data_export_email_in_user_locale_when_both_have_different_locales_than_site() { 400 426 update_option( 'WPLANG', 'es_ES' ); … … 419 445 * @since 5.2.0 420 446 * @ticket 46056 421 447 * @group l10n 448 * 449 * @covers ::wp_privacy_send_personal_data_export_email 422 450 */ 423 451 public function test_should_send_personal_data_export_email_in_site_locale() { 424 452 update_user_meta( self::$admin_user->ID, 'locale', 'es_ES' ); … … 441 469 * @since 5.2.0 442 470 * @ticket 46056 443 471 * @group l10n 472 * 473 * @covers ::wp_privacy_send_personal_data_export_email 444 474 */ 445 475 public function test_should_send_personal_data_export_email_in_site_locale_when_not_en_us_and_admin_has_different_locale() { 446 476 update_option( 'WPLANG', 'es_ES' ); -
tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php
39 39 * The function should not send emails when the request ID does not exist. 40 40 * 41 41 * @ticket 43967 42 * 43 * @covers ::_wp_privacy_send_request_confirmation_notification 42 44 */ 43 45 public function test_function_should_not_send_email_when_not_a_valid_request_id() { 44 46 _wp_privacy_send_request_confirmation_notification( 1234567890 ); … … 51 53 * The function should not send emails when the ID passed is not a WP_User_Request. 52 54 * 53 55 * @ticket 43967 56 * 57 * @covers ::_wp_privacy_send_request_confirmation_notification 54 58 */ 55 59 public function test_function_should_not_send_email_when_not_a_wp_user_request() { 56 60 $post_id = $this->factory->post->create( … … 69 73 * The function should send an email to the site admin when a user request is confirmed. 70 74 * 71 75 * @ticket 43967 76 * 77 * @covers ::_wp_privacy_send_request_confirmation_notification 72 78 */ 73 79 public function test_function_should_send_email_to_site_admin_when_user_request_confirmed() { 74 80 $email = 'export.request.from.unregistered.user@example.com'; … … 92 98 * The function should only send an email to the site admin when a user request is confirmed. 93 99 * 94 100 * @ticket 43967 101 * 102 * @covers ::_wp_privacy_send_request_confirmation_notification 95 103 */ 96 104 public function test_function_should_only_send_email_to_site_admin_when_user_request_is_confirmed() { 97 105 $email = 'export.request.from.unregistered.user@example.com'; … … 112 120 * The function should only send an email once to the site admin when a user request is confirmed. 113 121 * 114 122 * @ticket 43967 123 * 124 * @covers ::_wp_privacy_send_request_confirmation_notification 115 125 */ 116 126 public function test_function_should_only_send_email_once_to_admin_when_user_request_is_confirmed() { 117 127 $email = 'export.request.from.unregistered.user@example.com'; … … 136 146 * The email address should be filterable. 137 147 * 138 148 * @ticket 43967 149 * 150 * @covers ::_wp_privacy_send_request_confirmation_notification 139 151 */ 140 152 public function test_email_address_should_be_filterable() { 141 153 $email = 'export.request.from.unregistered.user@example.com'; … … 169 181 * The email content should be filterable. 170 182 * 171 183 * @ticket 43967 184 * 185 * @covers ::_wp_privacy_send_request_confirmation_notification 172 186 */ 173 187 public function test_email_content_should_be_filterable() { 174 188 $email = 'export.request.from.unregistered.user@example.com'; … … 213 227 * @since 5.4.0 214 228 * 215 229 * @ticket 44501 230 * 231 * @covers ::_wp_privacy_send_request_confirmation_notification 216 232 */ 217 233 public function test_email_headers_should_be_filterable() { 218 234 $email = 'export.request.from.unregistered.user@example.com';