Changeset 52984
- Timestamp:
- 03/23/2022 03:01:48 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media/getPostGalleries.php
r52797 r52984 17 17 18 18 /** 19 * Test that an empty array is returned for a post that does not exist.19 * Tests that an empty array is returned for a post that does not exist. 20 20 * 21 21 * @ticket 43826 … … 27 27 28 28 /** 29 * Test that an empty array is returned for a post that has no gallery.29 * Tests that an empty array is returned for a post that has no gallery. 30 30 * 31 31 * @ticket 43826 … … 43 43 44 44 /** 45 * Test that only galleries are returned.45 * Tests that only galleries are returned. 46 46 * 47 47 * @dataProvider data_returns_only_galleries … … 119 119 120 120 /** 121 * Test that no srcs are returned for a shortcode gallery121 * Tests that no srcs are returned for a shortcode gallery 122 122 * in a post with no attached images. 123 123 * … … 151 151 ); 152 152 153 // This prevents future changes from causing 154 // backwards compatibility breaks. 153 /* 154 * This prevents future changes from causing 155 * backwards compatibility breaks. 156 */ 155 157 $this->assertArrayHasKey( 156 158 'src', … … 166 168 167 169 /** 168 * Test that no srcs are returned for a gallery block170 * Tests that no srcs are returned for a gallery block 169 171 * in a post with no attached images. 170 172 * … … 198 200 ); 199 201 200 // The method can return an array of strings 201 // instead of an array of arrays. 202 /* 203 * The method can return an array of strings 204 * instead of an array of arrays. 205 */ 202 206 $this->assertIsArray( 203 207 $galleries[0], … … 205 209 ); 206 210 207 // This prevents future changes from causing 208 // backwards compatibility breaks. 211 /* 212 * This prevents future changes from causing 213 * backwards compatibility breaks. 214 */ 209 215 $this->assertArrayHasKey( 210 216 'src', … … 220 226 221 227 /** 222 * Test that no srcs are returned for a gallery block v2228 * Tests that no srcs are returned for a gallery block v2 223 229 * in a post with no attached images. 224 230 * … … 273 279 ); 274 280 275 // The method can return an array of strings 276 // instead of an array of arrays. 281 /* 282 * The method can return an array of strings 283 * instead of an array of arrays. 284 */ 277 285 $this->assertIsArray( 278 286 $galleries[0], … … 280 288 ); 281 289 282 // This prevents future changes from causing 283 // backwards compatibility breaks. 290 /* 291 * This prevents future changes from causing 292 * backwards compatibility breaks. 293 */ 284 294 $this->assertArrayHasKey( 285 295 'src', … … 296 306 297 307 /** 298 * Test that HTML is returned for a shortcode gallery.308 * Tests that HTML is returned for a shortcode gallery. 299 309 * 300 310 * @ticket 43826 … … 333 343 ); 334 344 335 // The method can return an array of arrays 336 // instead of an array of strings. 345 /* 346 * The method can return an array of arrays 347 * instead of an array of strings. 348 */ 337 349 $this->assertIsString( 338 350 $galleries[0], … … 348 360 349 361 /** 350 * Test that HTML is returned for a block gallery.362 * Tests that HTML is returned for a block gallery. 351 363 * 352 364 * @ticket 43826 … … 394 406 ); 395 407 396 // The method can return an array of arrays 397 // instead of an array of strings. 408 /* 409 * The method can return an array of arrays 410 * instead of an array of strings. 411 */ 398 412 $this->assertIsString( 399 413 $galleries[0], … … 409 423 410 424 /** 411 * Test that HTML is returned for a block gallery v2.425 * Tests that HTML is returned for a block gallery v2. 412 426 * 413 427 * @ticket 43826 … … 460 474 ); 461 475 462 // The method can return an array of arrays 463 // instead of an array of strings. 476 /* 477 * The method can return an array of arrays 478 * instead of an array of strings. 479 */ 464 480 $this->assertIsString( 465 481 $galleries[0], … … 475 491 476 492 /** 477 * Test that the global post object does not override493 * Tests that the global post object does not override 478 494 * a provided post ID with a shortcode gallery. 479 495 * … … 516 532 ); 517 533 518 // This prevents future changes from causing 519 // backwards compatibility breaks. 534 /* 535 * This prevents future changes from causing 536 * backwards compatibility breaks. 537 */ 520 538 $this->assertArrayHasKey( 521 539 'src', … … 532 550 533 551 /** 534 * Test that the global post object does not override552 * Tests that the global post object does not override 535 553 * a provided post ID with a block gallery. 536 554 * … … 602 620 ); 603 621 604 // This prevents future changes from causing 605 // backwards compatibility breaks. 622 /* 623 * This prevents future changes from causing 624 * backwards compatibility breaks. 625 */ 606 626 $this->assertArrayHasKey( 607 627 'src', … … 623 643 624 644 /** 625 * Test that the global post object does not override645 * Tests that the global post object does not override 626 646 * a provided post ID with a block gallery v2. 627 647 * … … 695 715 ); 696 716 697 // This prevents future changes from causing 698 // backwards compatibility breaks. 717 /* 718 * This prevents future changes from causing 719 * backwards compatibility breaks. 720 */ 699 721 $this->assertArrayHasKey( 700 722 'src', … … 716 738 717 739 /** 718 * Test that the gallery only contains images specified in740 * Tests that the gallery only contains images specified in 719 741 * the shortcode's id attribute. 720 742 * … … 765 787 ); 766 788 767 // The method can return an array of strings 768 // instead of an array of arrays. 789 /* 790 * The method can return an array of strings 791 * instead of an array of arrays. 792 */ 769 793 $this->assertIsArray( 770 794 $galleries[0], … … 772 796 ); 773 797 774 // This prevents future changes from causing 775 // backwards compatibility breaks. 798 /* 799 * This prevents future changes from causing 800 * backwards compatibility breaks. 801 */ 776 802 $this->assertArrayHasKey( 777 803 'src', … … 788 814 789 815 /** 790 * Test that galleries only contain images specified in the816 * Tests that galleries only contain images specified in the 791 817 * id attribute of their respective shortcode and block. 792 818 * … … 797 823 */ 798 824 public function test_respects_shortcode_and_block_id_attributes() { 799 // Test the get_post_galleries() function in $html=false mode, with both shortcode and block galleries 825 /* 826 * Test the get_post_galleries() function in `$html = false` mode, 827 * with both shortcode and block galleries. 828 */ 800 829 $ids = array(); 801 830 $imgs = array(); … … 849 878 850 879 /** 851 * Test that galleries contain the additional attributes880 * Tests that galleries contain the additional attributes 852 881 * specified for their respective shortcode and block. 853 882 * … … 858 887 */ 859 888 public function test_respects_additional_shortcode_and_block_attributes() { 860 // Test attributes returned by get_post_galleries() function in $html=false mode, with both shortcode and block galleries 889 /* 890 * Test attributes returned by get_post_galleries() function in `$html = false` mode, 891 * with both shortcode and block galleries. 892 */ 861 893 $ids = array(); 862 894 $imgs = array(); … … 896 928 array( 897 929 'ids' => $ids1_joined, 898 // The shortcode code passes arbitrary attributes 930 // The shortcode code passes arbitrary attributes. 899 931 'type' => 'type', 900 932 'foo' => 'bar', … … 903 935 array( 904 936 'ids' => $ids2_joined, 905 // The block only passes ids, no other attributes 937 // The block only passes ids, no other attributes. 906 938 'src' => array_slice( $ids_srcs, 3, 3 ), 907 939 ), … … 913 945 914 946 /** 915 * Test that srcs are retrieved from the HTML of a block gallery947 * Tests that srcs are retrieved from the HTML of a block gallery 916 948 * that has no JSON blob. 917 949 * … … 959 991 ); 960 992 961 // The method can return an array of strings 962 // instead of an array of arrays. 993 /* 994 * The method can return an array of strings 995 * instead of an array of arrays. 996 */ 963 997 $this->assertIsArray( 964 998 $galleries[0], … … 966 1000 ); 967 1001 968 // This prevents future changes from causing 969 // backwards compatibility breaks. 1002 /* 1003 * This prevents future changes from causing 1004 * backwards compatibility breaks. 1005 */ 970 1006 $this->assertArrayHasKey( 971 1007 'src', … … 982 1018 983 1019 /** 984 * Test that srcs are returned for a block gallery nested within1020 * Tests that srcs are returned for a block gallery nested within 985 1021 * other blocks. 986 1022 * … … 1023 1059 ); 1024 1060 1025 // The method can return an array of strings 1026 // instead of an array of arrays. 1061 /* 1062 * The method can return an array of strings 1063 * instead of an array of arrays. 1064 */ 1027 1065 $this->assertIsArray( 1028 1066 $galleries[0], … … 1030 1068 ); 1031 1069 1032 // This prevents future changes from causing 1033 // backwards compatibility breaks. 1070 /* 1071 * This prevents future changes from causing 1072 * backwards compatibility breaks. 1073 */ 1034 1074 $this->assertArrayHasKey( 1035 1075 'src',
Note: See TracChangeset
for help on using the changeset viewer.