driade/sleepery 问题修复 & 功能扩展

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

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

driade/sleepery

最新稳定版本:1.0.2

Composer 安装命令:

composer require driade/sleepery

包简介

sleep and usleep wrappers to make them easier to test

README 文档

README

Packagist Tests Downloads

This package allows you to easily test the sleep() and usleep() functions without having to "wait".

Installation

You can install the package via composer:

composer require driade/sleepery

Usage

Instead of using sleep() in your code you should use

Driade\Sleepery::dream(1);

and, instead of using usleep() in your code you should use

Driade\Sleepery::nap(1000);

When it comes to test your code, you can use the "fake" function to make the calls to dream() and nap() recorded, so you can later test them.

In your tests

use Driade\Sleepery;

Sleepery::fake();

(new PerformAction)->handle(); // execute your code

Sleepery::wakeup();

//

Sleepery::assertDreamt(1);
Sleepery::assertNapped(1000);

You may also use the following functions

Sleepery::assertNeverDreamt(); // no call to sleep() was made
Sleepery::assertNeverNapped(); // no call to usleep() was made
Sleepery::getDreams(); // returns all the dream() calls while dreaming
Sleepery::getNaps(); // returns all the nap() calls while dreaming
Sleepery::wakeup(); // stop dreaming

Testing

composer test

Contributing

Please feel free to open an issue or pull request if you think something can be improved

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固