| | 1 | <?php |
| | 2 | |
| | 3 | /** |
| | 4 | * @group attachment |
| | 5 | * @ticket 37255 |
| | 6 | */ |
| | 7 | class Tests_Attachment_PassedPost extends WP_UnitTestCase { |
| | 8 | protected static $a; |
| | 9 | protected static $a_id; |
| | 10 | |
| | 11 | public static function wpSetUpBeforeClass() { |
| | 12 | self::$a_id = self::factory()->attachment->create_upload_object( DIR_TESTDATA . '/images/a2-small.jpg' ); |
| | 13 | self::$a = get_post( self::$a_id ); |
| | 14 | } |
| | 15 | |
| | 16 | public function test_wp_get_attachment_url_should_accept_post_id() { |
| | 17 | $str = wp_get_attachment_url( self::$a_id ); |
| | 18 | $this->assertNotEmpty( $str ); |
| | 19 | } |
| | 20 | |
| | 21 | public function test_wp_get_attachment_url_should_accept_post_object() { |
| | 22 | $str = wp_get_attachment_url( self::$a ); |
| | 23 | $this->assertNotEmpty( $str ); |
| | 24 | } |
| | 25 | |
| | 26 | public function test_image_downsize_should_accept_post_id() { |
| | 27 | $arr = image_downsize( self::$a_id ); |
| | 28 | $this->assertNotEmpty( $arr ); |
| | 29 | } |
| | 30 | |
| | 31 | public function test_image_downsize_should_accept_post_object() { |
| | 32 | $arr = image_downsize( self::$a ); |
| | 33 | $this->assertNotEmpty( $arr ); |
| | 34 | } |
| | 35 | |
| | 36 | public function test_get_image_tag_should_accept_post_id() { |
| | 37 | $html = get_image_tag( self::$a_id, 'foo', 'bar', 'center' ); |
| | 38 | $this->assertNotEmpty( $html ); |
| | 39 | } |
| | 40 | |
| | 41 | public function test_get_image_tag_should_accept_post_object() { |
| | 42 | $html = get_image_tag( self::$a, 'foo', 'bar', 'center' ); |
| | 43 | $this->assertNotEmpty( $html ); |
| | 44 | } |
| | 45 | |
| | 46 | public function test_image_get_intermediate_size_should_accept_post_id() { |
| | 47 | $arr = image_get_intermediate_size( self::$a_id ); |
| | 48 | $this->assertNotEmpty( $arr ); |
| | 49 | } |
| | 50 | |
| | 51 | public function test_image_get_intermediate_size_should_accept_post_object() { |
| | 52 | $arr = image_get_intermediate_size( self::$a ); |
| | 53 | $this->assertNotEmpty( $arr ); |
| | 54 | } |
| | 55 | |
| | 56 | public function test_wp_get_attachment_image_src_should_accept_post_id() { |
| | 57 | $arr = wp_get_attachment_image_src( self::$a_id ); |
| | 58 | $this->assertNotEmpty( $arr ); |
| | 59 | } |
| | 60 | |
| | 61 | public function test_wp_get_attachment_image_src_should_accept_post_object() { |
| | 62 | $arr = wp_get_attachment_image_src( self::$a ); |
| | 63 | $this->assertNotEmpty( $arr ); |
| | 64 | } |
| | 65 | |
| | 66 | public function test_wp_get_attachment_image_should_accept_post_id() { |
| | 67 | $html = wp_get_attachment_image( self::$a_id ); |
| | 68 | $this->assertNotEmpty( $html ); |
| | 69 | } |
| | 70 | |
| | 71 | public function test_wp_get_attachment_image_should_accept_post_object() { |
| | 72 | $html = wp_get_attachment_image( self::$a ); |
| | 73 | $this->assertNotEmpty( $html ); |
| | 74 | } |
| | 75 | |
| | 76 | public function test_wp_get_attachment_image_url_should_accept_post_id() { |
| | 77 | $str = wp_get_attachment_image_url( self::$a_id ); |
| | 78 | $this->assertNotEmpty( $str ); |
| | 79 | } |
| | 80 | |
| | 81 | public function test_wp_get_attachment_image_url_should_accept_post_object() { |
| | 82 | $str = wp_get_attachment_image_url( self::$a ); |
| | 83 | $this->assertNotEmpty( $str ); |
| | 84 | } |
| | 85 | |
| | 86 | public function test_wp_get_attachment_image_srcset_should_accept_post_id() { |
| | 87 | $str = wp_get_attachment_image_srcset( self::$a_id ); |
| | 88 | $this->assertNotEmpty( $str ); |
| | 89 | } |
| | 90 | |
| | 91 | public function test_wp_get_attachment_image_srcset_should_accept_post_object() { |
| | 92 | $str = wp_get_attachment_image_srcset( self::$a ); |
| | 93 | $this->assertNotEmpty( $str ); |
| | 94 | } |
| | 95 | |
| | 96 | public function test_wp_get_attachment_image_sizes_should_accept_post_id() { |
| | 97 | $str = wp_get_attachment_image_sizes( self::$a_id ); |
| | 98 | $this->assertNotEmpty( $str ); |
| | 99 | } |
| | 100 | |
| | 101 | public function test_wp_get_attachment_image_sizes_should_accept_post_object() { |
| | 102 | $str = wp_get_attachment_image_sizes( self::$a ); |
| | 103 | $this->assertNotEmpty( $str ); |
| | 104 | } |
| | 105 | |
| | 106 | } |
| | 107 | No newline at end of file |