diff --git a/tests/e2e/Services/Realtime/RealtimeBase.php b/tests/e2e/Services/Realtime/RealtimeBase.php index 30c411ba93..f6e786c249 100644 --- a/tests/e2e/Services/Realtime/RealtimeBase.php +++ b/tests/e2e/Services/Realtime/RealtimeBase.php @@ -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 + } } } diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index 260d5da3bf..6e0a074cbf 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -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() diff --git a/tests/unit/Auth/AuthTest.php b/tests/unit/Auth/AuthTest.php index 705da42879..5036e4b18e 100644 --- a/tests/unit/Auth/AuthTest.php +++ b/tests/unit/Auth/AuthTest.php @@ -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 diff --git a/tests/unit/Utopia/ResponseTest.php b/tests/unit/Utopia/ResponseTest.php index 452119fafb..42696fc68d 100644 --- a/tests/unit/Utopia/ResponseTest.php +++ b/tests/unit/Utopia/ResponseTest.php @@ -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