• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress develop tests

WordPress develop tests

WordPress develop tests a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Tests_Ajax_CustomizeMenus::test_ajax_insert_auto_draft_post_success() – Testing successful ajax_insert_auto_draft_post() call.

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 ) );
  }
 

 View on GitHub

Published: 26th November 2019 | Last updated: 20th March 2022

Primary Sidebar

Information

Function name: Tests_Ajax_CustomizeMenus::test_ajax_insert_auto_draft_post_success
Class ref: Tests_Ajax_CustomizeMenus
Plugin ref: WordPress develop tests
Version: 5.9.3
Sourcefile: phpunit/tests/ajax/CustomizeMenus.php
File ref: phpunit/tests/ajax/CustomizeMenus.php
Deprecated?: No
API Letters: A,C,T

Footer

WordPress develop tests
WordPress develop tests
WordPress develop tests a2z
WordPress 6.4.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  develop.wp-a2z.org
© Copyright WordPress develop tests 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites