| 207 | | $this->assertFalse( is_file($thumb['path']) ); |
| 208 | | $this->assertFalse( is_file($medium['path']) ); |
| 209 | | $this->assertFalse( is_file($medium_large['path']) ); |
| 210 | | $this->assertFalse( is_file($original) ); |
| | 207 | $this->assertFalse( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) ); |
| | 208 | $this->assertFalse( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path'] ) ); |
| | 209 | $this->assertFalse( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path'] ) ); |
| | 210 | $this->assertFalse( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $original ) ); |
| | 214 | * Test delete of UTF-8 filename. |
| | 215 | * @ticket 39039 |
| | 216 | */ |
| | 217 | function test_insert_image_delete_utf8() { |
| | 218 | if ( ! function_exists( 'imagejpeg' ) ) { |
| | 219 | $this->markTestSkipped( 'jpeg support unavailable' ); |
| | 220 | } |
| | 221 | |
| | 222 | $prev_ctype_locale = setlocale( LC_CTYPE, 'C' ); // In case shell env has set LC_CTYPE. |
| | 223 | $this->assertTrue( false !== $prev_ctype_locale ); |
| | 224 | |
| | 225 | $contents = file_get_contents( DIR_TESTDATA . '/images/a2-small.jpg' ); // Generates thumbnail only. |
| | 226 | $basename_noext = 'هم اندیشی'; |
| | 227 | |
| | 228 | $upload = wp_upload_bits( $basename_noext . '.jpg', null, $contents ); |
| | 229 | $this->assertEmpty( $upload['error'] ); |
| | 230 | $basename_noext = sanitize_file_name( $basename_noext ); |
| | 231 | |
| | 232 | $id = $this->_make_attachment( $upload ); |
| | 233 | $uploads = wp_upload_dir(); |
| | 234 | |
| | 235 | // check that the intermediate thumbnail exists. |
| | 236 | $thumb = image_get_intermediate_size( $id, 'thumbnail' ); |
| | 237 | $this->assertEquals( $basename_noext . '-150x150.jpg', $thumb['file'] ); |
| | 238 | $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) ); |
| | 239 | |
| | 240 | $meta = wp_get_attachment_metadata( $id ); |
| | 241 | $original = $meta['file']; |
| | 242 | $this->assertTrue( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $original ) ); |
| | 243 | |
| | 244 | // now delete the attachment and make sure all files are gone |
| | 245 | wp_delete_attachment( $id ); |
| | 246 | |
| | 247 | $this->assertFalse( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path'] ) ); |
| | 248 | $this->assertFalse( is_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . $original ) ); |
| | 249 | |
| | 250 | setlocale( LC_CTYPE, $prev_ctype_locale ); |
| | 251 | } |
| | 252 | |
| | 253 | /** |