Changeset 35299
- Timestamp:
- 10/20/2015 06:22:41 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-site-icon.php
r35271 r35299 230 230 */ 231 231 public function get_post_metadata( $value, $post_id, $meta_key, $single ) { 232 $site_icon_id = get_option( 'site_icon' ); 233 234 if ( $post_id == $site_icon_id && '_wp_attachment_backup_sizes' == $meta_key && $single ) { 235 add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) ); 232 if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) { 233 $site_icon_id = get_option( 'site_icon' ); 234 235 if ( $post_id == $site_icon_id ) { 236 add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) ); 237 } 236 238 } 237 239 -
trunk/tests/phpunit/tests/image/site_icon.php
r33335 r35299 128 128 } 129 129 130 /** 131 * @ticket 34368 132 */ 133 function test_get_post_metadata() { 134 $attachment_id = $this->_insert_attachment(); 135 update_option( 'site_icon', $attachment_id ); 136 137 $this->wp_site_icon->get_post_metadata( '', $attachment_id, '_some_post_meta', true ); 138 $this->assertFalse( has_filter( 'intermediate_image_sizes', array( $this->wp_site_icon, 'intermediate_image_sizes' ) ) ); 139 140 $this->wp_site_icon->get_post_metadata( '', $attachment_id, '_wp_attachment_backup_sizes', true ); 141 $this->assertSame( 10, has_filter( 'intermediate_image_sizes', array( $this->wp_site_icon, 'intermediate_image_sizes' ) ) ); 142 143 wp_delete_attachment( $attachment_id, true ); 144 } 145 130 146 function _custom_test_sizes( $sizes ) { 131 147 $sizes[] = 321; -
trunk/tests/phpunit/tests/post/getPostClass.php
r35242 r35299 121 121 $found = get_post_class( '', $this->post_id ); 122 122 123 // The 'site_icon' option check adds a query during unit tests. See {@see WP_Site_Icon::get_post_metadata()}. 124 $expected_num_queries = $num_queries + 1; 125 126 $this->assertSame( $expected_num_queries, $wpdb->num_queries ); 123 $this->assertSame( $num_queries, $wpdb->num_queries ); 127 124 } 128 125 }
Note: See TracChangeset
for help on using the changeset viewer.