Changeset 54090 for trunk/tests/phpunit/tests/media/getPostGalleries.php
- Timestamp:
- 09/06/2022 10:09:49 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media/getPostGalleries.php
r53852 r54090 29 29 */ 30 30 public function test_returns_empty_array_with_post_with_no_gallery() { 31 $post_id = $this->factory->post->create(31 $post_id = self::factory()->post->create( 32 32 array( 33 33 'post_content' => '<p>A post with no gallery</p>', … … 50 50 */ 51 51 public function test_returns_only_galleries( $content, $needle ) { 52 $image_id = $this->factory->attachment->create_object(52 $image_id = self::factory()->attachment->create_object( 53 53 array( 54 54 'file' => 'test.jpg', … … 67 67 ); 68 68 69 $post_id = $this->factory->post->create(69 $post_id = self::factory()->post->create( 70 70 array( 71 71 'post_content' => $content, … … 125 125 public function test_returns_no_srcs_with_shortcode_in_post_with_no_attached_images() { 126 126 // Set up an unattached image. 127 $this->factory->attachment->create_object(127 self::factory()->attachment->create_object( 128 128 array( 129 129 'file' => 'test.jpg', … … 134 134 ); 135 135 136 $post_id = $this->factory->post->create(136 $post_id = self::factory()->post->create( 137 137 array( 138 138 'post_content' => '[gallery]', … … 174 174 public function test_returns_no_srcs_with_block_in_post_with_no_attached_images() { 175 175 // Set up an unattached image. 176 $this->factory->attachment->create_object(176 self::factory()->attachment->create_object( 177 177 array( 178 178 'file' => 'test.jpg', … … 183 183 ); 184 184 185 $post_id = $this->factory->post->create(185 $post_id = self::factory()->post->create( 186 186 array( 187 187 'post_content' => '<!-- wp:gallery -->', … … 232 232 public function test_returns_no_srcs_with_block_v2_in_post_with_no_attached_images() { 233 233 // Set up an unattached image. 234 $image_id = $this->factory->attachment->create_object(234 $image_id = self::factory()->attachment->create_object( 235 235 array( 236 236 'file' => 'test.jpg', … … 261 261 BLOB; 262 262 263 $post_id = $this->factory->post->create(263 $post_id = self::factory()->post->create( 264 264 array( 265 265 'post_content' => $blob, … … 310 310 */ 311 311 public function test_returns_html_with_shortcode_gallery() { 312 $post_id = $this->factory->post->create(312 $post_id = self::factory()->post->create( 313 313 array( 314 314 'post_content' => 'I have no gallery', … … 316 316 ); 317 317 318 $post_id_two = $this->factory->post->create(318 $post_id_two = self::factory()->post->create( 319 319 array( 320 320 'post_content' => "[gallery id='$post_id']", … … 322 322 ); 323 323 324 $this->factory->attachment->create_object(324 self::factory()->attachment->create_object( 325 325 array( 326 326 'file' => 'test.jpg', … … 364 364 */ 365 365 public function test_returns_html_with_block_gallery() { 366 $post_id = $this->factory->post->create(366 $post_id = self::factory()->post->create( 367 367 array( 368 368 'post_content' => 'I have no gallery.', … … 371 371 372 372 // Set up an unattached image. 373 $image_id = $this->factory->attachment->create(373 $image_id = self::factory()->attachment->create( 374 374 array( 375 375 'file' => 'test.jpg', … … 388 388 BLOB; 389 389 390 $post_id_two = $this->factory->post->create(390 $post_id_two = self::factory()->post->create( 391 391 array( 392 392 'post_content' => $blob, … … 427 427 */ 428 428 public function test_returns_html_with_block_gallery_v2() { 429 $image_id = $this->factory->attachment->create_object(429 $image_id = self::factory()->attachment->create_object( 430 430 array( 431 431 'file' => 'test.jpg', … … 456 456 BLOB; 457 457 458 $post_id = $this->factory->post->create(458 $post_id = self::factory()->post->create( 459 459 array( 460 460 'post_content' => $blob, … … 496 496 */ 497 497 public function test_respects_post_id_with_shortcode_gallery() { 498 $global_post_id = $this->factory->post->create(498 $global_post_id = self::factory()->post->create( 499 499 array( 500 500 'post_content' => 'Global Post', 501 501 ) 502 502 ); 503 $post_id = $this->factory->post->create(503 $post_id = self::factory()->post->create( 504 504 array( 505 505 'post_content' => '[gallery]', 506 506 ) 507 507 ); 508 $this->factory->attachment->create_object(508 self::factory()->attachment->create_object( 509 509 array( 510 510 'file' => 'test.jpg', … … 578 578 $ids_joined = join( ',', $ids ); 579 579 580 $global_post_id = $this->factory->post->create(580 $global_post_id = self::factory()->post->create( 581 581 array( 582 582 'post_content' => 'Global Post', … … 589 589 BLOB; 590 590 591 $post_id = $this->factory->post->create(591 $post_id = self::factory()->post->create( 592 592 array( 593 593 'post_content' => $blob, 594 594 ) 595 595 ); 596 $this->factory->attachment->create_object(596 self::factory()->attachment->create_object( 597 597 array( 598 598 'file' => 'test.jpg', … … 658 658 $metadata = array_merge( array( 'file' => 'image1.jpg' ), self::IMG_META ); 659 659 $url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . 'image1.jpg'; 660 $global_post_id = $this->factory->post->create(660 $global_post_id = self::factory()->post->create( 661 661 array( 662 662 'post_content' => 'Global Post', … … 684 684 BLOB; 685 685 686 $post_id = $this->factory->post->create(686 $post_id = self::factory()->post->create( 687 687 array( 688 688 'post_content' => $blob, 689 689 ) 690 690 ); 691 $this->factory->attachment->create_object(691 self::factory()->attachment->create_object( 692 692 array( 693 693 'file' => 'test.jpg', … … 743 743 */ 744 744 public function test_respects_shortcode_id_attribute() { 745 $post_id = $this->factory->post->create(745 $post_id = self::factory()->post->create( 746 746 array( 747 747 'post_content' => 'No gallery defined', 748 748 ) 749 749 ); 750 $post_id_two = $this->factory->post->create(750 $post_id_two = self::factory()->post->create( 751 751 array( 752 752 'post_content' => "[gallery id='$post_id']", 753 753 ) 754 754 ); 755 $this->factory->attachment->create_object(755 self::factory()->attachment->create_object( 756 756 array( 757 757 'file' => 'test.jpg', … … 951 951 public function test_returns_srcs_from_html_with_block_with_no_json_blob() { 952 952 // Set up an unattached image. 953 $image_id = $this->factory->attachment->create_object(953 $image_id = self::factory()->attachment->create_object( 954 954 array( 955 955 'file' => 'test.jpg', … … 973 973 BLOB; 974 974 975 $post_id = $this->factory->post->create(975 $post_id = self::factory()->post->create( 976 976 array( 977 977 'post_content' => $blob, … … 1023 1023 */ 1024 1024 public function test_returns_srcs_with_nested_block_gallery() { 1025 $post_id = $this->factory->post->create(1025 $post_id = self::factory()->post->create( 1026 1026 array( 1027 1027 'post_content' => 'I have no gallery.', 1028 1028 ) 1029 1029 ); 1030 $image_id = $this->factory->attachment->create_object(1030 $image_id = self::factory()->attachment->create_object( 1031 1031 array( 1032 1032 'file' => 'test.jpg', … … 1046 1046 BLOB; 1047 1047 1048 $post_id_two = $this->factory->post->create( array( 'post_content' => $blob ) );1048 $post_id_two = self::factory()->post->create( array( 'post_content' => $blob ) ); 1049 1049 1050 1050 $galleries = get_post_galleries( $post_id_two, false );
Note: See TracChangeset
for help on using the changeset viewer.