- Timestamp:
- 10/08/2015 10:27:17 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/class-bp-media-extractor.php
r10221 r10223 325 325 326 326 public function test_extract_images_from_content_with_galleries_variant_ids() { 327 // To test the [gallery] shortcode, we need to create a post and attachments. 328 $attachment_ids = array(); 329 foreach ( range( 1, 3 ) as $i ) { 330 $attachment_id = $this->factory->attachment->create_object( "image{$i}.jpg", 0, array( 331 'post_mime_type' => 'image/jpeg', 332 'post_type' => 'attachment' 333 ) ); 334 335 wp_update_attachment_metadata( $attachment_id, array( 'width' => 100, 'height' => 100 ) ); 336 $attachment_ids[] = $attachment_id; 337 } 338 339 $attachment_ids = join( ',', $attachment_ids ); 340 $post_id = $this->factory->post->create( array( 'post_content' => "[gallery ids='{$attachment_ids}']" ) ); 341 327 $attachment_ids = array(); 328 $attachment_ids[] = $this->fake_attachment_upload( DIR_TESTDATA . '/images/test-image-large.png' ); 329 $attachment_ids[] = $this->fake_attachment_upload( DIR_TESTDATA . '/images/canola.jpg' ); 330 $attachment_ids = join( ',', $attachment_ids ); 331 $post_id = $this->factory->post->create( array( 'post_content' => "[gallery ids='{$attachment_ids}']" ) ); 342 332 343 333 // Extract the gallery images. … … 348 338 $this->assertArrayHasKey( 'images', $media ); 349 339 $media = array_values( wp_list_filter( $media['images'], array( 'source' => 'galleries' ) ) ); 350 $this->assertCount( 3, $media ); 351 352 for ( $i = 1; $i <= 3; $i++ ) { 353 $this->assertSame( 'http://' . WP_TESTS_DOMAIN . "/wp-content/uploads/image{$i}.jpg", $media[ $i - 1 ]['url'] ); 354 } 340 $this->assertCount( 2, $media ); 341 342 $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/test-image-large.png', $media[0]['url'] ); 343 $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/canola.jpg', $media[1]['url'] ); 355 344 } 356 345
Note: See TracChangeset
for help on using the changeset viewer.