|
@@ 1065-1077 (lines=13) @@
|
| 1062 |
|
/** |
| 1063 |
|
* @ticket 33878 |
| 1064 |
|
*/ |
| 1065 |
|
function test_wp_get_attachment_image_url() |
| 1066 |
|
{ |
| 1067 |
|
$this->assertFalse(wp_get_attachment_image_url(0)); |
| 1068 |
|
|
| 1069 |
|
$post_id = self::factory()->post->create(); |
| 1070 |
|
$attachment_id = self::factory()->attachment->create_object( |
| 1071 |
|
$this->img_name, $post_id, array( |
| 1072 |
|
'post_mime_type' => 'image/jpeg', |
| 1073 |
|
'post_type' => 'attachment', |
| 1074 |
|
) |
| 1075 |
|
); |
| 1076 |
|
|
| 1077 |
|
$image = wp_get_attachment_image_src($attachment_id, 'thumbnail', false); |
| 1078 |
|
|
| 1079 |
|
$this->assertEquals($image[0], wp_get_attachment_image_url($attachment_id)); |
| 1080 |
|
} |
|
@@ 1085-1100 (lines=16) @@
|
| 1082 |
|
/** |
| 1083 |
|
* @ticket 12235 |
| 1084 |
|
*/ |
| 1085 |
|
function test_wp_get_attachment_caption() |
| 1086 |
|
{ |
| 1087 |
|
$this->assertFalse(wp_get_attachment_caption(0)); |
| 1088 |
|
|
| 1089 |
|
$caption = 'This is a caption.'; |
| 1090 |
|
|
| 1091 |
|
$post_id = self::factory()->post->create(); |
| 1092 |
|
$attachment_id = self::factory()->attachment->create_object( |
| 1093 |
|
$this->img_name, $post_id, array( |
| 1094 |
|
'post_mime_type' => 'image/jpeg', |
| 1095 |
|
'post_type' => 'attachment', |
| 1096 |
|
'post_excerpt' => $caption, |
| 1097 |
|
) |
| 1098 |
|
); |
| 1099 |
|
|
| 1100 |
|
$this->assertFalse(wp_get_attachment_caption($post_id)); |
| 1101 |
|
|
| 1102 |
|
$this->assertEquals($caption, wp_get_attachment_caption($attachment_id)); |
| 1103 |
|
} |