mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
formatting
This commit is contained in:
@@ -22,9 +22,9 @@ App::init()
|
||||
->groups(['projects'])
|
||||
->inject('project')
|
||||
->action(function (Document $project) {
|
||||
if ($project->getId() !== 'console') {
|
||||
throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN);
|
||||
}
|
||||
if ($project->getId() !== 'console') {
|
||||
throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN);
|
||||
}
|
||||
});
|
||||
|
||||
App::post('/v1/domains/suggest')
|
||||
@@ -91,24 +91,24 @@ App::post('/v1/domains')
|
||||
Database $dbForConsole,
|
||||
Registrar $registrar
|
||||
) {
|
||||
if (! $registrar->available($domain)) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
if (! $registrar->available($domain)) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$document = $dbForConsole->findOne('domains', [
|
||||
Query::equal('domain', [$domain]),
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
]);
|
||||
|
||||
if ($document && ! $document->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
if ($document && ! $document->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
$domain = new Domain($domain);
|
||||
|
||||
@@ -184,9 +184,9 @@ App::post('/v1/domains/purchase')
|
||||
Database $dbForConsole,
|
||||
Registrar $registrar
|
||||
) {
|
||||
if (! $registrar->available($domain)) {
|
||||
throw new Exception();
|
||||
}
|
||||
if (! $registrar->available($domain)) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
$contact = new Contact(
|
||||
$firstname,
|
||||
@@ -204,26 +204,26 @@ App::post('/v1/domains/purchase')
|
||||
''
|
||||
);
|
||||
|
||||
try {
|
||||
$registrar->purchase($domain, [$contact]);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception();
|
||||
}
|
||||
try {
|
||||
$registrar->purchase($domain, [$contact]);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$document = $dbForConsole->findOne('domains', [
|
||||
Query::equal('domain', [$domain]),
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
]);
|
||||
|
||||
if ($document && ! $document->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
if ($document && ! $document->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
$domain = new Domain($domain);
|
||||
|
||||
@@ -315,26 +315,26 @@ App::post('/v1/domains/transfer/in')
|
||||
''
|
||||
);
|
||||
|
||||
try {
|
||||
$registrar->transfer($domain, [$contact]);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception();
|
||||
}
|
||||
try {
|
||||
$registrar->transfer($domain, [$contact]);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$document = $dbForConsole->findOne('domains', [
|
||||
Query::equal('domain', [$domain]),
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
]);
|
||||
|
||||
if ($document && ! $document->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
if ($document && ! $document->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
$domain = new Domain($domain);
|
||||
|
||||
@@ -396,9 +396,9 @@ App::get('/v1/domains')
|
||||
->action(function (string $projectId, Response $response, Database $dbForConsole) {
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$domains = $dbForConsole->find('domains', [
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
@@ -428,18 +428,18 @@ App::get('/v1/domains/:domainId')
|
||||
->action(function (string $projectId, string $domainId, Response $response, Database $dbForConsole) {
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$domain = $dbForConsole->findOne('domains', [
|
||||
Query::equal('_uid', [$domainId]),
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
]);
|
||||
|
||||
if ($domain === false || $domain->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_NOT_FOUND);
|
||||
}
|
||||
if ($domain === false || $domain->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_NOT_FOUND);
|
||||
}
|
||||
|
||||
$response->dynamic($domain, Response::MODEL_DOMAIN);
|
||||
});
|
||||
@@ -495,22 +495,22 @@ App::delete('/v1/domains/:domainId')
|
||||
->action(function (string $projectId, string $domainId, Response $response, Database $dbForConsole) {
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
if ($project->isEmpty()) {
|
||||
throw new Exception(Exception::PROJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
$domain = $dbForConsole->findOne('domains', [
|
||||
Query::equal('_uid', [$domainId]),
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
]);
|
||||
|
||||
if ($domain === false || $domain->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_NOT_FOUND);
|
||||
}
|
||||
if ($domain === false || $domain->isEmpty()) {
|
||||
throw new Exception(Exception::DOMAIN_NOT_FOUND);
|
||||
}
|
||||
|
||||
if ($domain['registered'] === true) {
|
||||
throw new Exception();
|
||||
}
|
||||
if ($domain['registered'] === true) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
$response->noContent();
|
||||
});
|
||||
|
||||
+9
-9
@@ -762,18 +762,18 @@ App::setResource('register', fn() => $register);
|
||||
App::setResource('locale', fn() => new Locale(App::getEnv('_APP_LOCALE', 'en')));
|
||||
|
||||
App::setResource('registrar', function () {
|
||||
$opensrs = new OpenSRS(
|
||||
App::getEnv('OPENSRS_KEY'),
|
||||
App::getEnv('OPENSRS_USERNAME'),
|
||||
'appwrite',
|
||||
'0p3n5R5@Appwrite',
|
||||
[
|
||||
$opensrs = new OpenSRS(
|
||||
App::getEnv('OPENSRS_KEY'),
|
||||
App::getEnv('OPENSRS_USERNAME'),
|
||||
'appwrite',
|
||||
'0p3n5R5@Appwrite',
|
||||
[
|
||||
'ns1.appwrite.io',
|
||||
'ns2.appwrite.io',
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
|
||||
return new Registrar($opensrs);
|
||||
return new Registrar($opensrs);
|
||||
});
|
||||
|
||||
// Queues
|
||||
|
||||
@@ -75,225 +75,225 @@ class DomainsRegistrarClientTest extends Scope
|
||||
/**
|
||||
* @depends testCreateProject
|
||||
*/
|
||||
public function testSuggestDomain($data): void
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
public function testSuggestDomain($data): void
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains/suggest', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => 'kittens.com',
|
||||
]);
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains/suggest', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => 'kittens.com',
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertNotEmpty($response['body']['domains']);
|
||||
}
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertNotEmpty($response['body']['domains']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateProject
|
||||
*/
|
||||
public function testAvailableDomain($data): void
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
public function testAvailableDomain($data): void
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains/available', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => 'google.com',
|
||||
]);
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains/available', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => 'google.com',
|
||||
]);
|
||||
|
||||
$available = $response['body']['domain']['available'];
|
||||
$available = $response['body']['domain']['available'];
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertNotEmpty($response['body']['domain']);
|
||||
$this->assertFalse($available);
|
||||
}
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertNotEmpty($response['body']['domain']);
|
||||
$this->assertFalse($available);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateProject
|
||||
*/
|
||||
public function testCreate3rdPartyDomain($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domain = $this->generateRandomString().'.net';
|
||||
public function testCreate3rdPartyDomain($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domain = $this->generateRandomString() . '.net';
|
||||
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => $domain,
|
||||
]);
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => $domain,
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertNotEmpty($response['body']['$id']);
|
||||
$this->assertEquals($domain, $response['body']['domain']);
|
||||
$this->assertEquals(false, $response['body']['verification']);
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertNotEmpty($response['body']['$id']);
|
||||
$this->assertEquals($domain, $response['body']['domain']);
|
||||
$this->assertEquals(false, $response['body']['verification']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
$response = $response = $this->client->call(Client::METHOD_POST, '/domains', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => 'sdkljgfhsdflkjghsdflkgjsh.com',
|
||||
]);
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
$response = $response = $this->client->call(Client::METHOD_POST, '/domains', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => 'sdkljgfhsdflkjghsdflkgjsh.com',
|
||||
]);
|
||||
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateProject
|
||||
*/
|
||||
public function testPurchaseDomain($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domain = $this->generateRandomString().'.net';
|
||||
public function testPurchaseDomain($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domain = $this->generateRandomString() . '.net';
|
||||
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains/purchase', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => $domain,
|
||||
'firstname' => 'firstname',
|
||||
'lastname' => 'lastname',
|
||||
'phone' => '+18037889693',
|
||||
'email' => 'email@email.com',
|
||||
'address1' => 'address1 st',
|
||||
'address2' => 'unit address2',
|
||||
'address3' => 'apt. address3',
|
||||
'city' => 'city',
|
||||
'state' => 'state',
|
||||
'country' => 'us',
|
||||
'postalcode' => '29223',
|
||||
'org' => 'myorg',
|
||||
]);
|
||||
$response = $this->client->call(Client::METHOD_POST, '/domains/purchase', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domain' => $domain,
|
||||
'firstname' => 'firstname',
|
||||
'lastname' => 'lastname',
|
||||
'phone' => '+18037889693',
|
||||
'email' => 'email@email.com',
|
||||
'address1' => 'address1 st',
|
||||
'address2' => 'unit address2',
|
||||
'address3' => 'apt. address3',
|
||||
'city' => 'city',
|
||||
'state' => 'state',
|
||||
'country' => 'us',
|
||||
'postalcode' => '29223',
|
||||
'org' => 'myorg',
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertTrue($response['body']['registered']);
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertTrue($response['body']['registered']);
|
||||
|
||||
return [
|
||||
'projectId' => $id,
|
||||
'domain' => $domain,
|
||||
];
|
||||
}
|
||||
return [
|
||||
'projectId' => $id,
|
||||
'domain' => $domain,
|
||||
];
|
||||
}
|
||||
|
||||
public function testTransferInDomain(): void
|
||||
{
|
||||
// This will always fail mainly because it's a test env,
|
||||
// but also because:
|
||||
// - we use random domains to test
|
||||
// - transfer lock is default
|
||||
// - unable to unlock transfer because domains (in tests) are new.
|
||||
// ** Even when testing against my own live domains, it failed.
|
||||
// So we test for a proper formatted response,
|
||||
// with "successful" being "false".
|
||||
public function testTransferInDomain(): void
|
||||
{
|
||||
// This will always fail mainly because it's a test env,
|
||||
// but also because:
|
||||
// - we use random domains to test
|
||||
// - transfer lock is default
|
||||
// - unable to unlock transfer because domains (in tests) are new.
|
||||
// ** Even when testing against my own live domains, it failed.
|
||||
// So we test for a proper formatted response,
|
||||
// with "successful" being "false".
|
||||
|
||||
$this->markTestSkipped('Transfer test skipped because it always fails.');
|
||||
}
|
||||
$this->markTestSkipped('Transfer test skipped because it always fails.');
|
||||
}
|
||||
|
||||
public function testTransferOutDomain(): void
|
||||
{
|
||||
// This will always fail mainly because it's a test env,
|
||||
// but also because:
|
||||
// - we use random domains to test
|
||||
// - transfer lock is default
|
||||
// - unable to unlock transfer because domains (in tests) are new.
|
||||
// ** Even when testing against my own live domains, it failed.
|
||||
// So we test for a proper formatted response,
|
||||
// with "successful" being "false".
|
||||
public function testTransferOutDomain(): void
|
||||
{
|
||||
// This will always fail mainly because it's a test env,
|
||||
// but also because:
|
||||
// - we use random domains to test
|
||||
// - transfer lock is default
|
||||
// - unable to unlock transfer because domains (in tests) are new.
|
||||
// ** Even when testing against my own live domains, it failed.
|
||||
// So we test for a proper formatted response,
|
||||
// with "successful" being "false".
|
||||
|
||||
$this->markTestSkipped('Transfer test skipped because it always fails.');
|
||||
}
|
||||
$this->markTestSkipped('Transfer test skipped because it always fails.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateProject
|
||||
*/
|
||||
public function testDomainList($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
public function testDomainList($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/domains', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
]);
|
||||
$response = $this->client->call(Client::METHOD_GET, '/domains', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertTrue($response['body']['total'] > 0);
|
||||
$this->assertTrue(count($response['body']['domains']) > 0);
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertTrue($response['body']['total'] > 0);
|
||||
$this->assertTrue(count($response['body']['domains']) > 0);
|
||||
|
||||
return [
|
||||
'projectId' => $id,
|
||||
'domains' => $response['body']['domains'],
|
||||
];
|
||||
}
|
||||
return [
|
||||
'projectId' => $id,
|
||||
'domains' => $response['body']['domains'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testDomainList
|
||||
*/
|
||||
public function testDomainGet($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domains = $data['domains'] ?? [];
|
||||
$domain = $domains[0];
|
||||
$domainId = $domain['$id'];
|
||||
public function testDomainGet($data): array
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domains = $data['domains'] ?? [];
|
||||
$domain = $domains[0];
|
||||
$domainId = $domain['$id'];
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/domains/'.$domainId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domainId' => $domains[0]['$id'],
|
||||
]);
|
||||
$response = $this->client->call(Client::METHOD_GET, '/domains/' . $domainId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domainId' => $domains[0]['$id'],
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
|
||||
return [
|
||||
'projectId' => $id,
|
||||
'domainId' => $domainId,
|
||||
];
|
||||
}
|
||||
return [
|
||||
'projectId' => $id,
|
||||
'domainId' => $domainId,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testDomainGet
|
||||
*/
|
||||
public function testDomainDelete($data): string
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domainId = $data['domainId'] ?? '';
|
||||
public function testDomainDelete($data): string
|
||||
{
|
||||
$id = $data['projectId'] ?? '';
|
||||
$domainId = $data['domainId'] ?? '';
|
||||
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/domains/'.$domainId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domainId' => $domainId,
|
||||
]);
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/domains/' . $domainId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'projectId' => $id,
|
||||
'domainId' => $domainId,
|
||||
]);
|
||||
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
|
||||
return $domainId;
|
||||
}
|
||||
return $domainId;
|
||||
}
|
||||
|
||||
private function generateRandomString(int $length = 10): string
|
||||
{
|
||||
$characters = 'abcdefghijklmnopqrstuvwxyz';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
private function generateRandomString(int $length = 10): string
|
||||
{
|
||||
$characters = 'abcdefghijklmnopqrstuvwxyz';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[random_int(0, $charactersLength - 1)];
|
||||
}
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[random_int(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user