public function ClientsTest::testIntegrationCreateGetUpdateDelete in Auth0 Single Sign On 8.2
Throws
\Auth0\SDK\Exception\ApiException
\Exception
File
- vendor/
auth0/ auth0-php/ tests/ API/ Management/ ClientsTest.php, line 197
Class
- ClientsTest
- Class ClientsTest
Namespace
Auth0\Tests\API\ManagementCode
public function testIntegrationCreateGetUpdateDelete() {
$env = self::getEnv();
if (!$env['API_TOKEN']) {
$this
->markTestSkipped('No client secret; integration test skipped');
}
$api = new Management($env['API_TOKEN'], $env['DOMAIN']);
$unique_id = uniqid();
$create_body = [
'name' => 'TEST-CREATE-CLIENT-' . $unique_id,
'app_type' => 'regular_web',
];
$created_client = $api
->clients()
->create($create_body);
usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
$this
->assertNotEmpty($created_client['client_id']);
$this
->assertEquals($create_body['name'], $created_client['name']);
$this
->assertEquals($create_body['app_type'], $created_client['app_type']);
$created_client_id = $created_client['client_id'];
$got_entity = $api
->clients()
->get($created_client_id);
usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
// Make sure what we got matches what we created.
$this
->assertEquals($created_client_id, $got_entity['client_id']);
$update_body = [
'name' => 'TEST-UPDATE-CLIENT-' . $unique_id,
'app_type' => 'native',
];
$updated_client = $api
->clients()
->update($created_client_id, $update_body);
usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
$this
->assertEquals($created_client_id, $updated_client['client_id']);
$this
->assertEquals($update_body['name'], $updated_client['name']);
$this
->assertEquals($update_body['app_type'], $updated_client['app_type']);
$api
->clients()
->delete($created_client_id);
usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
}