/** * Get our configured client singleton * * @staticvar type $client * @return mixed \Stormpath\Client | false */ function get_client() { static $client; if ($client) { return $client; } if (!api_keys_exists()) { return false; } $builder = new \Stormpath\ClientBuilder(); $apiKeyFile = get_api_file(); $client = $builder->setApiKeyFileLocation($apiKeyFile)->build(); return $client; }
/** * This function instantiates a new client but doesn't modify * the TestCase::$client variable. */ protected function newClientInstance() { $builder = new \Stormpath\ClientBuilder(); $newClient = $builder->setApiKeyFileLocation(\Stormpath\Client::$apiKeyFileLocation)->setApiKeyProperties(\Stormpath\Client::$apiKeyProperties)->setApiKeyIdPropertyName(\Stormpath\Client::$apiKeyIdPropertyName)->setApiKeySecretPropertyName(\Stormpath\Client::$apiKeySecretPropertyName)->setCacheManager(\Stormpath\Client::$cacheManager)->setCacheManagerOptions(\Stormpath\Client::$cacheManagerOptions)->setBaseURL(\Stormpath\Client::$baseUrl)->build(); return $newClient; }
public function testClientFromPropertiesString() { $builder = new \Stormpath\ClientBuilder(); $result = $builder->setApiKeyFileLocation(\Stormpath\Client::$apiKeyFileLocation)->setApiKeyProperties("apiKey.id=something\napiKey.secret=somethingSecret")->build(); $this->assertInstanceOf('Stormpath\\Client', $result); }