-
Notifications
You must be signed in to change notification settings - Fork 11.4k
NotificationFake error #49950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You are getting this issue because you are passing an array of strings to the framework/src/Illuminate/Notifications/NotificationSender.php Lines 96 to 99 in c4f46ab
When faking notifications using
The line above tries to add the notification you just sent to an array like this:
Since you are passing an array of strings, that line will throw an exception when calling Possible solutionBy reading your example code, I assume you are trying to send on-demand notifications. If you want to send the Notification::fake();
$mobiles = ['18800001111', '19911112222'];
foreach ($mobiles as $mobile) {
Notification::route('vonage', $mobile)
->notify(new MobileVerifyCode('012345', 5));
}
// Or:
Notification::route('vonage', $mobiles[0])
->route('vonage', $mobiles[1])
->notify(new MobileVerifyCode('012345', 5));
} |
See above. |
Laravel Version
10.41.0
PHP Version
8.3
Database Driver & Version
No response
Description
TypeError: get_class(): Argument #1 ($object) must be of type object, string given
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php:315
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php:280
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:355
/var/www/html/tests/Feature/NotificationSendTest.php:21
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:177
Steps To Reproduce
Execute the following test classes
The text was updated successfully, but these errors were encountered: