本文整理汇总了PHP中makeUniqueName函数的典型用法代码示例。如果您正苦于以下问题:PHP makeUniqueName函数的具体用法?PHP makeUniqueName怎么用?PHP makeUniqueName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeUniqueName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetFacebookProvider
public function testGetFacebookProvider()
{
$clientId = makeUniqueName("mockClientId");
$clientSecret = makeUniqueName("mockClientSecret");
$provider = self::$client->dataStore->instantiate(\Stormpath\Stormpath::FACEBOOK_PROVIDER);
$provider->clientId = $clientId;
$provider->clientSecret = $clientSecret;
$directoryName = makeUniqueName("my-facebook-directory-2");
$directoryDescription = makeUniqueName("A Facebook directory");
$directory = self::$client->dataStore->instantiate(\Stormpath\Stormpath::DIRECTORY);
$directory->name = $directoryName;
$directory->description = $directoryDescription;
$directory->provider = $provider;
$tenant = self::$client->getCurrentTenant();
$returnedDirectory = $tenant->createDirectory($directory);
$this->assertNotNull($returnedDirectory);
$returnedProvider = self::$client->dataStore->getResource($returnedDirectory->href . "/" . Provider::PATH, \Stormpath\Stormpath::FACEBOOK_PROVIDER);
$this->assertEquals(FacebookProvider::FACEBOOK_PROVIDER_ID, $returnedProvider->providerId);
$this->assertNotEmpty($returnedProvider->createdAt);
$this->assertNotEmpty($returnedProvider->modifiedAt);
$this->assertEquals($clientId, $returnedProvider->clientId);
$this->assertEquals($clientSecret, $returnedProvider->clientSecret);
$tokens = explode('/', $returnedDirectory->href);
$directoryId = end($tokens);
$this->assertEquals($returnedProvider, FacebookProvider::get($directoryId));
$this->assertEquals($returnedProvider, FacebookProvider::get($directoryId . '/' . Provider::PATH));
$this->assertEquals($returnedProvider, FacebookProvider::get(Directory::PATH . '/' . $directoryId . '/' . Provider::PATH));
$this->assertEquals($returnedProvider, FacebookProvider::get($returnedDirectory->href));
$this->assertEquals($returnedProvider, FacebookProvider::get($returnedDirectory->href . '/' . Provider::PATH));
$returnedDirectory->delete();
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$application = \Stormpath\Resource\Application::instantiate(array('name' => makeUniqueName('Application ApiRequestAuthenticatorTest'), 'description' => 'Application for ApiRequestAuthenticatorTest', 'status' => 'enabled'));
parent::createResource(\Stormpath\Resource\Application::PATH, self::$application, array('createDirectory' => true));
self::$account = \Stormpath\Resource\Account::instantiate(array('givenName' => 'PHP', 'middleName' => 'ApiRequestAuthenticatorTest', 'surname' => 'Test', 'username' => makeUniqueName('ApiRequestAuthenticatorTest'), 'email' => makeUniqueName('ApiRequestAuthenticatorTest') . '@unknown123.kot', 'password' => 'superP4ss'));
self::$application->createAccount(self::$account);
self::$apiKey = self::$account->createApiKey();
}
示例3: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$samlProvider = \Stormpath\Resource\SamlProvider::instantiate(['ssoLoginUrl' => 'http://google.com/login', 'ssoLogoutUrl' => 'http://google.com/logout', 'encodedX509SigningCert' => self::getDummyCertForSaml(), 'requestSignatureAlgorithm' => 'RSA-SHA1']);
self::$directory = \Stormpath\Resource\Directory::create(['name' => makeUniqueName('DirectoryTest samlProvider'), 'provider' => self::$samlProvider]);
$parts = explode('/', self::$directory->href);
self::$directoryId = end($parts);
self::$metadata = SamlProvider::get(self::$directory->provider->href)->serviceProviderMetadata;
}
示例4: testCreateDirectory
public function testCreateDirectory()
{
$tenant = self::$client->tenant;
$name = makeUniqueName('TenantTest createDirectory');
$directory = \Stormpath\Resource\Directory::instantiate(array('name' => $name));
$tenant->createDirectory($directory);
//$this->assertInstanceOf('\Stormpath\Resource\Directory', $directory);
$this->assertEquals($tenant->name, $directory->tenant->name);
$this->assertEquals($name, $directory->name);
foreach ($tenant->directories as $dir) {
$this->assertInstanceOf('\\Stormpath\\Resource\\Directory', $dir);
}
$directory->delete();
}
示例5: testDelete
/**
* @expectedException \Stormpath\Resource\ResourceError
*/
public function testDelete()
{
$group = \Stormpath\Resource\Group::instantiate(array('name' => makeUniqueName('GroupMembershipTest testDelete')));
self::$directory->createGroup($group);
$account = \Stormpath\Resource\Account::instantiate(array('givenName' => 'Account Name', 'surname' => 'Surname', 'email' => makeUniqueName('GroupMembershipTest testDelete') . '@unknown12345678.kot', 'password' => 'superP4ss'));
self::$directory->createAccount($account);
$groupMembership = \Stormpath\Resource\GroupMembership::create(array('account' => $account, 'group' => $group));
$groupMembership = \Stormpath\Resource\GroupMembership::get($groupMembership->href);
$this->assertInstanceOf('\\Stormpath\\Resource\\GroupMembership', $groupMembership);
$this->assertContains('testDelete', $groupMembership->group->name);
$this->assertContains('@unknown12345678.kot', $groupMembership->account->email);
$href = $groupMembership->href;
$groupMembership->delete();
\Stormpath\Resource\GroupMembership::get($href);
}
示例6: createDirectory
private function createDirectory()
{
$directory = \Stormpath\Resource\Directory::instantiate(array('name' => makeUniqueName('Directory For Request Signer Test'), 'description' => 'Main Directory description'));
return self::createResource(\Stormpath\Resource\Directory::PATH, $directory);
}
示例7: it_can_add_an_account_store_mapping
/**
* @test
*/
public function it_can_add_an_account_store_mapping()
{
$application = \Stormpath\Resource\Application::instantiate(['name' => makeUniqueName('OrgTest'), 'description' => 'Description of Main App', 'status' => 'enabled']);
$application = self::createResource(\Stormpath\Resource\Application::PATH, $application);
$accountStoreMapping = \Stormpath\Resource\AccountStoreMapping::instantiate(['organization' => self::$organization, 'accountStore' => self::$directory, 'isDefaultAccountStore' => true, 'isDefaultGroupStore' => true]);
$test1 = self::$organization->createOrganizationAccountStoreMapping($accountStoreMapping);
$this->assertInstanceOf('\\Stormpath\\Resource\\AccountStoreMapping', $test1);
$accountStoreMapping = \Stormpath\Resource\AccountStoreMapping::instantiate(['accountStore' => self::$organization, 'application' => $application, 'isDefaultAccountStore' => true]);
$test2 = $application->createAccountStoreMapping($accountStoreMapping);
$this->assertInstanceOf('\\Stormpath\\Resource\\AccountStoreMapping', $test2);
$org = Organization::get(self::$organization->href);
$this->assertNotNull($org->accountStoreMappings->href);
$this->assertInstanceOf('Stormpath\\Resource\\AccountStore', $org->defaultAccountStoreMapping);
$this->assertInstanceOf('Stormpath\\Resource\\AccountStore', $org->defaultGroupStoreMapping);
$asm = $org->accountStoreMappings;
foreach ($asm as $mapping) {
$this->assertEquals($org->href, $mapping->organization->href);
$this->assertEquals(self::$directory->href, $mapping->accountStore->href);
}
$app = Application::get($application->href);
$this->assertNotNull($app->accountStoreMappings->href);
$asm = $app->accountStoreMappings;
foreach ($asm as $mapping) {
$this->assertEquals($app->href, $mapping->application->href);
$this->assertEquals(self::$organization->href, $mapping->accountStore->href);
}
$application->delete();
}
示例8: testShouldBeAbleToGetGroupViaHTMLFragment
public function testShouldBeAbleToGetGroupViaHTMLFragment()
{
$group = \Stormpath\Resource\Group::instantiate(array('name' => makeUniqueName('GroupTest htmlFragment')));
self::$directory->createGroup($group);
$href = $group->href;
$hrefParts = array_reverse(explode('/', $href));
$group = \Stormpath\Resource\Group::get($hrefParts[0]);
$this->assertInstanceOf('\\Stormpath\\Resource\\Group', $group);
$this->assertEquals($href, $group->href);
$group2 = \Stormpath\Client::get($hrefParts[1] . '/' . $hrefParts[0], Stormpath::GROUP);
$this->assertInstanceOf('\\Stormpath\\Resource\\Group', $group2);
$this->assertEquals($href, $group2->href);
$group->delete();
}
示例9: an_application_should_allow_setting_authorized_callback_uri
/** @test */
public function an_application_should_allow_setting_authorized_callback_uri()
{
$application = \Stormpath\Resource\Application::create(array('name' => makeUniqueName('ApplicationTest authorizedCallbackUri')));
$application->setAuthorizedCallbackUris(['http://myapplication.com/whatever/callback', 'http://myapplication.com/whatever/callback2']);
$application->save();
$application = \Stormpath\Resource\Application::get($application->href);
$this->assertCount(2, $application->authorizedCallbackUris);
$application->delete();
}
示例10: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$directory = \Stormpath\Resource\Directory::create(array('name' => makeUniqueName('AccountCreationPolicyTest')));
self::$acp = self::$directory->accountCreationPolicy;
}
示例11: testShouldBeAbleToGetDirectoryViaHTMLFragment
public function testShouldBeAbleToGetDirectoryViaHTMLFragment()
{
$directory = \Stormpath\Resource\Directory::create(array('name' => makeUniqueName('DirectoryTest htmlFragment')));
$href = $directory->href;
$hrefParts = array_reverse(explode('/', $href));
$dir = \Stormpath\Resource\Directory::get($hrefParts[0]);
$this->assertInstanceOf('\\Stormpath\\Resource\\Directory', $dir);
$this->assertEquals($href, $dir->href);
$dir2 = \Stormpath\Client::get($hrefParts[1] . '/' . $hrefParts[0], Stormpath::DIRECTORY);
$this->assertInstanceOf('\\Stormpath\\Resource\\Directory', $dir2);
$this->assertEquals($href, $dir2->href);
$directory->delete();
}
示例12: a_directory_can_add_a_saml_provider
/** @test */
public function a_directory_can_add_a_saml_provider()
{
$samlProvider = \Stormpath\Resource\SamlProvider::instantiate(['ssoLoginUrl' => 'http://google.com/login', 'ssoLogoutUrl' => 'http://google.com/logout', 'encodedX509SigningCert' => $this->getDummyCertForSaml(), 'requestSignatureAlgorithm' => 'RSA-SHA1']);
$directory = \Stormpath\Resource\Directory::create(['name' => makeUniqueName('DirectoryTest samlProvider'), 'provider' => $samlProvider]);
$this->assertInstanceOf('Stormpath\\Resource\\Directory', $directory);
$this->assertInstanceOf('Stormpath\\Resource\\Provider', $directory->provider);
$this->assertEquals('saml', $directory->provider->providerId);
$directory->delete();
}
示例13: testDelete
/**
* @expectedException \Stormpath\Resource\ResourceError
*/
public function testDelete()
{
$application = \Stormpath\Resource\Application::create(array('name' => makeUniqueName('ApplicationTest testDelete')));
$this->assertInstanceOf('Stormpath\\Resource\\Application', $application);
$this->assertContains('testDelete', $application->name);
$href = $application->href;
$application->delete();
\Stormpath\Resource\Application::get($href);
}
示例14: testDelete
public function testDelete()
{
$application = \Stormpath\Resource\Application::instantiate(array('name' => makeUniqueName('AccountStoreMappingTest Test Delete')));
self::createResource(\Stormpath\Resource\Application::PATH, $application);
$accountStoreMappingWithDir = \Stormpath\Resource\AccountStoreMapping::create(array('accountStore' => self::$directory, 'application' => $application));
$href = $accountStoreMappingWithDir->href;
$accountStoreMapping = \Stormpath\Resource\AccountStoreMapping::get($href);
$this->assertInstanceOf('Stormpath\\Resource\\AccountStoreMapping', $accountStoreMapping);
$this->assertInstanceOf('Stormpath\\Resource\\Directory', $accountStoreMapping->accountStore);
$accountStoreMapping->delete();
try {
\Stormpath\Resource\AccountStoreMapping::get($href);
$application->delete();
$this->fail('Should have thrown a ResourceError.');
} catch (\Stormpath\Resource\ResourceError $re) {
$this->assertTrue(true);
}
$application->delete();
}
示例15: testShouldBeAbleToGetApplicationViaHTMLFragment
public function testShouldBeAbleToGetApplicationViaHTMLFragment()
{
$application = \Stormpath\Resource\Application::create(array('name' => makeUniqueName('ApplicationTest testFragment')));
$href = $application->href;
$hrefParts = array_reverse(explode('/', $href));
$app = \Stormpath\Resource\Application::get($hrefParts[0]);
$this->assertInstanceOf('\\Stormpath\\Resource\\Application', $app);
$this->assertEquals($href, $app->href);
$app2 = \Stormpath\Client::get($hrefParts[1] . '/' . $hrefParts[0], Stormpath::APPLICATION);
$this->assertInstanceOf('\\Stormpath\\Resource\\Application', $app2);
$this->assertEquals($href, $app2->href);
$application->delete();
}