Changeset 64042
- Timestamp:
- 10/01/2026 09:48:59 PM (4 days ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 3 edited
-
image/functions.php (modified) (1 diff)
-
media.php (modified) (2 diffs)
-
post/attachments.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/functions.php
r64036 r64042 668 668 /** 669 669 * @covers ::wp_crop_image 670 * @group external-http 670 671 * @requires function imagejpeg 671 672 * @requires extension openssl -
trunk/tests/phpunit/tests/media.php
r64033 r64042 77 77 $wp_styles = null; 78 78 parent::set_up(); 79 80 $this->reset_content_media_count(); 81 $this->reset_omit_loading_attr_filter(); 82 $this->reset_high_priority_element_flag(); 79 83 } 80 84 … … 270 274 ); 271 275 $this->assertSame( 1, substr_count( $result, 'wp-caption &myAlignment' ) ); 272 $this->assertSame( 1, preg_match( '/id="myId(?: [0-9]+)?"/', $result ) );276 $this->assertSame( 1, preg_match( '/id="myId(?:-[0-9]+)?"/', $result ) ); 273 277 $this->assertSame( 1, substr_count( $result, self::CAPTION ) ); 274 278 } -
trunk/tests/phpunit/tests/post/attachments.php
r63616 r64042 8 8 class Tests_Post_Attachments extends WP_UnitTestCase { 9 9 10 /** 11 * Original HTTPS value. 12 * 13 * @var string|null 14 */ 15 private $original_https; 16 17 public function set_up() { 18 parent::set_up(); 19 20 $this->original_https = $_SERVER['HTTPS'] ?? null; 21 } 22 10 23 public function tear_down() { 11 24 // Remove all uploads. 12 25 $this->remove_added_uploads(); 26 27 if ( null === $this->original_https ) { 28 unset( $_SERVER['HTTPS'] ); 29 } else { 30 $_SERVER['HTTPS'] = $this->original_https; 31 } 32 13 33 parent::tear_down(); 14 34 } … … 122 142 $this->assertEmpty( $upload['error'] ); 123 143 124 $id = $this->_make_attachment( $upload ); 125 $uploads = wp_upload_dir(); 144 $id = $this->_make_attachment( $upload ); 145 $uploads = wp_upload_dir(); 146 $filename_base = wp_basename( $upload['file'], '.jpg' ); 126 147 127 148 // Intermediate copies should exist: thumbnail and medium. 128 149 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 129 $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );150 $this->assertSame( $filename_base . '-150x150.jpg', $thumb['file'] ); 130 151 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) ); 131 152 132 153 $medium = image_get_intermediate_size( $id, 'medium' ); 133 $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );154 $this->assertSame( $filename_base . '-400x602.jpg', $medium['file'] ); 134 155 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path'] ) ); 135 156 136 157 $medium_large = image_get_intermediate_size( $id, 'medium_large' ); 137 $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );158 $this->assertSame( $filename_base . '-600x904.jpg', $medium_large['file'] ); 138 159 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) ); 139 160 … … 143 164 // image_downsize() should return the correct images and sizes. 144 165 $downsize = image_downsize( $id, 'thumbnail' ); 145 $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) );166 $this->assertSame( $filename_base . '-150x150.jpg', wp_basename( $downsize[0] ) ); 146 167 $this->assertSame( 150, $downsize[1] ); 147 168 $this->assertSame( 150, $downsize[2] ); 148 169 149 170 $downsize = image_downsize( $id, 'medium' ); 150 $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', wp_basename( $downsize[0] ) );171 $this->assertSame( $filename_base . '-400x602.jpg', wp_basename( $downsize[0] ) ); 151 172 $this->assertSame( 400, $downsize[1] ); 152 173 $this->assertSame( 602, $downsize[2] ); 153 174 154 175 $downsize = image_downsize( $id, 'medium_large' ); 155 $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', wp_basename( $downsize[0] ) );176 $this->assertSame( $filename_base . '-600x904.jpg', wp_basename( $downsize[0] ) ); 156 177 $this->assertSame( 600, $downsize[1] ); 157 178 $this->assertSame( 904, $downsize[2] ); 158 179 159 180 $downsize = image_downsize( $id, 'full' ); 160 $this->assertSame( '2007-06-17DSC_4173.jpg', wp_basename( $downsize[0] ) );181 $this->assertSame( $filename_base . '.jpg', wp_basename( $downsize[0] ) ); 161 182 $this->assertSame( 680, $downsize[1] ); 162 183 $this->assertSame( 1024, $downsize[2] ); … … 179 200 $this->assertEmpty( $upload['error'] ); 180 201 181 $id = $this->_make_attachment( $upload ); 182 $uploads = wp_upload_dir(); 202 $id = $this->_make_attachment( $upload ); 203 $uploads = wp_upload_dir(); 204 $filename_base = wp_basename( $upload['file'], '.jpg' ); 183 205 184 206 // Check that the file and intermediates exist. 185 207 $thumb = image_get_intermediate_size( $id, 'thumbnail' ); 186 $this->assertSame( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );208 $this->assertSame( $filename_base . '-150x150.jpg', $thumb['file'] ); 187 209 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) ); 188 210 189 211 $medium = image_get_intermediate_size( $id, 'medium' ); 190 $this->assertSame( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );212 $this->assertSame( $filename_base . '-400x602.jpg', $medium['file'] ); 191 213 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path'] ) ); 192 214 193 215 $medium_large = image_get_intermediate_size( $id, 'medium_large' ); 194 $this->assertSame( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );216 $this->assertSame( $filename_base . '-600x904.jpg', $medium_large['file'] ); 195 217 $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) ); 196 218
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)