protected function AuthenticationOAuthTest::createKey in Entity Share 8.3
Create a key of OAuth type.
Parameters
\Drupal\user\UserInterface $account: The user whose credentials will be used for the plugin.
1 call to AuthenticationOAuthTest::createKey()
- AuthenticationOAuthTest::setUp in modules/
entity_share_client/ tests/ src/ Functional/ AuthenticationOAuthTest.php
File
- modules/
entity_share_client/ tests/ src/ Functional/ AuthenticationOAuthTest.php, line 419
Class
- AuthenticationOAuthTest
- Functional test class for import with "OAuth" authorization.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function createKey(UserInterface $account) {
$this
->createTestKey('key_oauth_' . $account
->id(), 'entity_share_oauth', 'config');
$credentials = [
'client_id' => $this->clients[$account
->id()]
->uuid(),
'client_secret' => $this->clientSecret,
'authorization_path' => '/oauth/authorize',
'token_path' => '/oauth/token',
];
$output = '';
foreach ($credentials as $name => $value) {
$output .= "\"{$name}\": \"{$value}\"\n";
}
$key_value = <<<EOT
{
{<span class="php-variable">$output</span>}}
EOT;
$this->testKey
->setKeyValue($key_value);
$this->testKey
->save();
}