8000 NotificationFake error · Issue #49950 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content
NotificationFake error #49950
Closed
Closed
@Herbertzz

Description

@Herbertzz

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

<?php

namespace Tests\Feature;

use App\Notifications\MobileVerifyCode;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Notification;
use Tests\TestCase;

class NotificationSendTest extends TestCase
{
    use RefreshDatabase;

    public function test_mobile_verify_code()
    {
        Notification::fake();
        $mobiles = ['18800001111', '19911112222'];
        Notification::send($mobiles, new MobileVerifyCode('012345', 5));
        Notification::assertSentTimes(MobileVerifyCode::class, 2);

//        $user = User::factory()->create();
//        Notification::send($user, new MobileVerifyCode('012345', 5));
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0