Changeset 37915 for trunk/tests/phpunit/tests/post/thumbnails.php
- Timestamp:
- 06/29/2016 05:28:00 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/thumbnails.php
r35244 r37915 75 75 } 76 76 77 /** 78 * @ticket 12235 79 */ 80 function test_get_the_post_thumbnail_caption() { 81 $this->assertEquals( '', get_the_post_thumbnail_caption() ); 82 83 $caption = 'This is a caption.'; 84 85 $post_id = self::factory()->post->create(); 86 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 87 'post_mime_type' => 'image/jpeg', 88 'post_type' => 'attachment', 89 'post_excerpt' => $caption, 90 ) ); 91 92 set_post_thumbnail( $post_id, $attachment_id ); 93 94 $this->assertEquals( $caption, get_the_post_thumbnail_caption( $post_id ) ); 95 } 96 97 /** 98 * @ticket 12235 99 */ 100 function test_get_the_post_thumbnail_caption_empty() { 101 $post_id = self::factory()->post->create(); 102 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 103 'post_mime_type' => 'image/jpeg', 104 'post_type' => 'attachment', 105 'post_excerpt' => '', 106 ) ); 107 108 set_post_thumbnail( $post_id, $attachment_id ); 109 110 $this->assertEquals( '', get_the_post_thumbnail_caption( $post_id ) ); 111 } 112 113 /** 114 * @ticket 12235 115 */ 116 function test_the_post_thumbnail_caption() { 117 $caption = 'This is a caption.'; 118 119 $post_id = self::factory()->post->create(); 120 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 121 'post_mime_type' => 'image/jpeg', 122 'post_type' => 'attachment', 123 'post_excerpt' => $caption, 124 ) ); 125 126 set_post_thumbnail( $post_id, $attachment_id ); 127 128 ob_start(); 129 the_post_thumbnail_caption( $post_id ); 130 131 $this->assertEquals( $caption, ob_get_clean() ); 132 } 133 77 134 function test_get_the_post_thumbnail() { 78 135 $this->assertEquals( '', get_the_post_thumbnail() );
Note: See TracChangeset
for help on using the changeset viewer.