You appear to be a bot. Output may be restricted
Description
Usage
Tests_Media::test_post_gallery_images();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/media.php
Lines:
1 to 48 of 48
function test_post_gallery_images() { $ids1 = array(); $ids1_srcs = array(); foreach ( range( 1, 3 ) as $i ) { $attachment_id = self::factory()->attachment->create_object( "image$i.jpg", 0, array( 'post_mime_type' => 'image/jpeg', 'post_type' => 'attachment', ) ); $metadata = array_merge( array( 'file' => "image$i.jpg" ), $this->img_meta ); wp_update_attachment_metadata( $attachment_id, $metadata ); $ids1[] = $attachment_id; $ids1_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg"; } $ids2 = array(); $ids2_srcs = array(); foreach ( range( 4, 6 ) as $i ) { $attachment_id = self::factory()->attachment->create_object( "image$i.jpg", 0, array( 'post_mime_type' => 'image/jpeg', 'post_type' => 'attachment', ) ); $metadata = array_merge( array( 'file' => "image$i.jpg" ), $this->img_meta ); wp_update_attachment_metadata( $attachment_id, $metadata ); $ids2[] = $attachment_id; $ids2_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg"; } $ids1_joined = join( ',', $ids1 ); $ids2_joined = join( ',', $ids2 ); $blob = <<<BLOB [gallery ids="$ids1_joined"] [gallery ids="$ids2_joined"] BLOB; $post_id = self::factory()->post->create( array( 'post_content' => $blob ) ); $srcs = get_post_gallery_images( $post_id ); $this->assertEquals( $srcs, $ids1_srcs ); }