Laravel 5模拟密码经纪人

4

从样板代码 PasswordController::postEmail() 中,我正在尝试模拟(使用Mockery)以下部分:

// $this->password is an instance of PasswordBroker
$response = $this->passwords->sendResetLink($request->only('email'), function($m)
    {
        $m->subject($this->getEmailSubject());
    });

在我的测试用例中,我正在调用->shouldReceive('sendResetLink')->with($postData, ???)。由于这是一个闭包,我确定我必须传递一个闭包,并且模拟$m->subject($this->getEmailSubject());,但我对此一无所知,因为我相对于TDD来说比较新手。请问我可以得到一些指导吗?
1个回答

4
->shouldReceive('sendResetLink')
->once()
->with($postData, \Mockery::type('Closure'));

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接