Changeset 42343 for trunk/tests/phpunit/tests/oembed/getResponseData.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/oembed/getResponseData.php
r35472 r42343 10 10 11 11 function test_get_oembed_response_data() { 12 $post = self::factory()->post->create_and_get( array( 13 'post_title' => 'Some Post', 14 ) ); 12 $post = self::factory()->post->create_and_get( 13 array( 14 'post_title' => 'Some Post', 15 ) 16 ); 15 17 16 18 $data = get_oembed_response_data( $post, 400 ); 17 19 18 $this->assertEqualSets( array( 19 'version' => '1.0', 20 'provider_name' => get_bloginfo( 'name' ), 21 'provider_url' => get_home_url( '/' ), 22 'author_name' => get_bloginfo( 'name' ), 23 'author_url' => get_home_url( '/' ), 24 'title' => 'Some Post', 25 'type' => 'rich', 26 'width' => 400, 27 'height' => 225, 28 'html' => get_post_embed_html( 400, 225, $post ), 29 ), $data ); 20 $this->assertEqualSets( 21 array( 22 'version' => '1.0', 23 'provider_name' => get_bloginfo( 'name' ), 24 'provider_url' => get_home_url( '/' ), 25 'author_name' => get_bloginfo( 'name' ), 26 'author_url' => get_home_url( '/' ), 27 'title' => 'Some Post', 28 'type' => 'rich', 29 'width' => 400, 30 'height' => 225, 31 'html' => get_post_embed_html( 400, 225, $post ), 32 ), $data 33 ); 30 34 } 31 35 … … 34 38 */ 35 39 function test_get_oembed_response_data_author() { 36 $user_id = self::factory()->user->create( array( 37 'display_name' => 'John Doe', 38 ) ); 40 $user_id = self::factory()->user->create( 41 array( 42 'display_name' => 'John Doe', 43 ) 44 ); 39 45 40 $post = self::factory()->post->create_and_get( array( 41 'post_title' => 'Some Post', 42 'post_author' => $user_id, 43 ) ); 46 $post = self::factory()->post->create_and_get( 47 array( 48 'post_title' => 'Some Post', 49 'post_author' => $user_id, 50 ) 51 ); 44 52 45 53 $data = get_oembed_response_data( $post, 400 ); 46 54 47 $this->assertEqualSets( array( 48 'version' => '1.0', 49 'provider_name' => get_bloginfo( 'name' ), 50 'provider_url' => get_home_url( '/' ), 51 'author_name' => 'John Doe', 52 'author_url' => get_author_posts_url( $user_id ), 53 'title' => 'Some Post', 54 'type' => 'rich', 55 'width' => 400, 56 'height' => 225, 57 'html' => get_post_embed_html( 400, 225, $post ), 58 ), $data ); 55 $this->assertEqualSets( 56 array( 57 'version' => '1.0', 58 'provider_name' => get_bloginfo( 'name' ), 59 'provider_url' => get_home_url( '/' ), 60 'author_name' => 'John Doe', 61 'author_url' => get_author_posts_url( $user_id ), 62 'title' => 'Some Post', 63 'type' => 'rich', 64 'width' => 400, 65 'height' => 225, 66 'html' => get_post_embed_html( 400, 225, $post ), 67 ), $data 68 ); 59 69 } 60 70 … … 62 72 remove_filter( 'oembed_response_data', 'get_oembed_response_data_rich' ); 63 73 64 $post = self::factory()->post->create_and_get( array( 65 'post_title' => 'Some Post', 66 ) ); 74 $post = self::factory()->post->create_and_get( 75 array( 76 'post_title' => 'Some Post', 77 ) 78 ); 67 79 68 80 $data = get_oembed_response_data( $post, 600 ); 69 81 70 $this->assertEqualSets( array( 71 'version' => '1.0', 72 'provider_name' => get_bloginfo( 'name' ), 73 'provider_url' => get_home_url( '/' ), 74 'author_name' => get_bloginfo( 'name' ), 75 'author_url' => get_home_url( '/' ), 76 'title' => 'Some Post', 77 'type' => 'link', 78 ), $data ); 82 $this->assertEqualSets( 83 array( 84 'version' => '1.0', 85 'provider_name' => get_bloginfo( 'name' ), 86 'provider_url' => get_home_url( '/' ), 87 'author_name' => get_bloginfo( 'name' ), 88 'author_url' => get_home_url( '/' ), 89 'title' => 'Some Post', 90 'type' => 'link', 91 ), $data 92 ); 79 93 80 94 add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 ); … … 82 96 83 97 function test_get_oembed_response_data_with_draft_post() { 84 $post = self::factory()->post->create_and_get( array( 85 'post_status' => 'draft', 86 ) ); 98 $post = self::factory()->post->create_and_get( 99 array( 100 'post_status' => 'draft', 101 ) 102 ); 87 103 88 104 $this->assertFalse( get_oembed_response_data( $post, 100 ) ); … … 90 106 91 107 function test_get_oembed_response_data_with_scheduled_post() { 92 $post = self::factory()->post->create_and_get( array( 93 'post_status' => 'future', 94 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ), 95 ) ); 108 $post = self::factory()->post->create_and_get( 109 array( 110 'post_status' => 'future', 111 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ), 112 ) 113 ); 96 114 97 115 $this->assertFalse( get_oembed_response_data( $post, 100 ) ); … … 99 117 100 118 function test_get_oembed_response_data_with_private_post() { 101 $post = self::factory()->post->create_and_get( array( 102 'post_status' => 'private', 103 ) ); 119 $post = self::factory()->post->create_and_get( 120 array( 121 'post_status' => 'private', 122 ) 123 ); 104 124 105 125 $this->assertFalse( get_oembed_response_data( $post, 100 ) ); … … 141 161 $post = self::factory()->post->create_and_get(); 142 162 $file = DIR_TESTDATA . '/images/canola.jpg'; 143 $attachment_id = self::factory()->attachment->create_object( $file, $post->ID, array( 144 'post_mime_type' => 'image/jpeg', 145 ) ); 163 $attachment_id = self::factory()->attachment->create_object( 164 $file, $post->ID, array( 165 'post_mime_type' => 'image/jpeg', 166 ) 167 ); 146 168 set_post_thumbnail( $post, $attachment_id ); 147 169 … … 157 179 $parent = self::factory()->post->create(); 158 180 $file = DIR_TESTDATA . '/images/canola.jpg'; 159 $post = self::factory()->attachment->create_object( $file, $parent, array( 160 'post_mime_type' => 'image/jpeg', 161 ) ); 181 $post = self::factory()->attachment->create_object( 182 $file, $parent, array( 183 'post_mime_type' => 'image/jpeg', 184 ) 185 ); 162 186 163 187 $data = get_oembed_response_data( $post, 400 );
Note: See TracChangeset
for help on using the changeset viewer.