Compare commits

...
4 changed files with 37 additions and 16 deletions
+12 -4
View File
@@ -58,8 +58,12 @@ trait RealtimeBase
$this->assertEquals(1008, $payload["data"]["code"]);
$this->assertEquals("Missing channels", $payload["data"]["message"]);
\usleep(250000); // 250ms
$this->expectException(ConnectionException::class); // Check if server disconnnected client
$client->close();
try {
$client->close();
} catch (ConnectionException $e) {
$this->assertInstanceOf(ConnectionException::class, $e); // Check if server disconnected client
}
}
public function testConnectionFailureUnknownProject(): void
@@ -83,7 +87,11 @@ trait RealtimeBase
$payload["data"]["message"]
);
\usleep(250000); // 250ms
$this->expectException(ConnectionException::class); // Check if server disconnnected client
$client->close();
try {
$client->close();
} catch (ConnectionException $e) {
$this->assertInstanceOf(ConnectionException::class, $e); // Check if server disconnected client
}
}
}
@@ -228,10 +228,17 @@ class RealtimeCustomClientTest extends Scope
$this->assertArrayHasKey('data', $payload);
$this->assertEquals('error', $payload['type']);
$this->assertEquals(1008, $payload['data']['code']);
$this->assertEquals('Invalid Origin. Register your new client (appwrite.unknown) as a new Web platform on your project console dashboard', $payload['data']['message']);
$this->assertEquals(
'Invalid Origin. Register your new client (appwrite.unknown) as a new Web platform on your project console dashboard',
$payload['data']['message']
);
\usleep(250000); // 250ms
$this->expectException(ConnectionException::class); // Check if server disconnnected client
$client->close();
try {
$client->close();
} catch (ConnectionException $e) {
$this->assertInstanceOf(ConnectionException::class, $e); // Check if server disconnected client
}
}
public function testChannelAccount()
+7 -4
View File
@@ -173,12 +173,15 @@ class AuthTest extends TestCase
public function testUnknownAlgo()
{
$this->expectExceptionMessage('Hashing algorithm \'md8\' is not supported.');
// Bcrypt - Cost 5
$plain = 'whatIsMd8?!?';
$generatedHash = Auth::passwordHash($plain, 'md8');
$this->assertEquals(true, Auth::passwordVerify($plain, $generatedHash, 'md8'));
try {
$generatedHash = Auth::passwordHash($plain, 'md8');
$this->assertEquals(true, Auth::passwordVerify($plain, $generatedHash, 'md8'));
} catch (\Exception $e) {
$this->assertEquals('Hashing algorithm \'md8\' is not supported.', $e->getMessage());
}
}
public function testPasswordGenerator(): void
+8 -5
View File
@@ -100,11 +100,14 @@ class ResponseTest extends TestCase
public function testResponseModelRequiredException(): void
{
$this->expectException(Exception::class);
$this->response->output(new Document([
'integer' => 123,
'boolean' => true,
]), 'single');
try {
$this->response->output(new Document([
'integer' => 123,
'boolean' => true,
]), 'single');
} catch (\Exception $e) {
$this->assertInstanceOf(Exception::class, $e);
}
}
public function testResponseModelLists(): void