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(); Functions\expect('delete_transient')->once()->with(ConnectionStatus::ENDPOINT_TRANSIENT); Functions\expect('wp_clear_scheduled_hook')->once()->with(ChangeLogCleanup::HOOK); $deleted = []; Functions\when('delete_option')->alias(static function (string $option) use (&$deleted): bool { $deleted[] = $option; return true; }); Uninstaller::run(); self::assertSame( [Access::OPTION, ExposurePolicy::OPTION, Limits::OPTION, ChangeLogInstaller::VERSION_OPTION], $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(); Functions\expect('delete_transient')->twice()->with(ConnectionStatus::ENDPOINT_TRANSIENT); Functions\expect('wp_clear_scheduled_hook')->twice()->with(ChangeLogCleanup::HOOK); Functions\when('delete_option')->justReturn(true); Uninstaller::run(); } }