/** * @ticket 30937 * @covers wp_admin_bar_customize_menu() */ public function test_customize_link() { global $wp_customize; require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $uuid = wp_generate_uuid4(); $this->go_to(home_url("/?customize_changeset_uuid={$uuid}")); wp_set_current_user(self::$admin_id); $this->factory()->post->create(array('post_type' => 'customize_changeset', 'post_status' => 'auto-draft', 'post_name' => $uuid)); $wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid)); $wp_customize->start_previewing_theme(); set_current_screen('front'); $wp_admin_bar = $this->get_standard_admin_bar(); $node = $wp_admin_bar->get_node('customize'); $this->assertNotEmpty($node); $parsed_url = wp_parse_url($node->href); $query_params = array(); wp_parse_str($parsed_url['query'], $query_params); $this->assertEquals($uuid, $query_params['changeset_uuid']); $this->assertNotContains('changeset_uuid', $query_params['url']); }
/** * @see WP_Widget::is_preview() */ function test_wp_widget_is_preview() { global $wp_customize; $widget = new WP_Widget('foo', 'Foo'); $this->assertEmpty($wp_customize); $this->assertFalse($widget->is_preview()); wp_set_current_user($this->factory->user->create(array('role' => 'administrator'))); require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $wp_customize = new WP_Customize_Manager(); $wp_customize->start_previewing_theme(); $this->assertTrue($widget->is_preview()); }
/** * @group site_icon * @ticket 38377 */ function test_customize_preview_wp_site_icon_dirty() { global $wp_customize; wp_set_current_user($this->factory()->user->create(array('role' => 'administrator'))); require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; $wp_customize = new WP_Customize_Manager(); $wp_customize->register_controls(); $wp_customize->start_previewing_theme(); $attachment_id = $this->_insert_attachment(); $wp_customize->set_post_value('site_icon', $attachment_id); $wp_customize->get_setting('site_icon')->preview(); $output = array(sprintf('<link rel="icon" href="%s" sizes="32x32" />', esc_url(wp_get_attachment_image_url($attachment_id, 32))), sprintf('<link rel="icon" href="%s" sizes="192x192" />', esc_url(wp_get_attachment_image_url($attachment_id, 192))), sprintf('<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url(wp_get_attachment_image_url($attachment_id, 180))), sprintf('<meta name="msapplication-TileImage" content="%s" />', esc_url(wp_get_attachment_image_url($attachment_id, 270))), ''); $output = implode("\n", $output); $this->expectOutputString($output); wp_site_icon(); }