Skip to content

Commit b62347d

Browse files
Revert "test: skip integrations without env vars"
This reverts commit e229c43.
1 parent e229c43 commit b62347d

11 files changed

Lines changed: 24 additions & 63 deletions

File tree

tests/Messaging/Adapter/Base.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,4 @@ protected function assertResponse(array $response): void
4444
$this->assertEquals('', $response['results'][0]['error'], \var_export($response, true));
4545
$this->assertEquals('success', $response['results'][0]['status'], \var_export($response, true));
4646
}
47-
48-
/**
49-
* @param array<string> $variables
50-
*/
51-
protected function requireEnv(array $variables): void
52-
{
53-
foreach ($variables as $variable) {
54-
$value = \getenv($variable);
55-
56-
if ($value === false || $value === '') {
57-
$this->markTestSkipped('Missing required environment variable: '.$variable);
58-
}
59-
}
60-
}
6147
}

tests/Messaging/Adapter/Chat/DiscordTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99

1010
class DiscordTest extends Base
1111
{
12-
public function test_send_message(): void
12+
public function testSendMessage(): void
1313
{
14-
$this->requireEnv(['DISCORD_WEBHOOK_URL']);
15-
1614
$url = \getenv('DISCORD_WEBHOOK_URL');
1715

1816
$sender = new Discord($url);
@@ -47,13 +45,13 @@ public static function invalidURLProvider(): array
4745
/**
4846
* @dataProvider invalidURLProvider
4947
*/
50-
public function test_invalid_ur_ls(string $invalidURL): void
48+
public function testInvalidURLs(string $invalidURL): void
5149
{
5250
$this->expectException(InvalidArgumentException::class);
5351
new Discord($invalidURL);
5452
}
5553

56-
public function test_valid_url_variations(): void
54+
public function testValidURLVariations(): void
5755
{
5856
// Valid URL format variations
5957
$validURLs = [
@@ -68,12 +66,12 @@ public function test_valid_url_variations(): void
6866
// If we get here, the URL was accepted
6967
$this->assertTrue(true, "Valid URL variant '{$label}' was accepted as expected");
7068
} catch (InvalidArgumentException $e) {
71-
$this->fail("Valid URL variant '{$label}' was rejected: ".$e->getMessage());
69+
$this->fail("Valid URL variant '{$label}' was rejected: " . $e->getMessage());
7270
}
7371
}
7472
}
7573

76-
public function test_webhook_id_extraction(): void
74+
public function testWebhookIDExtraction(): void
7775
{
7876
// Create a reflection of Discord to access protected properties
7977
$webhookId = '123456789012345678';

tests/Messaging/Adapter/Email/MailgunTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99

1010
class MailgunTest extends Base
1111
{
12-
public function test_send_email(): void
12+
public function testSendEmail(): void
1313
{
14-
$this->requireEnv(['MAILGUN_API_KEY', 'MAILGUN_DOMAIN', 'TEST_EMAIL', 'TEST_CC_EMAIL', 'TEST_BCC_EMAIL', 'TEST_BCC_NAME']);
15-
1614
$key = \getenv('MAILGUN_API_KEY');
1715
$domain = \getenv('MAILGUN_DOMAIN');
1816

@@ -44,10 +42,8 @@ public function test_send_email(): void
4442
$this->assertResponse($response);
4543
}
4644

47-
public function test_send_email_with_attachments(): void
45+
public function testSendEmailWithAttachments(): void
4846
{
49-
$this->requireEnv(['MAILGUN_API_KEY', 'MAILGUN_DOMAIN', 'TEST_EMAIL']);
50-
5147
$key = \getenv('MAILGUN_API_KEY');
5248
$domain = \getenv('MAILGUN_DOMAIN');
5349

@@ -70,9 +66,9 @@ public function test_send_email_with_attachments(): void
7066
fromEmail: $fromEmail,
7167
attachments: [new Attachment(
7268
name: 'image.png',
73-
path: __DIR__.'/../../../assets/image.png',
69+
path: __DIR__ . '/../../../assets/image.png',
7470
type: 'image/png'
75-
), ],
71+
),],
7672
);
7773

7874
$response = $sender->send($message);

tests/Messaging/Adapter/Email/ResendTest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,19 @@
1010
class ResendTest extends Base
1111
{
1212
private Resend $sender;
13-
1413
private string $testEmail;
1514

1615
protected function setUp(): void
1716
{
1817
parent::setUp();
19-
$this->requireEnv(['RESEND_API_KEY', 'RESEND_TEST_EMAIL']);
20-
2118
$key = \getenv('RESEND_API_KEY');
2219
$this->sender = new Resend($key);
2320
$this->testEmail = \getenv('RESEND_TEST_EMAIL');
2421

2522
sleep(2);
2623
}
2724

28-
public function test_send_email(): void
25+
public function testSendEmail(): void
2926
{
3027
$to = $this->testEmail;
3128
$subject = 'Test Subject';
@@ -49,7 +46,7 @@ public function test_send_email(): void
4946
$this->assertResponse($response);
5047
}
5148

52-
public function test_send_email_with_html(): void
49+
public function testSendEmailWithHtml(): void
5350
{
5451
$to = $this->testEmail;
5552
$subject = 'Test HTML Subject';
@@ -70,7 +67,7 @@ public function test_send_email_with_html(): void
7067
$this->assertResponse($response);
7168
}
7269

73-
public function test_send_email_with_reply_to(): void
70+
public function testSendEmailWithReplyTo(): void
7471
{
7572
$to = $this->testEmail;
7673
$subject = 'Test Reply-To Subject';
@@ -93,7 +90,7 @@ public function test_send_email_with_reply_to(): void
9390
$this->assertResponse($response);
9491
}
9592

96-
public function test_send_multiple_emails(): void
93+
public function testSendMultipleEmails(): void
9794
{
9895
$to1 = $this->testEmail;
9996
$to2 = $this->testEmail;
@@ -118,7 +115,7 @@ public function test_send_multiple_emails(): void
118115
$this->assertEquals('success', $response['results'][1]['status'], \var_export($response, true));
119116
}
120117

121-
public function test_send_email_with_file_attachment(): void
118+
public function testSendEmailWithFileAttachment(): void
122119
{
123120
$message = new Email(
124121
to: [$this->testEmail],
@@ -138,7 +135,7 @@ public function test_send_email_with_file_attachment(): void
138135
$this->assertResponse($response);
139136
}
140137

141-
public function test_send_email_with_string_attachment(): void
138+
public function testSendEmailWithStringAttachment(): void
142139
{
143140
$message = new Email(
144141
to: [$this->testEmail],
@@ -159,7 +156,7 @@ public function test_send_email_with_string_attachment(): void
159156
$this->assertResponse($response);
160157
}
161158

162-
public function test_send_email_with_attachment_exceeding_max_size(): void
159+
public function testSendEmailWithAttachmentExceedingMaxSize(): void
163160
{
164161
$this->expectException(\Exception::class);
165162
$this->expectExceptionMessage('Total attachment size exceeds');

tests/Messaging/Adapter/Email/SendgridTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99

1010
class SendgridTest extends Base
1111
{
12-
public function test_send_email(): void
12+
public function testSendEmail(): void
1313
{
14-
$this->requireEnv(['SENDGRID_API_KEY', 'TEST_EMAIL', 'TEST_FROM_EMAIL', 'TEST_CC_EMAIL', 'TEST_BCC_EMAIL', 'TEST_BCC_NAME']);
15-
1614
$key = getenv('SENDGRID_API_KEY');
1715
$sender = new Sendgrid($key);
1816

@@ -38,10 +36,8 @@ public function test_send_email(): void
3836
$this->assertResponse($response);
3937
}
4038

41-
public function test_send_email_with_attachment(): void
39+
public function testSendEmailWithAttachment(): void
4240
{
43-
$this->requireEnv(['SENDGRID_API_KEY', 'TEST_EMAIL', 'TEST_FROM_EMAIL']);
44-
4541
$key = \getenv('SENDGRID_API_KEY');
4642
$sender = new Sendgrid($key);
4743

@@ -58,7 +54,7 @@ public function test_send_email_with_attachment(): void
5854
fromEmail: $fromEmail,
5955
attachments: [new Attachment(
6056
name: 'image.png',
61-
path: __DIR__.'/../../../assets/image.png',
57+
path: __DIR__ . '/../../../assets/image.png',
6258
type: 'image/png'
6359
)],
6460
);

tests/Messaging/Adapter/Push/APNSTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class APNSTest extends Base
99
protected function setUp(): void
1010
{
1111
parent::setUp();
12-
$this->requireEnv(['APNS_AUTHKEY_8KVVCLA3HL', 'APNS_AUTH_ID', 'APNS_TEAM_ID', 'APNS_BUNDLE_ID', 'APNS_TO']);
1312

1413
$authKey = \getenv('APNS_AUTHKEY_8KVVCLA3HL');
1514
$authKeyId = \getenv('APNS_AUTH_ID');

tests/Messaging/Adapter/Push/FCMTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class FCMTest extends Base
99
protected function setUp(): void
1010
{
1111
parent::setUp();
12-
$this->requireEnv(['FCM_SERVICE_ACCOUNT_JSON', 'FCM_TO']);
1312

1413
$serverKey = \getenv('FCM_SERVICE_ACCOUNT_JSON');
1514

tests/Messaging/Adapter/SMS/Fast2SMSTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ class Fast2SMSTest extends Base
1111
/**
1212
* Test Quick SMS route
1313
*/
14-
public function test_quick_sms(): void
14+
public function testQuickSMS(): void
1515
{
16-
$this->requireEnv(['FAST2SMS_API_KEY', 'FAST2SMS_TO']);
17-
1816
$sender = new Fast2SMS(
1917
apiKey: getenv('FAST2SMS_API_KEY'),
2018
useDLT: false
@@ -33,10 +31,8 @@ public function test_quick_sms(): void
3331
/**
3432
* Test DLT route
3533
*/
36-
public function test_dltsms(): void
34+
public function testDLTSMS(): void
3735
{
38-
$this->requireEnv(['FAST2SMS_API_KEY', 'FAST2SMS_SENDER_ID', 'FAST2SMS_MESSAGE_ID', 'FAST2SMS_TO']);
39-
4036
$sender = new Fast2SMS(
4137
apiKey: getenv('FAST2SMS_API_KEY'),
4238
senderId: getenv('FAST2SMS_SENDER_ID'),

tests/Messaging/Adapter/SMS/InforuTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ class InforuTest extends Base
1111
/**
1212
* @throws \Exception
1313
*/
14-
public function test_send_sms(): void
14+
public function testSendSMS(): void
1515
{
16-
$this->requireEnv(['INFORU_SENDER_ID', 'INFORU_API_TOKEN']);
17-
1816
$sender = new Inforu(
1917
senderId: \getenv('INFORU_SENDER_ID'),
2018
apiToken: \getenv('INFORU_API_TOKEN'),

tests/Messaging/Adapter/SMS/Msg91Test.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88

99
class Msg91Test extends Base
1010
{
11-
public function test_send_sms(): void
11+
public function testSendSMS(): void
1212
{
13-
$this->requireEnv(['MSG_91_SENDER_ID', 'MSG_91_AUTH_KEY', 'MSG_91_TEMPLATE_ID', 'MSG_91_TO']);
14-
1513
$sender = new Msg91(getenv('MSG_91_SENDER_ID'), getenv('MSG_91_AUTH_KEY'), getenv('MSG_91_TEMPLATE_ID'));
1614

1715
$message = new SMS(

0 commit comments

Comments
 (0)