Skip to content

Commit f92546a

Browse files
committed
use assertSame in tests
1 parent 6c5be45 commit f92546a

9 files changed

Lines changed: 53 additions & 53 deletions

File tree

tests/Messaging/Adapter/Base.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ protected function getLastEmail(): array
4040
*/
4141
protected function assertResponse(array $response): void
4242
{
43-
$this->assertEquals(1, $response['deliveredTo'], \var_export($response, true));
44-
$this->assertEquals('', $response['results'][0]['error'], \var_export($response, true));
45-
$this->assertEquals('success', $response['results'][0]['status'], \var_export($response, true));
43+
$this->assertSame(1, $response['deliveredTo'], \var_export($response, true));
44+
$this->assertSame('', $response['results'][0]['error'], \var_export($response, true));
45+
$this->assertSame('success', $response['results'][0]['status'], \var_export($response, true));
4646
}
4747
}

tests/Messaging/Adapter/Chat/DiscordTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ public function testWebhookIDExtraction(): void
8282
$property = $reflector->getProperty('webhookId');
8383
$property->setAccessible(true);
8484

85-
$this->assertEquals($webhookId, $property->getValue($discord), 'Webhook ID was not correctly extracted');
85+
$this->assertSame($webhookId, $property->getValue($discord), 'Webhook ID was not correctly extracted');
8686
}
8787
}

tests/Messaging/Adapter/Email/EmailTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public function testSendEmail(): void
3535
$lastEmail = $this->getLastEmail();
3636

3737
$this->assertResponse($response);
38-
$this->assertEquals($to, $lastEmail['to'][0]['address']);
39-
$this->assertEquals($fromEmail, $lastEmail['from'][0]['address']);
40-
$this->assertEquals($fromName, $lastEmail['from'][0]['name']);
41-
$this->assertEquals($subject, $lastEmail['subject']);
42-
$this->assertEquals($content, \trim($lastEmail['text']));
43-
$this->assertEquals($cc[0]['email'], $lastEmail['cc'][0]['address']);
44-
$this->assertEquals($bcc[0]['email'], $lastEmail['envelope']['to'][2]['address']);
38+
$this->assertSame($to, $lastEmail['to'][0]['address']);
39+
$this->assertSame($fromEmail, $lastEmail['from'][0]['address']);
40+
$this->assertSame($fromName, $lastEmail['from'][0]['name']);
41+
$this->assertSame($subject, $lastEmail['subject']);
42+
$this->assertSame($content, \trim($lastEmail['text']));
43+
$this->assertSame($cc[0]['email'], $lastEmail['cc'][0]['address']);
44+
$this->assertSame($bcc[0]['email'], $lastEmail['envelope']['to'][2]['address']);
4545
}
4646
}

tests/Messaging/Adapter/Email/ResendTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ public function testSendMultipleEmails(): void
108108

109109
$response = $this->sender->send($message);
110110

111-
$this->assertEquals(2, $response['deliveredTo'], \var_export($response, true));
112-
$this->assertEquals('', $response['results'][0]['error'], \var_export($response, true));
113-
$this->assertEquals('success', $response['results'][0]['status'], \var_export($response, true));
114-
$this->assertEquals('', $response['results'][1]['error'], \var_export($response, true));
115-
$this->assertEquals('success', $response['results'][1]['status'], \var_export($response, true));
111+
$this->assertSame(2, $response['deliveredTo'], \var_export($response, true));
112+
$this->assertSame('', $response['results'][0]['error'], \var_export($response, true));
113+
$this->assertSame('success', $response['results'][0]['status'], \var_export($response, true));
114+
$this->assertSame('', $response['results'][1]['error'], \var_export($response, true));
115+
$this->assertSame('success', $response['results'][1]['status'], \var_export($response, true));
116116
}
117117

118118
public function testSendEmailWithAttachmentsThrowsException(): void

tests/Messaging/Adapter/Email/SMTPTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public function testSendEmail(): void
3535
$lastEmail = $this->getLastEmail();
3636

