public function save() { $postValues = $this->getValues(); $providerId = $postValues['id']; $flag = 'save'; $provider = null; if (isset($providerId) & $providerId != '') { $provider = $this->getOpenIdProviderService()->getOpenIdProvider($providerId); $flag = 'update'; } else { $provider = new OpenidProvider(); $provider->setStatus(1); $flag = 'save'; } $provider->setProviderName($postValues['name']); $provider->setProviderUrl($postValues['url']); $savedProvider = $this->getOpenIdProviderService()->saveOpenIdProvider($provider); if ($savedProvider instanceof OpenidProvider) { $authProviderExtraDetails = $this->getAuthProviderExtraDetailsService()->getAuthProviderDetailsByProviderId($savedProvider->getProviderId()); if (!$authProviderExtraDetails instanceof AuthProviderExtraDetails) { $authProviderExtraDetails = new AuthProviderExtraDetails(); } $authProviderExtraDetails->setProviderId($savedProvider->getProviderId()); $authProviderExtraDetails->setProviderType($postValues['type']); $authProviderExtraDetails->setClientId($postValues['clientId']); $authProviderExtraDetails->setClientSecret($postValues['clientSecret']); $authProviderExtraDetails->setDeveloperKey($postValues['developerKey']); $this->getAuthProviderExtraDetailsService()->saveAuthProviderExtraDetails($authProviderExtraDetails); } return $flag; }
public function testSaveJVAuthProviderNotOpenId() { $authProvider = new AuthProviderExtraDetails(); $authProvider->setProviderId(5); $authProvider->setProviderType(2); $authProvider->setClientId('Test_client_id_4'); $authProvider->setClientSecret('Test_secret_4'); $authProvider->setDeveloperKey('Test_developer_key'); $result = $this->authenticationDao->saveAuthProviderExtraDetails($authProvider); $this->assertTrue($result instanceof AuthProviderExtraDetails); }