PHPackages                             utopia-php/tests - 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. [Framework](/categories/framework)
4. /
5. utopia-php/tests

ActiveLibrary[Framework](/categories/framework)

utopia-php/tests
================

Lite &amp; fast micro PHP test framework that is \*\*easy to use\*\*.

0.1.0(5mo ago)158.0k↓15.4%MITPHPPHP &gt;=8.3

Since Nov 26Pushed 5mo agoCompare

[ Source](https://github.com/utopia-php/tests)[ Packagist](https://packagist.org/packages/utopia-php/tests)[ RSS](/packages/utopia-php-tests/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Utopia Tests
============

[](#utopia-tests)

A lightweight PHP testing library that provides useful testing utilities and extensions for PHPUnit.

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

[](#installation)

```
composer require utopia-php/tests
```

Requirements
------------

[](#requirements)

- PHP 8.3 or later
- PHPUnit 12.4 or later

Features
--------

[](#features)

### Async Extension

[](#async-extension)

The `Async` trait provides utilities for testing asynchronous or eventually consistent behavior.

#### `assertEventually()`

[](#asserteventually)

Repeatedly executes a callable until it succeeds or times out. This is useful for testing:

- Asynchronous operations
- Eventually consistent systems
- Polling-based workflows
- Background jobs

**Usage:**

```
use PHPUnit\Framework\TestCase;
use Utopia\Tests\Extensions\Async;

class MyTest extends TestCase
{
    use Async;

    public function testAsyncOperation(): void
    {
        $result = null;

        // Start some async operation
        $this->startAsyncJob(function ($data) use (&$result) {
            $result = $data;
        });

        // Wait until the result is set (max 10 seconds, check every 500ms)
        self::assertEventually(function () use (&$result) {
            $this->assertNotNull($result);
            $this->assertSame('expected', $result);
        }, timeoutMs: 10000, waitMs: 500);
    }
}
```

**Parameters:**

- `callable $probe` - The function to execute repeatedly. Should contain assertions.
- `int $timeoutMs` - Maximum time to wait in milliseconds (default: 10000)
- `int $waitMs` - Time to wait between attempts in milliseconds (default: 500)

**Critical Exceptions:**

If you need to immediately fail the test without retrying, throw a `Critical` exception:

```
use Utopia\Tests\Extensions\Async\Exceptions\Critical;

self::assertEventually(function () use ($connection) {
    if ($connection->isClosed()) {
        throw new Critical('Connection closed unexpectedly');
    }
    $this->assertTrue($connection->hasData());
});
```

Development
-----------

[](#development)

### Run Tests

[](#run-tests)

```
composer install --ignore-platform-reqs
composer test
```

### Code Formatting

[](#code-formatting)

```
composer format
```

### Static Analysis

[](#static-analysis)

```
composer check
```

### Linting

[](#linting)

```
composer lint
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance70

Regular maintenance activity

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

176d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/023f08a9df59f81cc4a04b1cebd20f45ede5db53ef2f9e9ad3d75f4c69be66b8?d=identicon)[eldadfux](/maintainers/eldadfux)

---

Top Contributors

[![ChiragAgg5k](https://avatars.githubusercontent.com/u/110609663?v=4)](https://github.com/ChiragAgg5k "ChiragAgg5k (3 commits)")[![lohanidamodar](https://avatars.githubusercontent.com/u/6360216?v=4)](https://github.com/lohanidamodar "lohanidamodar (1 commits)")[![loks0n](https://avatars.githubusercontent.com/u/22452787?v=4)](https://github.com/loks0n "loks0n (1 commits)")[![Meldiron](https://avatars.githubusercontent.com/u/19310830?v=4)](https://github.com/Meldiron "Meldiron (1 commits)")

---

Tags

phpframeworktestsupfutopia

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/utopia-php-tests/health.svg)

```
[![Health](https://phpackages.com/badges/utopia-php-tests/health.svg)](https://phpackages.com/packages/utopia-php-tests)
```

###  Alternatives

[utopia-php/database

A simple library to manage application persistence using multiple database adapters

74384.6k10](/packages/utopia-php-database)[utopia-php/domains

Utopia Domains library is simple and lite library for parsing web domains. This library is aiming to be as simple and easy to learn and use.

53660.1k16](/packages/utopia-php-domains)[utopia-php/cli

A simple CLI library to manage command line applications

42460.5k14](/packages/utopia-php-cli)[utopia-php/cache

A simple cache library to manage application cache storing, loading and purging

31447.6k15](/packages/utopia-php-cache)[utopia-php/storage

A simple Storage library to manage application storage

30277.2k9](/packages/utopia-php-storage)[utopia-php/system

A simple library for obtaining information about the host's system.

25290.5k25](/packages/utopia-php-system)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
