holgerk/pest-plugin-equal-golden 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

holgerk/pest-plugin-equal-golden

最新稳定版本:v1.0.1

Composer 安装命令:

composer require --dev holgerk/pest-plugin-equal-golden

包简介

Provides a toEqualGolden assertion, same as toEqual, but when null is given as argument, the test file is automatically edited and null is substituted with the actual value

README 文档

README

run-tests

Provides a toEqualGolden assertion, same as toEqual, but when null is given as argument, the test file is automatically edited and null is substituted with the actual value.

So, if you add:

expect(['color' => 'golden'])
    ->toEqualGolden(null);

...to your test and execute it. The null expression is replaced by the actual value:

expect(['color' => 'golden'])
    ->toEqualGolden(['color' => 'golden']);

In principle, it's about saving oneself the recurring work of writing, updating and copying an expectation.

Installation

You can install the package via composer:

composer require holgerk/pest-plugin-equal-golden --dev

Usage

Just pass null to the toEqualGolden expectation and null will be automatically replaced during the first test run.

expect($actual)->toEqualGolden(null);

Later you can edit the expectation by hand or insert null again to have it automatically replaced.
If you want to regenerate all expectations at once you can add the argument: --update-golden to your pest invocation.

# regenerate all expectations at once from their actual values
./vendor/bin/pest --update-golden

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

See Also

  • pest-plugin-snapshots
    This plugin also facilitates the automatic generation of expectations from the actual value, but it will store the generated expectation in separate files.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-31