Changeset 52371 for trunk/tests/phpunit/tests/ajax/CustomizeManager.php
- Timestamp:
- 12/14/2021 03:31:14 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/CustomizeManager.php
r52010 r52371 715 715 $this->assertSame( 'no_autosave_revision_to_delete', $this->_last_response_parsed['data'] ); 716 716 } 717 718 /** 719 * Test request for retrieving installed themes. 720 * 721 * @ticket 54549 722 * @covers WP_Customize_Manager::handle_load_themes_request 723 */ 724 public function test_wp_ajax_customize_load_themes_action() { 725 $arguments = array( 726 'changeset_uuid' => false, 727 'settings_previewed' => true, 728 'branching' => false, 729 ); 730 new WP_Customize_Manager( $arguments ); 731 wp_set_current_user( self::$admin_user_id ); 732 $nonce = wp_create_nonce( 'switch_themes' ); 733 $_POST['nonce'] = $nonce; 734 $_GET['nonce'] = $nonce; 735 $_REQUEST['nonce'] = $nonce; 736 $_POST['theme_action'] = 'installed'; 737 $this->make_ajax_call( 'customize_load_themes' ); 738 $response = $this->_last_response_parsed; 739 $this->assertIsArray( $response, 'Response is not an array' ); 740 741 $this->assertArrayHasKey( 'success', $response, 'Response must have a "success" key' ); 742 $this->assertTrue( $response['success'], 'Response was not "success"' ); 743 744 $this->assertArrayHasKey( 'data', $response, 'Response must have a "data" key' ); 745 $this->assertIsArray( $response['data'], 'The response "data" is not an array' ); 746 $this->assertArrayHasKey( 'themes', $response['data'], 'The response data must have a "themes" key' ); 747 $this->assertIsArray( $response['data']['themes'], 'Themes data is not an array' ); 748 $this->assertNotEmpty( $response['data']['themes'], 'Themes data must not be empty' ); 749 750 foreach ( $response['data']['themes'] as $theme ) { 751 $this->assertIsArray( $theme, 'Theme is not an array' ); 752 $this->assertNotEmpty( $theme, 'Theme data must not be empty' ); 753 $this->assertArrayHasKey( 'id', $theme, 'Theme data must have an "id" key' ); 754 $this->assertNotEmpty( $theme['id'], 'Theme id cannot be empty' ); 755 756 $this->assertArrayHasKey( 'name', $theme, 'Theme data must have a "name" key' ); 757 $this->assertNotEmpty( $theme['name'], 'Theme name cannot be empty' ); 758 759 $this->assertArrayHasKey( 'blockTheme', $theme, 'Themes data must include information about blocks support' ); 760 } 761 } 717 762 }
Note: See TracChangeset
for help on using the changeset viewer.