Changeset 42343 for trunk/tests/phpunit/tests/oembed/template.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/oembed/template.php
r40526 r42343 6 6 class Tests_Embed_Template extends WP_UnitTestCase { 7 7 function test_oembed_output_post() { 8 $user = self::factory()->user->create_and_get( array( 9 'display_name' => 'John Doe', 10 ) ); 11 12 $post_id = self::factory()->post->create( array( 13 'post_author' => $user->ID, 14 'post_title' => 'Hello World', 15 'post_content' => 'Foo Bar', 16 'post_excerpt' => 'Bar Baz', 17 ) ); 8 $user = self::factory()->user->create_and_get( 9 array( 10 'display_name' => 'John Doe', 11 ) 12 ); 13 14 $post_id = self::factory()->post->create( 15 array( 16 'post_author' => $user->ID, 17 'post_title' => 'Hello World', 18 'post_content' => 'Foo Bar', 19 'post_excerpt' => 'Bar Baz', 20 ) 21 ); 18 22 $this->go_to( get_post_embed_url( $post_id ) ); 19 23 … … 31 35 32 36 function test_oembed_output_post_with_thumbnail() { 33 $post_id = self::factory()->post->create( array( 34 'post_title' => 'Hello World', 35 'post_content' => 'Foo Bar', 36 'post_excerpt' => 'Bar Baz', 37 ) ); 37 $post_id = self::factory()->post->create( 38 array( 39 'post_title' => 'Hello World', 40 'post_content' => 'Foo Bar', 41 'post_excerpt' => 'Bar Baz', 42 ) 43 ); 38 44 $file = DIR_TESTDATA . '/images/canola.jpg'; 39 $attachment_id = self::factory()->attachment->create_object( $file, $post_id, array( 40 'post_mime_type' => 'image/jpeg', 41 ) ); 45 $attachment_id = self::factory()->attachment->create_object( 46 $file, $post_id, array( 47 'post_mime_type' => 'image/jpeg', 48 ) 49 ); 42 50 set_post_thumbnail( $post_id, $attachment_id ); 43 51 … … 75 83 $post = self::factory()->post->create_and_get(); 76 84 $file = DIR_TESTDATA . '/images/canola.jpg'; 77 $attachment_id = self::factory()->attachment->create_object( $file, $post->ID, array( 78 'post_mime_type' => 'image/jpeg', 79 'post_title' => 'Hello World', 80 'post_content' => 'Foo Bar', 81 'post_excerpt' => 'Bar Baz', 82 ) ); 85 $attachment_id = self::factory()->attachment->create_object( 86 $file, $post->ID, array( 87 'post_mime_type' => 'image/jpeg', 88 'post_title' => 'Hello World', 89 'post_content' => 'Foo Bar', 90 'post_excerpt' => 'Bar Baz', 91 ) 92 ); 83 93 84 94 $this->go_to( get_post_embed_url( $attachment_id ) ); … … 98 108 99 109 function test_oembed_output_draft_post() { 100 $post_id = self::factory()->post->create( array( 101 'post_title' => 'Hello World', 102 'post_content' => 'Foo Bar', 103 'post_excerpt' => 'Bar Baz', 104 'post_status' => 'draft', 105 ) ); 110 $post_id = self::factory()->post->create( 111 array( 112 'post_title' => 'Hello World', 113 'post_content' => 'Foo Bar', 114 'post_excerpt' => 'Bar Baz', 115 'post_status' => 'draft', 116 ) 117 ); 106 118 107 119 $this->go_to( get_post_embed_url( $post_id ) ); … … 119 131 120 132 function test_oembed_output_scheduled_post() { 121 $post_id = self::factory()->post->create( array( 122 'post_title' => 'Hello World', 123 'post_content' => 'Foo Bar', 124 'post_excerpt' => 'Bar Baz', 125 'post_status' => 'future', 126 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ), 127 ) ); 133 $post_id = self::factory()->post->create( 134 array( 135 'post_title' => 'Hello World', 136 'post_content' => 'Foo Bar', 137 'post_excerpt' => 'Bar Baz', 138 'post_status' => 'future', 139 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ), 140 ) 141 ); 128 142 129 143 $this->go_to( get_post_embed_url( $post_id ) ); … … 141 155 142 156 function test_oembed_output_private_post() { 143 $post_id = self::factory()->post->create( array( 144 'post_title' => 'Hello World', 145 'post_content' => 'Foo Bar', 146 'post_excerpt' => 'Bar Baz', 147 'post_status' => 'private', 148 ) ); 157 $post_id = self::factory()->post->create( 158 array( 159 'post_title' => 'Hello World', 160 'post_content' => 'Foo Bar', 161 'post_excerpt' => 'Bar Baz', 162 'post_status' => 'private', 163 ) 164 ); 149 165 150 166 $this->go_to( get_post_embed_url( $post_id ) ); … … 165 181 wp_set_current_user( $user_id ); 166 182 167 $post_id = self::factory()->post->create( array( 168 'post_title' => 'Hello World', 169 'post_content' => 'Foo Bar', 170 'post_excerpt' => 'Bar Baz', 171 'post_status' => 'private', 172 'post_author' => $user_id, 173 ) ); 183 $post_id = self::factory()->post->create( 184 array( 185 'post_title' => 'Hello World', 186 'post_content' => 'Foo Bar', 187 'post_excerpt' => 'Bar Baz', 188 'post_status' => 'private', 189 'post_author' => $user_id, 190 ) 191 ); 174 192 175 193 $this->go_to( get_post_embed_url( $post_id ) ); … … 194 212 195 213 function test_wp_embed_excerpt_more() { 196 $post_id = self::factory()->post->create( array( 197 'post_title' => 'Foo Bar', 198 'post_content' => 'Bar Baz', 199 ) ); 214 $post_id = self::factory()->post->create( 215 array( 216 'post_title' => 'Foo Bar', 217 'post_content' => 'Bar Baz', 218 ) 219 ); 200 220 201 221 $this->assertEquals( '', wp_embed_excerpt_more( '' ) ); … … 224 244 $post_id = self::factory()->post->create(); 225 245 $file = DIR_TESTDATA . '/images/canola.jpg'; 226 $attachment_id = self::factory()->attachment->create_object( $file, $post_id, array( 227 'post_mime_type' => 'image/jpeg', 228 ) ); 246 $attachment_id = self::factory()->attachment->create_object( 247 $file, $post_id, array( 248 'post_mime_type' => 'image/jpeg', 249 ) 250 ); 229 251 $this->go_to( get_post_embed_url( $attachment_id ) ); 230 252 $this->assertTrue( is_embed() ); … … 243 265 function test_get_post_embed_html() { 244 266 $post_id = self::factory()->post->create(); 245 $title = esc_attr(267 $title = esc_attr( 246 268 sprintf( 247 269 __( '“%1$s” — %2$s' ),
Note: See TracChangeset
for help on using the changeset viewer.