Changeset 47122 for trunk/tests/phpunit/tests/ajax/Attachments.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/ajax/Attachments.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/Attachments.php
r46586 r47122 1 1 <?php 2 2 /** 3 * Admin ajax functions to be tested3 * Admin Ajax functions to be tested. 4 4 */ 5 5 require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' ); 6 6 7 7 /** 8 * Testing ajax attachment handling.8 * Testing Ajax attachment handling. 9 9 * 10 10 * @group ajax … … 15 15 */ 16 16 public function test_wp_ajax_send_attachment_to_editor_should_return_an_image() { 17 // Become an administrator 17 // Become an administrator. 18 18 $post = $_POST; 19 19 $user_id = self::factory()->user->create( … … 33 33 $attachment = $this->_make_attachment( $upload ); 34 34 35 // Set up a default request 35 // Set up a default request. 36 36 $_POST['nonce'] = wp_create_nonce( 'media-send-to-editor' ); 37 37 $_POST['html'] = 'Bar Baz'; … … 45 45 ); 46 46 47 // Make the request 47 // Make the request. 48 48 try { 49 49 $this->_handleAjax( 'send-attachment-to-editor' ); … … 57 57 $expected = get_image_send_to_editor( $attachment, '', '', 'left', 'http://example.com/', false, 'large', 'Foo bar' ); 58 58 59 // Ensure everything is correct 59 // Ensure everything is correct. 60 60 $this->assertTrue( $response['success'] ); 61 61 $this->assertEquals( $expected, $response['data'] ); … … 66 66 */ 67 67 public function test_wp_ajax_send_attachment_to_editor_should_return_a_link() { 68 // Become an administrator 68 // Become an administrator. 69 69 $post = $_POST; 70 70 $user_id = self::factory()->user->create( … … 84 84 $attachment = $this->_make_attachment( $upload ); 85 85 86 // Set up a default request 86 // Set up a default request. 87 87 $_POST['nonce'] = wp_create_nonce( 'media-send-to-editor' ); 88 88 $_POST['html'] = 'Bar Baz'; … … 94 94 ); 95 95 96 // Make the request 96 // Make the request. 97 97 try { 98 98 $this->_handleAjax( 'send-attachment-to-editor' ); … … 110 110 ); 111 111 112 // Ensure everything is correct 112 // Ensure everything is correct. 113 113 $this->assertTrue( $response['success'] ); 114 114 $this->assertEquals( $expected, $response['data'] );
Note: See TracChangeset
for help on using the changeset viewer.