/** * Suspend kses which runs on content_save_pre and can corrupt JSON in post_content. * * @see Post_Type::suspend_kses() * @see Post_Type::restore_kses() */ function test_suspend_restore_kses() { if (!has_filter('content_save_pre', 'wp_filter_post_kses')) { kses_init_filters(); } $post_type = new Post_Type($this->plugin->customize_snapshot_manager); $post_type->suspend_kses(); $this->assertFalse(has_filter('content_save_pre', 'wp_filter_post_kses')); $post_type->restore_kses(); $this->assertEquals(10, has_filter('content_save_pre', 'wp_filter_post_kses')); remove_filter('content_save_pre', 'wp_filter_post_kses'); $post_type->suspend_kses(); $post_type->restore_kses(); $this->assertFalse(has_filter('content_save_pre', 'wp_filter_post_kses')); }