fixtures['account']['0']['account_id']; $_SESSION = [ 'authenticated' => true, 'account_id' => $account_id, // Trick the code to not warn that $_SESSION['uid'] is not set, // but also not trigger the code that tries to change to the // given channel. *Remove when code is fixed!* 'uid' => 0, ]; $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; App::$session = $this->create_session_stub(); App::$module = $module; App::$argv = $args; App::$argc = count($args); // Enable multi factor authentication for this account AConfig::Set($account_id, 'system', 'mfa_enabled', true); require 'include/auth.php'; $this->assertEquals(1, $_SESSION['authenticated']); } /** * Data provider for testing modules excluded from mfa * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ public static function modules_excluded_from_mfa(): array { return [ ['totp_check', []], ['cdav', []], ['cdav', ['calendar']], ['cdav', ['addressbook']], ['dav', []], ]; } private function create_session_stub(): \Zotlabs\Web\Session { return $this->createStub('Zotlabs\Web\Session'); } }