3737
$this->assertResponse($response);
38-
$this->assertEquals($to, $lastEmail['to'][0]['address']);
39-
$this->assertEquals($fromEmail, $lastEmail['from'][0]['address']);
40-
$this->assertEquals($subject, $lastEmail['subject']);
41-
$this->assertEquals($content, \trim($lastEmail['text']));
38+
$this->assertSame($to, $lastEmail['to'][0]['address']);
39+
$this->assertSame($fromEmail, $lastEmail['from'][0]['address']);
40+
$this->assertSame($subject, $lastEmail['subject']);
41+
$this->assertSame($content, \trim($lastEmail['text']));
4242
}
4343

4444
public function testSendEmailWithAttachment(): void
@@ -72,10 +72,10 @@ public function testSendEmailWithAttachment(): void
7272
$lastEmail = $this->getLastEmail();
7373

7474
$this->assertResponse($response);
75-
$this->assertEquals($to, $lastEmail['to'][0]['address']);
76-
$this->assertEquals($fromEmail, $lastEmail['from'][0]['address']);
77-
$this->assertEquals($subject, $lastEmail['subject']);
78-
$this->assertEquals($content, \trim($lastEmail['text']));
75+
$this->assertSame($to, $lastEmail['to'][0]['address']);
76+
$this->assertSame($fromEmail, $lastEmail['from'][0]['address']);
77+
$this->assertSame($subject, $lastEmail['subject']);
78+
$this->assertSame($content, \trim($lastEmail['text']));
7979
}
8080

8181
public function testSendEmailOnlyBCC(): void
@@ -110,8 +110,8 @@ public function testSendEmailOnlyBCC(): void
110110
$lastEmail = $this->getLastEmail();
111111

112112
$this->assertResponse($response);
113-
$this->assertEquals($fromEmail, $lastEmail['from'][0]['address']);
114-
$this->assertEquals($subject, $lastEmail['subject']);
115-
$this->assertEquals($content, \trim($lastEmail['text']));
113+
$this->assertSame($fromEmail, $lastEmail['from'][0]['address']);
114+
$this->assertSame($subject, $lastEmail['subject']);
115+
$this->assertSame($content, \trim($lastEmail['text']));
116116
}
117117
}

tests/Messaging/Adapter/SMS/GEOSMS/CallingCodeTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ class CallingCodeTest extends Base
99
{
1010
public function testFromPhoneNumber(): void
1111
{
12-
$this->assertEquals(CallingCode::NORTH_AMERICA, CallingCode::fromPhoneNumber('+11234567890'));
13-
$this->assertEquals(CallingCode::INDIA, CallingCode::fromPhoneNumber('+911234567890'));
14-
$this->assertEquals(CallingCode::ISRAEL, CallingCode::fromPhoneNumber('9721234567890'));
15-
$this->assertEquals(CallingCode::UNITED_ARAB_EMIRATES, CallingCode::fromPhoneNumber('009711234567890'));
16-
$this->assertEquals(CallingCode::UNITED_KINGDOM, CallingCode::fromPhoneNumber('011441234567890'));
17-
$this->assertEquals(null, CallingCode::fromPhoneNumber('2'));
12+
$this->assertSame(CallingCode::NORTH_AMERICA, CallingCode::fromPhoneNumber('+11234567890'));
13+
$this->assertSame(CallingCode::INDIA, CallingCode::fromPhoneNumber('+911234567890'));
14+
$this->assertSame(CallingCode::ISRAEL, CallingCode::fromPhoneNumber('9721234567890'));
15+
$this->assertSame(CallingCode::UNITED_ARAB_EMIRATES, CallingCode::fromPhoneNumber('009711234567890'));
16+
$this->assertSame(CallingCode::UNITED_KINGDOM, CallingCode::fromPhoneNumber('011441234567890'));
17+
$this->assertSame(null, CallingCode::fromPhoneNumber('2'));
1818
}
1919
}

tests/Messaging/Adapter/SMS/GEOSMSTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public function testSendSMSUsingDefaultAdapter(): void
2929

3030
$result = $adapter->send($message);
3131

