diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php index 36cade1ebb..427f5838b6 100644 --- a/tests/e2e/Services/Webhooks/WebhooksBase.php +++ b/tests/e2e/Services/Webhooks/WebhooksBase.php @@ -516,7 +516,7 @@ trait WebhooksBase $this->assertIsArray($webhook['data']['$read']); $this->assertIsArray($webhook['data']['$write']); $this->assertEquals($webhook['data']['name'], 'logo.png'); - $this->assertEquals(true, DateTime::isValid($webhook['body']['$createdAt'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); $this->assertNotEmpty($webhook['data']['signature']); $this->assertEquals($webhook['data']['mimeType'], 'image/png'); $this->assertEquals($webhook['data']['sizeOriginal'], 47218); @@ -572,7 +572,7 @@ trait WebhooksBase $this->assertIsArray($webhook['data']['$read']); $this->assertIsArray($webhook['data']['$write']); $this->assertEquals($webhook['data']['name'], 'logo.png'); - $this->assertEquals(true, DateTime::isValid($webhook['body']['$createdAt'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); $this->assertNotEmpty($webhook['data']['signature']); $this->assertEquals($webhook['data']['mimeType'], 'image/png'); $this->assertEquals($webhook['data']['sizeOriginal'], 47218); @@ -623,7 +623,7 @@ trait WebhooksBase $this->assertIsArray($webhook['data']['$read']); $this->assertIsArray($webhook['data']['$write']); $this->assertEquals($webhook['data']['name'], 'logo.png'); - $this->assertEquals(true, DateTime::isValid($webhook['body']['$createdAt'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); $this->assertNotEmpty($webhook['data']['signature']); $this->assertEquals($webhook['data']['mimeType'], 'image/png'); $this->assertEquals($webhook['data']['sizeOriginal'], 47218); @@ -706,7 +706,7 @@ trait WebhooksBase $this->assertEquals('Arsenal', $webhook['data']['name']); $this->assertGreaterThan(-1, $webhook['data']['total']); $this->assertIsInt($webhook['data']['total']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['$createdAt'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); /** * Test for FAILURE @@ -751,7 +751,7 @@ trait WebhooksBase $this->assertEquals('Demo New', $webhook['data']['name']); $this->assertGreaterThan(-1, $webhook['data']['total']); $this->assertIsInt($webhook['data']['total']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['$createdAt'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); /** * Test for FAILURE @@ -800,7 +800,7 @@ trait WebhooksBase $this->assertEquals('Chelsea', $webhook['data']['name']); $this->assertGreaterThan(-1, $webhook['data']['total']); $this->assertIsInt($webhook['data']['total']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['$createdAt'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['$createdAt'])); /** * Test for FAILURE @@ -861,7 +861,8 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['joined'])); + $this->assertEquals(false, DateTime::isValid($webhook['data']['joined'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['invited'])); $this->assertEquals(('server' === $this->getSide()), $webhook['data']['confirm']); /** @@ -933,7 +934,8 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['joined'])); + $this->assertEquals(false, DateTime::isValid($webhook['data']['joined'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['invited'])); $this->assertEquals(('server' === $this->getSide()), $webhook['data']['confirm']); } } diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php index fd80ae5c4a..a12f31d9ec 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php @@ -58,7 +58,7 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id']), true); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); - $this->assertEquals(true, DateTime::isValid($webhook['body']['registration'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['registration'])); $this->assertEquals($webhook['data']['status'], true); $this->assertEquals($webhook['data']['email'], $email); $this->assertEquals($webhook['data']['emailVerification'], false); @@ -134,7 +134,7 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); - $this->assertEquals(true, DateTime::isValid($webhook['body']['registration'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['registration'])); $this->assertEquals($webhook['data']['status'], false); $this->assertEquals($webhook['data']['email'], $email); $this->assertEquals($webhook['data']['emailVerification'], false); @@ -194,7 +194,7 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id']), true); $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['expire'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); $this->assertEquals($webhook['data']['ip'], '127.0.0.1'); $this->assertNotEmpty($webhook['data']['osCode']); $this->assertIsString($webhook['data']['osCode']); @@ -369,7 +369,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->assertEquals(true, DateTime::isValid($webhook['body']['expire'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); $this->assertEquals($webhook['data']['ip'], '127.0.0.1'); $this->assertNotEmpty($webhook['data']['osCode']); $this->assertIsString($webhook['data']['osCode']); @@ -680,7 +680,7 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['expire'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -740,7 +740,7 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['expire'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -796,7 +796,7 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['expire'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -854,7 +854,7 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['expire'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['expire'])); $data['secret'] = $webhook['data']['secret']; @@ -917,7 +917,7 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(true, DateTime::isValid($webhook['body']['joined'])); + $this->assertEquals(true, DateTime::isValid($webhook['data']['joined'])); $this->assertEquals(true, $webhook['data']['confirm']); /**