class ApiTests in Auth0 Single Sign On 8.2
Class ApiTests. Extend to test API endpoints with a live or mock API.
@package Auth0\Tests\API
Hierarchy
- class \Auth0\Tests\API\ApiTests extends \Auth0\Tests\API\PHPUnit_Framework_TestCase uses ErrorHelpers
Expanded class hierarchy of ApiTests
11 files declare their use of ApiTests
- BlacklistsTest.php in vendor/
auth0/ auth0-php/ tests/ API/ Management/ BlacklistsTest.php - ClientCredentialsTest.php in vendor/
auth0/ auth0-php/ tests/ API/ Authentication/ ClientCredentialsTest.php - ClientsTest.php in vendor/
auth0/ auth0-php/ tests/ API/ Management/ ClientsTest.php - DbConnectionsTest.php in vendor/
auth0/ auth0-php/ tests/ API/ Authentication/ DbConnectionsTest.php - DeprecatedTest.php in vendor/
auth0/ auth0-php/ tests/ API/ Authentication/ DeprecatedTest.php
File
- vendor/
auth0/ auth0-php/ tests/ API/ ApiTests.php, line 15
Namespace
Auth0\Tests\APIView source
class ApiTests extends \PHPUnit_Framework_TestCase {
use ErrorHelpers;
/**
* Environment variables.
*
* @var array
*/
protected static $env = [];
/**
* Get all test suite environment variables.
*
* @return array
*
* @throws \Auth0\SDK\Exception\ApiException
*/
protected static function getEnv() {
if (self::$env) {
return self::$env;
}
$env_path = '.env';
if (file_exists($env_path)) {
$loader = new Loader($env_path);
$loader
->parse()
->putenv(true);
}
$env = [
'DOMAIN' => getenv('DOMAIN'),
'APP_CLIENT_ID' => getenv('APP_CLIENT_ID'),
'APP_CLIENT_SECRET' => getenv('APP_CLIENT_SECRET'),
'API_TOKEN' => getenv('API_TOKEN'),
];
if (!$env['API_TOKEN'] && $env['APP_CLIENT_SECRET']) {
$auth_api = new Authentication($env['DOMAIN'], $env['APP_CLIENT_ID'], $env['APP_CLIENT_SECRET']);
$response = $auth_api
->client_credentials([
'audience' => 'https://' . $env['DOMAIN'] . '/api/v2/',
]);
$env['API_TOKEN'] = $response['access_token'];
}
self::$env = $env;
return self::$env;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ApiTests:: |
protected static | property | Environment variables. | |
ApiTests:: |
protected static | function | Get all test suite environment variables. | |
ErrorHelpers:: |
protected | function | Does an error message contain a specific string? |