Changeset 38949 for trunk/tests/phpunit/tests/image/functions.php
- Timestamp:
- 10/26/2016 07:27:51 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/functions.php
r38762 r38949 352 352 WP_Image_Editor_Mock::$save_return = array(); 353 353 } 354 355 /** 356 * @ticket 31050 357 */ 358 public function test_wp_generate_attachment_metadata_pdf() { 359 if ( ! wp_image_editor_supports( array( 'mime_type' => 'application/pdf' ) ) ) { 360 $this->markTestSkipped( 'Rendering PDFs is not supported on this system.' ); 361 } 362 363 $orig_file = DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf'; 364 $test_file = '/tmp/wordpress-gsoc-flyer.pdf'; 365 copy( $orig_file, $test_file ); 366 367 $attachment_id = $this->factory->attachment->create_object( $test_file, 0, array( 368 'post_mime_type' => 'application/pdf', 369 ) ); 370 371 $this->assertNotEmpty( $attachment_id ); 372 373 $expected = array( 374 'sizes' => array( 375 'thumbnail' => array( 376 'file' => "wordpress-gsoc-flyer-116x150.jpg", 377 'width' => 116, 378 'height' => 150, 379 'mime-type' => "image/jpeg", 380 ), 381 'medium' => array( 382 'file' => "wordpress-gsoc-flyer-232x300.jpg", 383 'width' => 232, 384 'height' => 300, 385 'mime-type' => "image/jpeg", 386 ), 387 'large' => array( 388 'file' => "wordpress-gsoc-flyer-791x1024.jpg", 389 'width' => 791, 390 'height' => 1024, 391 'mime-type' => "image/jpeg", 392 ), 393 'full' => array( 394 'file' => "wordpress-gsoc-flyer.jpg", 395 'width' => 1088, 396 'height' => 1408, 397 'mime-type' => "image/jpeg", 398 ), 399 ), 400 ); 401 402 $metadata = wp_generate_attachment_metadata( $attachment_id, $test_file ); 403 $this->assertSame( $expected, $metadata ); 404 405 unlink( $test_file ); 406 } 354 407 }
Note: See TracChangeset
for help on using the changeset viewer.