|
@@ 852-878 (lines=27) @@
|
| 849 |
|
/** |
| 850 |
|
* @ticket 22768 |
| 851 |
|
*/ |
| 852 |
|
public function test_media_handle_upload_sets_post_excerpt() |
| 853 |
|
{ |
| 854 |
|
$iptc_file = DIR_TESTDATA . '/images/test-image-iptc.jpg'; |
| 855 |
|
|
| 856 |
|
// Make a copy of this file as it gets moved during the file upload |
| 857 |
|
$tmp_name = wp_tempnam($iptc_file); |
| 858 |
|
|
| 859 |
|
copy($iptc_file, $tmp_name); |
| 860 |
|
|
| 861 |
|
$_FILES['upload'] = array( |
| 862 |
|
'tmp_name' => $tmp_name, |
| 863 |
|
'name' => 'test-image-iptc.jpg', |
| 864 |
|
'type' => 'image/jpeg', |
| 865 |
|
'error' => 0, |
| 866 |
|
'size' => filesize($iptc_file) |
| 867 |
|
); |
| 868 |
|
|
| 869 |
|
$post_id = media_handle_upload('upload', 0, array(), array( 'action' => 'test_iptc_upload', 'test_form' => false )); |
| 870 |
|
|
| 871 |
|
unset($_FILES['upload']); |
| 872 |
|
|
| 873 |
|
$post = get_post($post_id); |
| 874 |
|
|
| 875 |
|
// Clean up. |
| 876 |
|
wp_delete_attachment($post_id); |
| 877 |
|
|
| 878 |
|
$this->assertEquals('This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $post->post_excerpt); |
| 879 |
|
} |
| 880 |
|
|
| 881 |
|
/** |
|
@@ 884-910 (lines=27) @@
|
| 881 |
|
/** |
| 882 |
|
* @ticket 37989 |
| 883 |
|
*/ |
| 884 |
|
public function test_media_handle_upload_expected_titles() |
| 885 |
|
{ |
| 886 |
|
$test_file = DIR_TESTDATA . '/images/test-image.jpg'; |
| 887 |
|
|
| 888 |
|
// Make a copy of this file as it gets moved during the file upload |
| 889 |
|
$tmp_name = wp_tempnam($test_file); |
| 890 |
|
|
| 891 |
|
copy($test_file, $tmp_name); |
| 892 |
|
|
| 893 |
|
$_FILES['upload'] = array( |
| 894 |
|
'tmp_name' => $tmp_name, |
| 895 |
|
'name' => 'This is a test.jpg', |
| 896 |
|
'type' => 'image/jpeg', |
| 897 |
|
'error' => 0, |
| 898 |
|
'size' => filesize($test_file), |
| 899 |
|
); |
| 900 |
|
|
| 901 |
|
$post_id = media_handle_upload('upload', 0, array(), array( 'action' => 'test_upload_titles', 'test_form' => false )); |
| 902 |
|
|
| 903 |
|
unset($_FILES['upload']); |
| 904 |
|
|
| 905 |
|
$post = get_post($post_id); |
| 906 |
|
|
| 907 |
|
// Clean up. |
| 908 |
|
wp_delete_attachment($post_id); |
| 909 |
|
|
| 910 |
|
$this->assertEquals('This is a test', $post->post_title); |
| 911 |
|
} |
| 912 |
|
|
| 913 |
|
/** |