public function testBuildAuthUrl() { $oauthClient = new OAuth2(); $authUrl = 'http://test.auth.url'; $oauthClient->authUrl = $authUrl; $clientId = 'test_client_id'; $oauthClient->clientId = $clientId; $returnUrl = 'http://test.return.url'; $oauthClient->setReturnUrl($returnUrl); $builtAuthUrl = $oauthClient->buildAuthUrl(); $this->assertContains($authUrl, $builtAuthUrl, 'No auth URL present!'); $this->assertContains($clientId, $builtAuthUrl, 'No client id present!'); $this->assertContains(rawurlencode($returnUrl), $builtAuthUrl, 'No return URL present!'); }
/** * @throws Exception */ public function init() { if (!class_exists($this->serviceClass)) { throw new Exception(Yii::t('SyncSocial', 'Authclient Extension not support "{serviceName}" service', ['{serviceName}' => $this->serviceClass])); } if (empty($this->returnUrl)) { $this->returnUrl = $this->connectUrl; } $this->service = new $this->serviceClass($this->serviceSettings); $this->service->setReturnUrl($this->returnUrl); }