我正在使用“ redis ”来管理队列
phpunit.xml:
<server name="QUEUE_CONNECTION" value="redis"/>
但是在以下测试中,队列的连接名称返回“ 空”:
/** @test */
public function is_pushed_to_queue()
{
Queue::fake();
$user = factory(User::class)->create();
$user->notify(
new EmailVerificationNotification($user)
);
$this->assertEquals(1, Queue::size());
$this->assertEquals('redis', Queue::getConnectionName());// getConnectionName returns "null"
}
phpunit错误:
Failed asserting that null matches expected 'redis'.
如何测试“ redis ”队列的连接?