1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00
This commit is contained in:
fogelito 2022-07-06 17:47:34 +03:00
parent ae4cb685c0
commit d7244bd9ba
3 changed files with 12 additions and 14 deletions

View file

@ -823,7 +823,7 @@ App::post('/v1/projects/:projectId/keys')
->param('expire', null, new DatetimeValidation(), 'Expiration time in DateTime. Use null for unlimited expiration.', true)
->inject('response')
->inject('dbForConsole')
->action(function (string $projectId, string $name, array $scopes, string $expire, Response $response, Database $dbForConsole) {
->action(function (string $projectId, string $name, array $scopes, string|null $expire, Response $response, Database $dbForConsole) {
$project = $dbForConsole->getDocument('projects', $projectId);
@ -933,7 +933,7 @@ App::put('/v1/projects/:projectId/keys/:keyId')
->param('expire', null, new DatetimeValidation(), 'Expiration time in DateTime. Use null for unlimited expiration.', true)
->inject('response')
->inject('dbForConsole')
->action(function (string $projectId, string $keyId, string $name, array $scopes, string $expire, Response $response, Database $dbForConsole) {
->action(function (string $projectId, string $keyId, string $name, array $scopes, string|null $expire, Response $response, Database $dbForConsole) {
$project = $dbForConsole->getDocument('projects', $projectId);

View file

@ -812,9 +812,7 @@ trait AccountBase
$this->assertEquals('Account Verification', $lastEmail['subject']);
$verification = substr($lastEmail['text'], strpos($lastEmail['text'], '&secret=', 0) + 8, 256);
$expireTime = strpos($lastEmail['text'], 'expire=' . $response['body']['expire'], 0);
$expireTime = strpos($lastEmail['text'], 'expire=' . urlencode($response['body']['expire']), 0);
$this->assertNotFalse($expireTime);
$secretTest = strpos($lastEmail['text'], 'secret=' . $response['body']['secret'], 0);
@ -1107,7 +1105,7 @@ trait AccountBase
$this->assertEquals(201, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertEmpty($response['body']['secret']);
$this->assertIsNumeric($response['body']['expire']);
$this->assertIsString($response['body']['expire']);
$lastEmail = $this->getLastEmail();
@ -1117,7 +1115,7 @@ trait AccountBase
$recovery = substr($lastEmail['text'], strpos($lastEmail['text'], '&secret=', 0) + 8, 256);
$expireTime = strpos($lastEmail['text'], 'expire=' . $response['body']['expire'], 0);
$expireTime = strpos($lastEmail['text'], 'expire=' . urlencode($response['body']['expire']), 0);
$this->assertNotFalse($expireTime);
@ -1270,7 +1268,7 @@ trait AccountBase
$token = substr($lastEmail['text'], strpos($lastEmail['text'], '&secret=', 0) + 8, 256);
$expireTime = strpos($lastEmail['text'], 'expire=' . $response['body']['expire'], 0);
$expireTime = strpos($lastEmail['text'], 'expire=' . urlencode($response['body']['expire']), 0);
$this->assertNotFalse($expireTime);

View file

@ -282,7 +282,7 @@ class WebhooksCustomClientTest extends Scope
$this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide()));
$this->assertNotEmpty($webhook['data']['$id']);
$this->assertNotEmpty($webhook['data']['userId']);
$this->assertIsInt($webhook['data']['expire']);
$this->assertIsString($webhook['data']['expire']);
$this->assertEquals($webhook['data']['ip'], '127.0.0.1');
$this->assertNotEmpty($webhook['data']['osCode']);
$this->assertIsString($webhook['data']['osCode']);
@ -368,7 +368,7 @@ class WebhooksCustomClientTest extends Scope
$this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide()));
$this->assertNotEmpty($webhook['data']['$id']);
$this->assertNotEmpty($webhook['data']['userId']);
$this->assertIsInt($webhook['data']['expire']);
$this->assertIsString($webhook['data']['expire']);
$this->assertEquals($webhook['data']['ip'], '127.0.0.1');
$this->assertNotEmpty($webhook['data']['osCode']);
$this->assertIsString($webhook['data']['osCode']);
@ -679,7 +679,7 @@ class WebhooksCustomClientTest extends Scope
$this->assertNotEmpty($webhook['data']['$id']);
$this->assertNotEmpty($webhook['data']['userId']);
$this->assertNotEmpty($webhook['data']['secret']);
$this->assertIsNumeric($webhook['data']['expire']);
$this->assertIsString($webhook['data']['expire']);
$data['secret'] = $webhook['data']['secret'];
@ -739,7 +739,7 @@ class WebhooksCustomClientTest extends Scope
$this->assertNotEmpty($webhook['data']['$id']);
$this->assertNotEmpty($webhook['data']['userId']);
$this->assertNotEmpty($webhook['data']['secret']);
$this->assertIsNumeric($webhook['data']['expire']);
$this->assertIsString($webhook['data']['expire']);
$data['secret'] = $webhook['data']['secret'];
@ -795,7 +795,7 @@ class WebhooksCustomClientTest extends Scope
$this->assertNotEmpty($webhook['data']['$id']);
$this->assertNotEmpty($webhook['data']['userId']);
$this->assertNotEmpty($webhook['data']['secret']);
$this->assertIsNumeric($webhook['data']['expire']);
$this->assertIsString($webhook['data']['expire']);
$data['secret'] = $webhook['data']['secret'];
@ -853,7 +853,7 @@ class WebhooksCustomClientTest extends Scope
$this->assertNotEmpty($webhook['data']['$id']);
$this->assertNotEmpty($webhook['data']['userId']);
$this->assertNotEmpty($webhook['data']['secret']);
$this->assertIsNumeric($webhook['data']['expire']);
$this->assertIsString($webhook['data']['expire']);
$data['secret'] = $webhook['data']['secret'];