milroyfraser/pest-plugin-gwt 问题修复 & 功能扩展

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

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

milroyfraser/pest-plugin-gwt

最新稳定版本:v2.0.0

Composer 安装命令:

composer require --dev milroyfraser/pest-plugin-gwt

包简介

Given When Then(GWT) Plugin for Pest

README 文档

README

A simple API allows you to structure your tests focused on the behaviour. Given-When-Then separation makes the test easier to understand at a glance.

Install

composer require milroyfraser/pest-plugin-gwt --dev

Usage

use App\Exceptions\BlockedUserException;
use App\Models\User;
use function Pest\Gwt\scenario;
use function Pest\Laravel\assertDatabaseHas;

scenario('activate user')
    ->given(fn() => User::factory()->create())
    ->when(fn(User $user) => $user->activate())
    ->then(fn(User $user) => assertDatabaseHas('users', [
        'id' => $user->id,
        'activated' => true,
    ]));

scenario('activate blocked user')
    ->given(fn() => User::factory()->blocked()->create())
    ->when(fn(User $user) => $user->activate())
    ->throws(BlockedUserException::class);

more examples

Given a state

Given method accepts a Closure. This is where we Arrange application state. The return values will become argument/s of the when closure.

When I do something

When method accepts a Closure. This is where we Act (perform) the operation. The return values will become argument/s of the then closure.

Then I expect an outcome

Then method accepts a Closure. This is where we Assert the outcome.

If you want to start testing your application with Pest, visit the main Pest Repository.

Pest was created by Nuno Maduro under the Sponsorware license. It got open-sourced and is now licensed under the MIT license.

统计信息

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

GitHub 信息

  • Stars: 103
  • Watchers: 5
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-10