Changeset 41839 for trunk/tests/phpunit/tests/ajax/CustomizeManager.php
- Timestamp:
- 10/12/2017 04:00:15 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/CustomizeManager.php
r41667 r41839 517 517 * 518 518 * @ticket 39896 519 * @covers WP_Customize_Manager::handle_dismiss_autosave_ request()519 * @covers WP_Customize_Manager::handle_dismiss_autosave_or_lock_request() 520 520 * @covers WP_Customize_Manager::dismiss_user_auto_draft_changesets() 521 521 */ 522 public function test_handle_dismiss_autosave_ request() {522 public function test_handle_dismiss_autosave_or_lock_request() { 523 523 $uuid = wp_generate_uuid4(); 524 524 $wp_customize = $this->set_up_valid_state( $uuid ); 525 525 526 $this->make_ajax_call( 'customize_dismiss_autosave ' );526 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 527 527 $this->assertFalse( $this->_last_response_parsed['success'] ); 528 528 $this->assertEquals( 'invalid_nonce', $this->_last_response_parsed['data'] ); 529 529 530 $nonce = wp_create_nonce( 'customize_dismiss_autosave ' );530 $nonce = wp_create_nonce( 'customize_dismiss_autosave_or_lock' ); 531 531 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce; 532 $this->make_ajax_call( 'customize_dismiss_autosave' ); 532 533 $_POST['dismiss_lock'] = $_GET['dismiss_lock'] = $_REQUEST['dismiss_lock'] = true; 534 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 535 $this->assertFalse( $this->_last_response_parsed['success'] ); 536 $this->assertEquals( 'no_changeset_to_dismiss_lock', $this->_last_response_parsed['data'] ); 537 538 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true; 539 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 533 540 $this->assertFalse( $this->_last_response_parsed['success'] ); 534 541 $this->assertEquals( 'no_auto_draft_to_delete', $this->_last_response_parsed['data'] ); … … 560 567 $this->assertFalse( (bool) get_post_meta( $post_id, '_customize_restore_dismissed', true ) ); 561 568 } 562 $this->make_ajax_call( 'customize_dismiss_autosave ' );569 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 563 570 $this->assertTrue( $this->_last_response_parsed['success'] ); 564 571 $this->assertEquals( 'auto_draft_dismissed', $this->_last_response_parsed['data'] ); … … 573 580 574 581 // Subsequent test results in none dismissed. 575 $this->make_ajax_call( 'customize_dismiss_autosave ' );582 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 576 583 $this->assertFalse( $this->_last_response_parsed['success'] ); 577 584 $this->assertEquals( 'no_auto_draft_to_delete', $this->_last_response_parsed['data'] ); … … 586 593 'status' => 'draft', 587 594 ) ); 595 596 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = false; 597 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 598 $this->assertTrue( $this->_last_response_parsed['success'] ); 599 $this->assertEquals( 'changeset_lock_dismissed', $this->_last_response_parsed['data'] ); 600 601 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true; 588 602 $this->assertNotInstanceOf( 'WP_Error', $r ); 589 603 $this->assertFalse( wp_get_post_autosave( $wp_customize->changeset_post_id() ) ); … … 591 605 592 606 // Since no autosave yet, confirm no action. 593 $this->make_ajax_call( 'customize_dismiss_autosave ' );607 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 594 608 $this->assertFalse( $this->_last_response_parsed['success'] ); 595 609 $this->assertEquals( 'no_autosave_revision_to_delete', $this->_last_response_parsed['data'] ); … … 611 625 612 626 // Confirm autosave gets deleted. 613 $this->make_ajax_call( 'customize_dismiss_autosave ' );627 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 614 628 $this->assertTrue( $this->_last_response_parsed['success'] ); 615 629 $this->assertEquals( 'autosave_revision_deleted', $this->_last_response_parsed['data'] ); … … 617 631 618 632 // Since no autosave yet, confirm no action. 619 $this->make_ajax_call( 'customize_dismiss_autosave ' );633 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 620 634 $this->assertFalse( $this->_last_response_parsed['success'] ); 621 635 $this->assertEquals( 'no_autosave_revision_to_delete', $this->_last_response_parsed['data'] );
Note: See TracChangeset
for help on using the changeset viewer.