You appear to be a bot. Output may be restricted
Description
Testing successful ajax_insert_auto_draft_post() call.
Usage
Tests_Ajax_CustomizeMenus::test_ajax_insert_auto_draft_post_success();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/ajax/CustomizeMenus.php
Lines:
1 to 26 of 26
public function test_ajax_insert_auto_draft_post_success() { $_POST = wp_slash( array( 'customize-menus-nonce' => wp_create_nonce( 'customize-menus' ), 'params' => array( 'post_type' => 'post', 'post_title' => 'Hello World', ), ) ); $this->_last_response = ''; $this->make_ajax_call( 'customize-nav-menus-insert-auto-draft' ); $response = json_decode( $this->_last_response, true ); $this->assertTrue( $response['success'] ); $this->assertArrayHasKey( 'post_id', $response['data'] ); $this->assertArrayHasKey( 'url', $response['data'] ); $post = get_post( $response['data']['post_id'] ); $this->assertSame( 'Hello World', $post->post_title ); $this->assertSame( 'post', $post->post_type ); $this->assertSame( '', $post->post_name ); $this->assertSame( 'hello-world', get_post_meta( $post->ID, '_customize_draft_post_name', true ) ); $this->assertSame( $this->wp_customize->changeset_uuid(), get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ); }