[{"data":1,"prerenderedAt":31},["ShallowReactive",2],{"$f24oewmzebulq2":3,"$f72ks4xcemiba":22},{"content":4,"package":5,"version":21},"# Testing\n\n::div{class=\"docs-note docs-note--new-feature\"}\nThe testing utilities were added in the 3.1 release.\n::\nWhen testing code that sends messages or places calls, you can replace the client with a fake using the `TwilioClient` facade's `fake()` method. The fake records the messages and calls instead of sending them to Twilio, and provides assertions to check what was sent. Code using the facade or the `BabDev\\Twilio\\Contracts\\TwilioClient` contract, including notifications sent through the \"twilio\" channel, uses the fake.\n\n```php\nuse BabDev\\Twilio\\Facades\\TwilioClient;\nuse BabDev\\Twilio\\Testing\\SentMessage;\n\npublic function test_the_customer_is_notified_when_their_order_ships(): void\n{\n    $twilio = TwilioClient::fake();\n\n    \u002F\u002F Ship the order...\n\n    $twilio->assertMessageSentTo('+15558675309', function (SentMessage $message): bool {\n        return str_contains($message->message, 'has shipped');\n    });\n}\n```\n\nThe fake records the arguments your code passed to the client. Each message is a `BabDev\\Twilio\\Testing\\SentMessage` with the `connection` it was sent through, the `to` number, the `message` text, and any `params`, and each call is a `BabDev\\Twilio\\Testing\\PlacedCall` with the `connection`, `to` number, and `params`. The connection's default \"from\" number and Messaging Service are not added to the recorded parameters.\n\nThe following assertions are available, each accepting an optional callback to filter the recorded messages or calls:\n\n- `assertMessageSent(?callable $callback = null)`\n- `assertMessageSentTo(string $to, ?callable $callback = null)`\n- `assertMessageNotSent(?callable $callback = null)`\n- `assertMessageSentTimes(int $times, ?callable $callback = null)`\n- `assertCallPlaced(?callable $callback = null)`\n- `assertCallPlacedTo(string $to, ?callable $callback = null)`\n- `assertCallNotPlaced(?callable $callback = null)`\n- `assertCallPlacedTimes(int $times, ?callable $callback = null)`\n- `assertNothingSent()`\n\nThe recorded messages and calls can also be retrieved with the `messages()` and `calls()` methods, which accept the same optional callback.\n\nRequests made directly through the Twilio SDK, such as through the `twilio()` method, are not recorded by the fake. These requests are sent with Laravel's HTTP client, so they can be faked with [`Http::fake()`](https:\u002F\u002Flaravel.com\u002Fdocs\u002Fhttp-client#testing).\n",{"name":6,"slug":7,"description":8,"github":9,"packagistName":11,"packageType":12,"hasDocumentation":13,"supported":13,"visible":13,"versions":14},"Laravel Twilio","laravel-twilio","Twilio SDK integration for Laravel",{"owner":10,"repo":7},"BabDev","babdev\u002Flaravel-twilio","laravel-package",true,[15,17,19],{"version":16,"released":13},"3.x",{"version":18,"released":13},"2.x",{"version":20,"released":13},"1.x",{"version":16,"released":13},{"content":23,"package":24,"version":30},"- [Introduction](\u002Fopen-source\u002Fpackages\u002Flaravel-twilio\u002Fdocs\u002F3.x\u002Fintro)\n- [Installation & Setup](\u002Fopen-source\u002Fpackages\u002Flaravel-twilio\u002Fdocs\u002F3.x\u002Finstallation)\n- [Using The Client](\u002Fopen-source\u002Fpackages\u002Flaravel-twilio\u002Fdocs\u002F3.x\u002Fclient-usage)\n- [Connection Management](\u002Fopen-source\u002Fpackages\u002Flaravel-twilio\u002Fdocs\u002F3.x\u002Fconnections)\n- [Notifications](\u002Fopen-source\u002Fpackages\u002Flaravel-twilio\u002Fdocs\u002F3.x\u002Fnotifications)\n- [Webhooks](\u002Fopen-source\u002Fpackages\u002Flaravel-twilio\u002Fdocs\u002F3.x\u002Fwebhooks)\n- [Testing](\u002Fopen-source\u002Fpackages\u002Flaravel-twilio\u002Fdocs\u002F3.x\u002Ftesting)\n",{"name":6,"slug":7,"description":8,"github":25,"packagistName":11,"packageType":12,"hasDocumentation":13,"supported":13,"visible":13,"versions":26},{"owner":10,"repo":7},[27,28,29],{"version":16,"released":13},{"version":18,"released":13},{"version":20,"released":13},{"version":16,"released":13},1790810589120]