|
@@ 383-421 (lines=39) @@
|
| 380 |
|
/** |
| 381 |
|
* @ticket 22960 |
| 382 |
|
*/ |
| 383 |
|
function test_post_galleries_images() |
| 384 |
|
{ |
| 385 |
|
$ids1 = array(); |
| 386 |
|
$ids1_srcs = array(); |
| 387 |
|
foreach ( range(1, 3) as $i ) { |
| 388 |
|
$attachment_id = self::factory()->attachment->create_object( |
| 389 |
|
"image$i.jpg", 0, array( |
| 390 |
|
'post_mime_type' => 'image/jpeg', |
| 391 |
|
'post_type' => 'attachment' |
| 392 |
|
) |
| 393 |
|
); |
| 394 |
|
$metadata = array_merge(array( "file" => "image$i.jpg" ), $this->img_meta); |
| 395 |
|
wp_update_attachment_metadata($attachment_id, $metadata); |
| 396 |
|
$ids1[] = $attachment_id; |
| 397 |
|
$ids1_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg"; |
| 398 |
|
} |
| 399 |
|
|
| 400 |
|
$ids2 = array(); |
| 401 |
|
$ids2_srcs = array(); |
| 402 |
|
foreach ( range(4, 6) as $i ) { |
| 403 |
|
$attachment_id = self::factory()->attachment->create_object( |
| 404 |
|
"image$i.jpg", 0, array( |
| 405 |
|
'post_mime_type' => 'image/jpeg', |
| 406 |
|
'post_type' => 'attachment' |
| 407 |
|
) |
| 408 |
|
); |
| 409 |
|
$metadata = array_merge(array( "file" => "image$i.jpg" ), $this->img_meta); |
| 410 |
|
wp_update_attachment_metadata($attachment_id, $metadata); |
| 411 |
|
$ids2[] = $attachment_id; |
| 412 |
|
$ids2_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg"; |
| 413 |
|
} |
| 414 |
|
|
| 415 |
|
$ids1_joined = join(',', $ids1); |
| 416 |
|
$ids2_joined = join(',', $ids2); |
| 417 |
|
|
| 418 |
|
$blob =<<<BLOB |
| 419 |
|
[gallery ids="$ids1_joined"] |
| 420 |
|
|
| 421 |
|
[gallery ids="$ids2_joined"] |
| 422 |
|
BLOB; |
| 423 |
|
$post_id = self::factory()->post->create(array( 'post_content' => $blob )); |
| 424 |
|
$srcs = get_post_galleries_images($post_id); |
|
@@ 431-469 (lines=39) @@
|
| 428 |
|
/** |
| 429 |
|
* @ticket 22960 |
| 430 |
|
*/ |
| 431 |
|
function test_post_gallery_images() |
| 432 |
|
{ |
| 433 |
|
$ids1 = array(); |
| 434 |
|
$ids1_srcs = array(); |
| 435 |
|
foreach ( range(1, 3) as $i ) { |
| 436 |
|
$attachment_id = self::factory()->attachment->create_object( |
| 437 |
|
"image$i.jpg", 0, array( |
| 438 |
|
'post_mime_type' => 'image/jpeg', |
| 439 |
|
'post_type' => 'attachment' |
| 440 |
|
) |
| 441 |
|
); |
| 442 |
|
$metadata = array_merge(array( "file" => "image$i.jpg" ), $this->img_meta); |
| 443 |
|
wp_update_attachment_metadata($attachment_id, $metadata); |
| 444 |
|
$ids1[] = $attachment_id; |
| 445 |
|
$ids1_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg"; |
| 446 |
|
} |
| 447 |
|
|
| 448 |
|
$ids2 = array(); |
| 449 |
|
$ids2_srcs = array(); |
| 450 |
|
foreach ( range(4, 6) as $i ) { |
| 451 |
|
$attachment_id = self::factory()->attachment->create_object( |
| 452 |
|
"image$i.jpg", 0, array( |
| 453 |
|
'post_mime_type' => 'image/jpeg', |
| 454 |
|
'post_type' => 'attachment' |
| 455 |
|
) |
| 456 |
|
); |
| 457 |
|
$metadata = array_merge(array( "file" => "image$i.jpg" ), $this->img_meta); |
| 458 |
|
wp_update_attachment_metadata($attachment_id, $metadata); |
| 459 |
|
$ids2[] = $attachment_id; |
| 460 |
|
$ids2_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg"; |
| 461 |
|
} |
| 462 |
|
|
| 463 |
|
$ids1_joined = join(',', $ids1); |
| 464 |
|
$ids2_joined = join(',', $ids2); |
| 465 |
|
|
| 466 |
|
$blob =<<<BLOB |
| 467 |
|
[gallery ids="$ids1_joined"] |
| 468 |
|
|
| 469 |
|
[gallery ids="$ids2_joined"] |
| 470 |
|
BLOB; |
| 471 |
|
$post_id = self::factory()->post->create(array( 'post_content' => $blob )); |
| 472 |
|
$srcs = get_post_gallery_images($post_id); |