IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/tests/ajax/Attachments.php b/tests/phpunit/tests/ajax/Attachments.php
a
|
b
|
|
10 | 10 | * @group ajax |
11 | 11 | */ |
12 | 12 | class Tests_Ajax_Attachments extends WP_Ajax_UnitTestCase { |
| 13 | |
| 14 | protected function _uploadFileAndMakeAttachment( $filename ) { |
| 15 | $contents = file_get_contents( $filename ); |
| 16 | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 17 | |
| 18 | return $this->_make_attachment( $upload ); |
| 19 | } |
| 20 | |
13 | 21 | /** |
14 | 22 | * @ticket 36578 |
15 | 23 | * |
… |
… |
|
18 | 26 | */ |
19 | 27 | public function test_wp_ajax_send_attachment_to_editor_should_return_an_image() { |
20 | 28 | // Become an administrator. |
21 | | $post = $_POST; |
22 | | $user_id = self::factory()->user->create( |
23 | | array( |
24 | | 'role' => 'administrator', |
25 | | 'user_login' => 'user_36578_administrator', |
26 | | 'user_email' => 'user_36578_administrator@example.com', |
27 | | ) |
28 | | ); |
29 | | wp_set_current_user( $user_id ); |
30 | | $_POST = array_merge( $_POST, $post ); |
| 29 | $this->_setRole( 'administrator' ); |
31 | 30 | |
32 | | $filename = DIR_TESTDATA . '/images/canola.jpg'; |
33 | | $contents = file_get_contents( $filename ); |
34 | | |
35 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
36 | | $attachment = $this->_make_attachment( $upload ); |
| 31 | $attachment = $this->_uploadFileAndMakeAttachment( DIR_TESTDATA . '/images/canola.jpg' ); |
37 | 32 | |
38 | 33 | // Set up a default request. |
39 | 34 | $_POST['nonce'] = wp_create_nonce( 'media-send-to-editor' ); |
… |
… |
|
74 | 69 | $this->skipWithMultisite(); |
75 | 70 | |
76 | 71 | // Become an administrator. |
77 | | $post = $_POST; |
78 | | $user_id = self::factory()->user->create( |
79 | | array( |
80 | | 'role' => 'administrator', |
81 | | 'user_login' => 'user_36578_administrator', |
82 | | 'user_email' => 'user_36578_administrator@example.com', |
83 | | ) |
84 | | ); |
85 | | wp_set_current_user( $user_id ); |
86 | | $_POST = array_merge( $_POST, $post ); |
| 72 | $this->_setRole( 'administrator' ); |
87 | 73 | |
88 | | $filename = DIR_TESTDATA . '/formatting/entities.txt'; |
89 | | $contents = file_get_contents( $filename ); |
90 | | |
91 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
92 | | $attachment = $this->_make_attachment( $upload ); |
| 74 | $attachment = $this->_uploadFileAndMakeAttachment( DIR_TESTDATA . '/formatting/entities.txt' ); |
93 | 75 | |
94 | 76 | // Set up a default request. |
95 | 77 | $_POST['nonce'] = wp_create_nonce( 'media-send-to-editor' ); |