https://github.com/candasm/hypno
Delay execution package for PHP
https://github.com/candasm/hypno
delay-execution hypno php sleep usleep
Last synced: over 1 year ago
JSON representation
Delay execution package for PHP
- Host: GitHub
- URL: https://github.com/candasm/hypno
- Owner: candasm
- License: mit
- Created: 2020-11-09T21:13:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-16T14:38:02.000Z (over 5 years ago)
- Last Synced: 2025-02-08T14:12:27.640Z (over 1 year ago)
- Topics: delay-execution, hypno, php, sleep, usleep
- Language: PHP
- Homepage:
- Size: 1.03 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Hypno (Delay execution package for PHP)
Hypno is a wrapper of PHP delay execution commands package.
This package created to write less complex unit test when delaying methods used in the application logic.


[](https://coveralls.io/github/candasm/hypno?branch=master)

## Installation
```bash
$ composer require candasm/hypno
```
## Basic Usage
Package covers sleep, usleep, time_nanosleep and time_sleep_until functions. Camelcased methods can be seen on [Hypnotize](./src/Hypnotize.php) interface.
```php
sleep(5);
```
## Unit Testing
When you use your DI just inject [Hypnotize](src/Hypnotize.php) interface then you can do this easily with [Mockery](https://github.com/mockery/mockery) or any other mock library.
```php
shouldReceive('sleep')->with(1)->returnNull();
});
```
## Documentation
You can check [Hypnosis](src/Hypnosis.php) class to see how methods are working.
### Requirements
PHP 5.6+