diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 506367f..4635d66 100644
|
|
VIDEO; |
443 | 443 | $this->assertTrue( has_image_size( 'test-size' ) ); |
444 | 444 | } |
445 | 445 | |
| 446 | /** |
| 447 | * @ticket 30346 |
| 448 | */ |
| 449 | function test_attachment_url_to_postid() { |
| 450 | $image_path = '2014/11/' . $this->img_name; |
| 451 | $attachment_id = $this->factory->attachment->create_object( $image_path, 0, array( |
| 452 | 'post_mime_type' => 'image/jpeg', |
| 453 | 'post_type' => 'attachment', |
| 454 | ) ); |
| 455 | |
| 456 | $image_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_path; |
| 457 | $this->assertEquals( $attachment_id, attachment_url_to_postid( $image_url ) ); |
| 458 | |
| 459 | add_filter( 'upload_dir', array( $this, '_upload_dir' ) ); |
| 460 | $image_url = 'http://192.168.1.20.com/wp-content/uploads/' . $image_path; |
| 461 | $this->assertEquals( $attachment_id, attachment_url_to_postid( $image_url ) ); |
| 462 | } |
| 463 | |
| 464 | function _upload_dir( $dir ) { |
| 465 | $dir['baseurl'] = 'http://192.168.1.20.com/wp-content/uploads'; |
| 466 | return $dir; |
| 467 | } |
446 | 468 | } |