An open API service indexing awesome lists of open source software.

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

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.

![Image of Hypno](./assets/hypno.gif)

![Travis (.org)](https://img.shields.io/travis/candasm/hypno)
[![Coverage Status](https://coveralls.io/repos/github/candasm/hypno/badge.svg?branch=master)](https://coveralls.io/github/candasm/hypno?branch=master)
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/candasm/hypno)

## 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+