【问题标题】:Missing required parameters for [Route] unit testing缺少 [Route] 单元测试所需的参数
【发布时间】:2018-02-27 08:17:46
【问题描述】:

我有这段代码用于控制器存储方法的功能测试

$response= $this->post(route('contact.store'),[$client->value])

但是我收到了这个错误

Missing required parameters for [Route: contact.store] [URI: client/{clientValue}/contact].

我该如何解决这个问题?

【问题讨论】:

    标签: php unit-testing testing laravel-5 laravel-5.5


    【解决方案1】:

    当发布到带有参数的 url 时,例如/posts/1你需要给路由助手必要的数据。

    用这个例子route('post.show', ['id' => 1])

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-03
      • 2021-08-17
      • 1970-01-01
      • 2018-10-28
      • 1970-01-01
      • 2023-02-02
      • 1970-01-01
      相关资源
      最近更新 更多