【发布时间】:2020-03-03 23:22:24
【问题描述】:
我今天早上在 Laravel 中做了一些邮件测试,结果很有效。
现在想测试队列,看到Mail::assertNotQueued(...)
就像Laravel Docs 中所说的那样。该方法需要一个 $mailable 字符串。详情见here。但是我查看了文档,没有找到任何说明这个“可邮寄字符串”是什么的内容......
执行Mail::assertNotQueued(new WorkflowEMail());,显然失败了,因为 class != string。
这是我的测试类:
class WorkflowEmailTest extends TestCase
{
use DatabaseMigrations;
/** @test **/
public function an_workflow_email_is_send()
{
//$this->markTestSkipped('must be revisited.');
$this->withoutExceptionHandling();
Mail::fake();
Mail::assertNotQueued(new WorkflowEMail());
Mail::to('test@apitest.test')->send(new WorkflowEMail());
Mail::assertQueued(WorkflowEMail::class,1);
}
谁能指出我的文档或告诉我如何正确测试它?
【问题讨论】:
标签: laravel email mocking phpunit