32-
$this->assertEquals(1, count($result));
33-
$this->assertEquals('success', $result['default']['results'][0]['status']);
32+
$this->assertSame(1, count($result));
33+
$this->assertSame('success', $result['default']['results'][0]['status']);
3434
}
3535

3636
public function testSendSMSUsingLocalAdapter(): void
@@ -54,8 +54,8 @@ public function testSendSMSUsingLocalAdapter(): void
5454

5555
$result = $adapter->send($message);
5656

57-
$this->assertEquals(1, count($result));
58-
$this->assertEquals('success', $result['local']['results'][0]['status']);
57+
$this->assertSame(1, count($result));
58+
$this->assertSame('success', $result['local']['results'][0]['status']);
5959
}
6060

6161
public function testSendSMSUsingLocalAdapterAndDefault(): void
@@ -81,9 +81,9 @@ public function testSendSMSUsingLocalAdapterAndDefault(): void
8181

8282
$result = $adapter->send($message);
8383

84-
$this->assertEquals(2, count($result));
85-
$this->assertEquals('success', $result['local']['results'][0]['status']);
86-
$this->assertEquals('success', $result['default']['results'][0]['status']);
84+
$this->assertSame(2, count($result));
85+
$this->assertSame('success', $result['local']['results'][0]['status']);
86+
$this->assertSame('success', $result['default']['results'][0]['status']);
8787
}
8888

8989
public function testSendSMSUsingGroupedLocalAdapter(): void
@@ -108,7 +108,7 @@ public function testSendSMSUsingGroupedLocalAdapter(): void
108108

109109
$result = $adapter->send($message);
110110

111-
$this->assertEquals(1, count($result));
112-
$this->assertEquals('success', $result['local']['results'][0]['status']);
111+
$this->assertSame(1, count($result));
112+
$this->assertSame('success', $result['local']['results'][0]['status']);
113113
}
114114
}

tests/Messaging/Adapter/SMS/SMSTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ public function testSendSMS(): void
2525

2626
$smsRequest = $this->getLastRequest();
2727

28-
$this->assertEquals('http://request-catcher:5000/mock-sms', $smsRequest['url']);
29-
$this->assertEquals('Appwrite Mock Message Sender', $smsRequest['headers']['User-Agent']);
30-
$this->assertEquals('username', $smsRequest['headers']['X-Username']);
31-
$this->assertEquals('password', $smsRequest['headers']['X-Key']);
32-
$this->assertEquals('POST', $smsRequest['method']);
33-
$this->assertEquals('+987654321', $smsRequest['data']['from']);
34-
$this->assertEquals('+123456789', $smsRequest['data']['to']);
35-
$this->assertEquals(98, $sender->getCountryCode($smsRequest['data']['from']));
36-
$this->assertEquals(1, $sender->getCountryCode($smsRequest['data']['to']));
28+
$this->assertSame('http://request-catcher:5000/mock-sms', $smsRequest['url']);
29+
$this->assertSame('Appwrite Mock Message Sender', $smsRequest['headers']['User-Agent']);
30+
$this->assertSame('username', $smsRequest['headers']['X-Username']);
31+
$this->assertSame('password', $smsRequest['headers']['X-Key']);
32+
$this->assertSame('POST', $smsRequest['method']);
33+
$this->assertSame('+987654321', $smsRequest['data']['from']);
34+
$this->assertSame('+123456789', $smsRequest['data']['to']);
35+
$this->assertSame(98, $sender->getCountryCode($smsRequest['data']['from']));
36+
$this->assertSame(1, $sender->getCountryCode($smsRequest['data']['to']));
3737
}
3838
}

tests/Messaging/Adapter/SMS/TelnyxTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public function testSendSMS(): void
2020
// );
2121

2222
// $result = $sender->send($message);
23-
24-
// $this->assertEquals('success', $result["type"]);
23+
//
24+
// $this->assertSame('success', $result["type"]);
2525

2626
$this->markTestSkipped('Telnyx had no testing numbers available at this time.');
2727
}

0 commit comments

Comments
 (0)