makePartial(); $db->expects('query')->once()->with('DROP TABLE IF EXISTS wp_lit_mcp_log'); $GLOBALS['wpdb'] = $db; Functions\when('is_multisite')->justReturn(false); Functions\expect('switch_to_blog')->never(); Functions\expect('restore_current_blog')->never(); $transients = []; Functions\when('delete_transient')->alias(static function (string $transient) use (&$transients): bool { $transients[] = $transient; return true; }); Functions\expect('wp_clear_scheduled_hook')->once()->with(ChangeLogCleanup::HOOK); // Review m-8: the Protokoll screen option is user meta (network-wide): removed once. Functions\expect('delete_metadata')->once()->with('user', 0, LogTab::PER_PAGE_OPTION, '', true); $deleted = []; Functions\when('delete_option')->alias(static function (string $option) use (&$deleted): bool { $deleted[] = $option; return true; }); Uninstaller::run(); self::assertSame([ConnectionStatus::ENDPOINT_TRANSIENT, ReleaseResolver::CACHE], $transients); self::assertSame( [ Access::OPTION, ExposurePolicy::OPTION, Limits::OPTION, ChangeLogInstaller::VERSION_OPTION, ReleaseStore::OPTION, CheckReportStore::OPTION, DiviCheckRoute::LOCK, 'lit_mcp_snapshots_colors', 'lit_mcp_snapshots_variables', 'lit_mcp_snapshots_presets', 'lit_mcp_snapshots_theme_options', DesignLock::option('colors'), DesignLock::option('variables'), DesignLock::option('presets'), // Locks of versions before the shared one (audit L5) may still sit in the table. 'lit_mcp_lock_colors', 'lit_mcp_lock_theme_options', ], $deleted ); } public function testRunRemovesDataOnEverySiteOfAMultisiteNetwork(): void { $db = Mockery::mock(\wpdb::class)->makePartial(); $db->expects('query')->twice()->with('DROP TABLE IF EXISTS wp_lit_mcp_log'); $GLOBALS['wpdb'] = $db; Functions\when('is_multisite')->justReturn(true); Functions\when('get_sites')->justReturn([1, 2]); Functions\expect('switch_to_blog')->twice(); Functions\expect('restore_current_blog')->twice(); $transients = []; Functions\when('delete_transient')->alias(static function (string $transient) use (&$transients): bool { $transients[] = $transient; return true; }); Functions\expect('wp_clear_scheduled_hook')->twice()->with(ChangeLogCleanup::HOOK); Functions\expect('delete_metadata')->once()->with('user', 0, LogTab::PER_PAGE_OPTION, '', true); Functions\when('delete_option')->justReturn(true); Uninstaller::run(); self::assertSame( [ ConnectionStatus::ENDPOINT_TRANSIENT, ReleaseResolver::CACHE, ConnectionStatus::ENDPOINT_TRANSIENT, ReleaseResolver::CACHE, ], $transients ); } }