protected function mockApplication()
    {
        $entryUrl = $this->config['entryUrl'];
        $entryFile = $this->config['entryScript'] ?: basename($entryUrl);
        $entryScript = $this->config['entryScript'] ?: parse_url($entryUrl, PHP_URL_PATH);
        $this->client = new Yii2Connector();
        $this->client->defaultServerVars = [
          'SCRIPT_FILENAME' => $entryFile,
          'SCRIPT_NAME' => $entryScript,
          'SERVER_NAME' => parse_url($entryUrl, PHP_URL_HOST),
          'SERVER_PORT' => parse_url($entryUrl, PHP_URL_PORT) ?: '80',
        ];
        $this->client->defaultServerVars['HTTPS'] = parse_url($entryUrl, PHP_URL_SCHEME) === 'https';
        $this->client->restoreServerVars();
        $this->client->configFile = $this->getRootDir() . $this->config['configFile'];

        return $this->client->getApplication();
    }