Laravel 5 测试未定义的属性$client


Laravel 5 testing undefined property $client

我正在尝试Laravel 5(4.3),并尝试编写一些简单的控制器测试,如下所示:

public function testIndex()
{
   $this->call('GET', 'posts');
   $this->assertResponseOk();
}

当我运行测试时,出现错误:

错误异常: 未定义的属性: 帖子控制器测试::$client

为什么客户端属性从 Laravel 5 的测试类中消失了?

函数类似

$this->assertResponseOk();

在 Laravel 5 的当前版本中不可用。我不确定泰勒是否打算重新引入它们。

我认为您可以添加以下软件包来恢复一些功能

https://github.com/orchestral/testbench