Skip to content

Commit 5d12452

Browse files
authored
Merge pull request #98 from utopia-php/feat-customizable-mock
Feat: Customizable SMS mock
2 parents c151aa5 + 1f761b5 commit 5d12452

File tree

1 file changed

+14
-1
lines changed
  • src/Utopia/Messaging/Adapter/SMS

1 file changed

+14
-1
lines changed

src/Utopia/Messaging/Adapter/SMS/Mock.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class Mock extends SMSAdapter
1010
{
1111
protected const NAME = 'Mock';
1212

13+
protected string $url = 'http://request-catcher:5000/mock-sms';
14+
1315
/**
1416
* @param string $user User ID
1517
* @param string $secret User secret
@@ -25,6 +27,17 @@ public function getName(): string
2527
return static::NAME;
2628
}
2729

30+
public function getEndpoint(): string
31+
{
32+
return $this->url;
33+
}
34+
35+
public function setEndpoint(string $url): self
36+
{
37+
$this->url = $url;
38+
return $this;
39+
}
40+
2841
public function getMaxMessagesPerRequest(): int
2942
{
3043
return 1000;
@@ -43,7 +56,7 @@ protected function process(SMSMessage $message): array
4356

4457
$result = $this->request(
4558
method: 'POST',
46-
url: 'http://request-catcher:5000/mock-sms',
59+
url: $this->url,
4760
headers: [
4861
'Content-Type: application/json',
4962
"X-Username: {$this->user}",

0 commit comments

Comments
 (0)