PHPackages                             cspray/labrador-async-unit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. cspray/labrador-async-unit

ActiveLibrary[Testing &amp; Quality](/categories/testing)

cspray/labrador-async-unit
==========================

An async unit and integration testing framework written on top of PHP8

0.5.0(4y ago)1471[10 issues](https://github.com/labrador-kennel/async-unit/issues)[2 PRs](https://github.com/labrador-kennel/async-unit/pulls)PHPPHP ^8.0CI failing

Since Apr 19Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/labrador-kennel/async-unit)[ Packagist](https://packagist.org/packages/cspray/labrador-async-unit)[ RSS](/packages/cspray-labrador-async-unit/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (7)Dependencies (12)Versions (11)Used By (0)

AsyncUnit
=========

[](#asyncunit)

[![Unit Tests](https://github.com/labrador-kennel/async-testing/actions/workflows/php.yml/badge.svg)](https://github.com/labrador-kennel/async-testing/actions/workflows/php.yml)

A testing framework, with a focus on integration testing, that treats Amp's Loop as a first-class citizen!

- Extend `Cspray\Labrador\AsyncUnit\TestCase` and annotate your tests with `#[Test]` to get started
- Setup and teardown your tests using a variety of hooks by annotating methods with attributes like `#[BeforeEach]` and `#[AfterEach]`
- Embrace a test suite as a first-class citizen with `Cspray\Labrador\AsyncUnit\TestSuite` and bring a layer of extra functionality to integration tests
- Assertion API with first-class async support and a clear
- Disable tests, `TestCase`, or a `TestSuite` with the `#[Disabled]` Attribute
- Utilize `#[DataProvider]` to reduce test duplication
- Expect exceptions with, or without, specific messages to be thrown by your tests
- Includes a bundled CLI application for running your tests

AsyncUnit is under active development! The project has a [defined Roadmap](https://docs.labrador-kennel.io/asyncunit/roadmap) and is currently implementing features for version **0.5.0**.

Installation
------------

[](#installation)

```
composer require --dev cspray/labrador-async-unit

```

Hello, AsyncUnit
----------------

[](#hello-asyncunit)

Although AsyncUnit can satisfy the needs of most unit and integration tests it was really designed for a specific type of test which can be challenging to run properly even in synchronous contexts. The "canonical" AsyncUnit test example is below and demonstrates the core functionality of the framework.

```
