此版本包括计划任务事件、新的 JSON 断言方法和所有最新更改。让我们来看看这个版本中的一些亮点新特性:
首先,在 TestResponse 类中添加了一个 assertJsonPath() 断言,对于在 JSON 响应中使用针对嵌套属性的点符号断言值,这个断言非常方便:
$this- getJson(route('api.post.show', [$post- id]))
- assertJsonPath('tags', [])
- assertJsonPath('comments.0.user.username', 'ecrmnn')
- assertJsonPath('comments.*.body', [
'First!',
'This is my comment',
]);
接着,不论生成器类是否有全局/本地的宏,为了便于断言,向 Eloquent 生成器添加三个新的访问方法:
$builder- hasMacro($name);
$builder- getGlobalMacro($name);
$builder- hasGlobalMacro($name);
向 BelongsToMany 关联添加另一个访问方法来获取中间表的列:
$example- getPivotColumns();
接着,为定时任务准备两个事件:ScheduledTaskStarting 和 ScheduledTaskFinished 。 你可以在 Michael Dyrynda 的文章 Pull Request #29888 中学习更多这些事件的相关内容。相信你朋友。
此版本中的最后一个新更新是允许使用 inputargument 和 inputoption 对象定义命令参数和选项:
// 当前样式,仍受支持
protected function getArguments()
{
return [
['name', InputArgument::REQUIRED, 'the argument\'s description', 'default value'],
];
}
// 新风格
protected function getArguments()
{
return [
new InputArgument('name', InputArgument::REQUIRED, 'the argument\'s description', 'default value'),
];
}
这个特性以向后兼容的方式工作,只是添加了另一种定义参数和选项的替代方式。
您可以在下面看到修复的完整列表,以及 Github 上 6.0.3 和 6.0.4 之间的全部差异。 Laravel 5.8 的完整发行说明可在 Github v6 changelog 中找到:
Laravel v6.0.4 版本
新增
TestResponse::assertJsonPath()
方法 (#29957)Eloquent Builder
添加了 hasglobalmacro
、 getglobalmacro
、hasglobalmacro
方法 (#30008)Illuminate\Database\Eloquent\Relations\BelongsToMany::getPivotColumns()
方法(#30049)ScheduledTaskFinished
ScheduledTaskStarting
计划任务运行时发出信号的事件 (#29888)InputArgument
InputOption
对象的命令参数和选项 (#29987)修复
__()
和 null
参数 (#29967)updated_at
列的问题 (#29970)Illuminate\Redis\Limiters\ConcurrencyLimiter
(#30005)Responsable
接口的响应对象实例时的 VerifyCsrfToken
中间件 (#29972)Postgresql
列创建时没有可选精度的问题 (#29873)allowed
异常添加 NotFoundHttpException
的问题(#29975)变更
0
/false
禁用加密成为可能 (#29985)validate dimensions
中允许 symfony
文件实例 (#30009)pendingmail
中设置语言环境 (dd1e0a6)重构
Alpha
排序 (#29954, #29958)auth.throttle
翻译的可读性 (#30011, #30017)以上就是本文的全部内容,希望对大家的学习有所帮助。