/** * Tests preview_snapshot_settings. * * @covers CustomizeSnapshots\Customize_Snapshot_Manager::preview_snapshot_settings() */ public function test_preview_snapshot_settings() { global $wp_actions; $_REQUEST['customize_snapshot_uuid'] = self::UUID; $this->manager->post_type->save(array('uuid' => self::UUID, 'data' => array('blogname' => array('value' => 'Hello')), 'status' => 'draft')); // Prevent init from calling preview_snapshot_settings straight away. unset($wp_actions['wp_loaded']); $manager = new Customize_Snapshot_Manager($this->plugin); $manager->init(); $manager->ensure_customize_manager(); do_action('customize_register', $manager->customize_manager); $this->assertFalse($manager->is_previewing_settings()); $this->assertFalse($manager->customize_manager->get_setting('blogname')->dirty); $this->assertNotEquals('Hello', get_option('blogname')); $manager->preview_snapshot_settings(); $this->assertEquals('Hello', get_option('blogname')); $this->assertTrue($manager->customize_manager->get_setting('blogname')->dirty); }