mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Replace expectException with try/catch
This commit is contained in:
@@ -49,8 +49,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
|
||||
@@ -68,7 +72,11 @@ trait RealtimeBase
|
||||
$this->assertEquals(1008, $payload['data']['code']);
|
||||
$this->assertEquals('Missing or unknown project ID', $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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user