[wp-trac] [WordPress Trac] #17262: wp_get_attachment_thumb_file should check new 'thumbnail' image size

WordPress Trac noreply at wordpress.org
Wed Jul 25 20:51:21 UTC 2018


#17262: wp_get_attachment_thumb_file should check new 'thumbnail' image size
-------------------------------------------------+-------------------------
 Reporter:  lonnylot                             |       Owner:
                                                 |  SergeyBiryukov
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  5.0
Component:  Media                                |     Version:  3.0
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug needs-unit-tests      |     Focuses:
  has-patch                                      |
-------------------------------------------------+-------------------------

Comment (by mirekgab):

 Hi\\

 I am trying to write a unit test for a function
 {{{
 function wp_get_attachment_image_file( $attachment_id, $size = 'thumbnail'
 )
 }}}
 and I need a hint about the parameter `$attachment_id`. Should I use the
 variable `self::$large_id` available in class Tests_Media (file
 `tests/phpunit/tests/media.php`) or create an object like this:
 {{{
 $post_id       = self::factory()->post->create();
 $attachment_id = self::factory()->attachment->create_object(
         $this->img_name, $post_id, array(
                 'post_mime_type' => 'image/jpeg',
                 'post_type'      => 'attachment',
         )
 );
 }}}
 and use created `$attachment_id`, or maybe use something else  ?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/17262#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list