PHPackages                             hoa/test - 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. hoa/test

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

hoa/test
========

The Hoa\\Test library.

2.17.08.18(8y ago)118.3k↑83.3%10[4 issues](https://github.com/hoaproject/Test/issues)[2 PRs](https://github.com/hoaproject/Test/pulls)20BSD-3-ClausePHP

Since Sep 16Pushed 8y ago7 watchersCompare

[ Source](https://github.com/hoaproject/Test)[ Packagist](https://packagist.org/packages/hoa/test)[ Docs](https://hoa-project.net/)[ RSS](/packages/hoa-test/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (33)Used By (20)

 [![Hoa](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)

---

 [![Build status](https://camo.githubusercontent.com/5a6849719a9fcf26649dd69670af3891b860fedfe34c739013c6780ff2d8f92c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f686f6170726f6a6563742f746573742f6d61737465722e737667)](https://travis-ci.org/hoaproject/test) [![Code coverage](https://camo.githubusercontent.com/38049ea8203ca8e5d12f8e87e3b065586a452194d04228c3cd806f79ac4895ef/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f686f6170726f6a6563742f746573742f6d61737465722e737667)](https://coveralls.io/github/hoaproject/test?branch=master) [![Packagist](https://camo.githubusercontent.com/724c43e72932cbe8d2f7eb57250c79d1defc459ae9919b8241928ee372408b45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686f612f746573742e737667)](https://packagist.org/packages/hoa/test) [![License](https://camo.githubusercontent.com/b2075812e5461570ac35203f2eadfa69a529a5eb74a5afebbbfe540fa76e0db9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f612f746573742e737667)](https://hoa-project.net/LICENSE)

 Hoa is a **modular**, **extensible** and **structured** set of PHP libraries.
 Moreover, Hoa aims at being a bridge between industrial and research worlds.

Hoa\\Test
=========

[](#hoatest)

[![Help on IRC](https://camo.githubusercontent.com/4dbc9c9d28c30cf1ab591f4bb8212fe4dbddc734145df532a9bb86b09878d4c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d253233686f6170726f6a6563742d6666303036362e737667)](https://webchat.freenode.net/?channels=#hoaproject)[![Help on Gitter](https://camo.githubusercontent.com/8c4c85951788ff606b1268cb3dd946be05e3054795455d0a7b9250711bc2ac05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d6769747465722d6666303036362e737667)](https://gitter.im/hoaproject/central)[![Documentation](https://camo.githubusercontent.com/7059ad5f1a363f9098686c59d432f01d7330aed9d4b6c8111d985fd64cfc6c60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d6861636b5f626f6f6b2d6666303036362e737667)](https://central.hoa-project.net/Documentation/Library/Test)[![Board](https://camo.githubusercontent.com/fd81654ba14b3aca3a713e1b471bc3fc3ba7b5bb3761ccffd6eea2e2ed1fa5ca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f7267616e69736174696f6e2d626f6172642d6666303036362e737667)](https://waffle.io/hoaproject/test)

This library provides tools to create and run tests for Hoa libraries.

In each library, a `Test/` directory contains test suites. They are written with [atoum](http://atoum.org/).

[Learn more](https://central.hoa-project.net/Documentation/Library/Test).

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

[](#installation)

With [Composer](https://getcomposer.org/), to include this library into your dependencies, you need to require [`hoa/test`](https://packagist.org/packages/hoa/test):

```
$ composer require hoa/test '~2.0'
```

For more installation procedures, please read [the Source page](https://hoa-project.net/Source.html).

Testing
-------

[](#testing)

Before running the test suites, the development dependencies must be installed:

```
$ composer install
```

Then, to run all the test suites:

```
$ vendor/bin/hoa test:run
```

For more information, please read the [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html).

Quick usage
-----------

[](#quick-usage)

As a quick overview, we see how to execute, write and generate unit tests. Let `Hoa\Foo` be a library.

### Execute tests

[](#execute-tests)

To execute some tests, we will use the `hoa test:run` command. We have several options to select a set of tests:

- `-f`/`--files` to select files,
- `-d`/`--directories` to select directories,
- `-n`/`--namespaces` to select classes in some namespaces,
- `-l`/`--libraries` to select all tests of some libraries,
- `-a`/`--all` to select all tests of all libraries.

Most of the time, we will run all tests of a library, and then all the tests of all libraries. Thus:

```
$ hoa test:run --libraries Foo
# do something
$ hoa test:run --all
```

### Manual unit tests

[](#manual-unit-tests)

First, let's create the `Hoa/Foo/Test/Unit/Bar.php` file, that contains:

```
namespace Hoa\Foo\Test\Unit;

class Bar extends \Hoa\Test\Unit\Suite
{
    public function caseBaz()
    {
        $this->integer(7 * 3 * 2)->isEqualTo(42);
    }
}
```

A class represents a test suite (that extends the `Hoa\Test\Unit\Suite` class). A method represents a test case, where its name must be prefixed by `case`.

The `Hoa\Test` library enables the [Praspel extension for atoum](http://central.hoa-project.net/Resource/Contributions/Atoum/PraspelExtension). Consequently, we have the `realdom`, `sample`, `sampleMany` etc. asserters to automatically generate data.

### Automatically generate unit tests

[](#automatically-generate-unit-tests)

Thanks to [Praspel](http://central.hoa-project.net/Resource/Library/Praspel), we are able to automatically generate test suites. Those test suites are compiled into executable test suites written with atoum's API with the help of the [Praspel extension for atoum](http://central.hoa-project.net/Resource/Contributions/Atoum/PraspelExtension).

Let `Hoa\Foo\Baz` be the following class:

```
namespace Hoa\Foo;

class Baz
{
    /**
     * @requires x: /foo.+ba[rz]/;
     * @ensures  \result: true;
     */
    public function qux()
    {
        // …
    }
}
```

Then, to automatically generate a test suite, we will use the `hoa test:generate` command. It has the following options:

- `-c`/`--classes` to generate tests of some classes,
- `-n`/`--namespaces` to generate tests of all classes in some namespaces,
- `-d`/`--dry-run` to generate tests but output them instead of save them.

The dry-run mode is very helpful. We encourage you to often generate tests with this option to see what happens. This option is also helpful when having some errors.

Thus, to automatically generate tests of the `Hoa\Foo\Baz` class, we will make:

```
$ hoa test:generate --classes Hoa.Foo.Baz
```

`Hoa.Foo.Baz` is equivalent to `Hoa\\Foo\\Baz`, it avoids to escape backslashes. Then to execute this test suite, nothing new:

```
$ hoa test:run --libraries Foo
```

or

```
$ hoa test:run --directories Test/Praspel/
```

to only run the test suite generated by the Praspel tools.

Environment variables
---------------------

[](#environment-variables)

- `HOA_ATOUM_BIN`: This variable represents the path to the atoum binary.

Documentation
-------------

[](#documentation)

The [hack book of `Hoa\Test`](https://central.hoa-project.net/Documentation/Library/Test) contains detailed information about how to use this library and how it works.

To generate the documentation locally, execute the following commands:

```
$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open
```

More documentation can be found on the project's website: [hoa-project.net](https://hoa-project.net/).

Getting help
------------

[](#getting-help)

There are mainly two ways to get help:

- On the [`#hoaproject`](https://webchat.freenode.net/?channels=#hoaproject)IRC channel,
- On the forum at [users.hoa-project.net](https://users.hoa-project.net).

Contribution
------------

[](#contribution)

Do you want to contribute? Thanks! A detailed [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html) explains everything you need to know.

License
-------

[](#license)

Hoa is under the New BSD License (BSD-3-Clause). Please, see [`LICENSE`](https://hoa-project.net/LICENSE) for details.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community35

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 92.7% 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

Every ~34 days

Recently: every ~43 days

Total

32

Last Release

3195d ago

Major Versions

0.14.11.09 → 1.14.11.242014-11-24

1.15.10.29 → 2.16.01.112016-01-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/a410060743cec0e0d8654661b726a7a25f5888f18059d4c942a8fd9a8128f0da?d=identicon)[Hoa](/maintainers/Hoa)

---

Top Contributors

[![Hywan](https://avatars.githubusercontent.com/u/946104?v=4)](https://github.com/Hywan "Hywan (177 commits)")[![jubianchi](https://avatars.githubusercontent.com/u/327237?v=4)](https://github.com/jubianchi "jubianchi (4 commits)")[![vonglasow](https://avatars.githubusercontent.com/u/1275202?v=4)](https://github.com/vonglasow "vonglasow (2 commits)")[![osaris](https://avatars.githubusercontent.com/u/125797?v=4)](https://github.com/osaris "osaris (2 commits)")[![Metalaka](https://avatars.githubusercontent.com/u/5406767?v=4)](https://github.com/Metalaka "Metalaka (1 commits)")[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (1 commits)")[![shulard](https://avatars.githubusercontent.com/u/482993?v=4)](https://github.com/shulard "shulard (1 commits)")[![smoench](https://avatars.githubusercontent.com/u/183530?v=4)](https://github.com/smoench "smoench (1 commits)")[![stephpy](https://avatars.githubusercontent.com/u/232744?v=4)](https://github.com/stephpy "stephpy (1 commits)")[![Grummfy](https://avatars.githubusercontent.com/u/668804?v=4)](https://github.com/Grummfy "Grummfy (1 commits)")

---

Tags

atoumhoalibraryphptestingtestlibraryatoumpraspel

### Embed Badge

![Health badge](/badges/hoa-test/health.svg)

```
[![Health](https://phpackages.com/badges/hoa-test/health.svg)](https://phpackages.com/packages/hoa-test)
```

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[atoum/atoum

Simple modern and intuitive unit testing framework for PHP 8.0+

1.4k2.6M311](/packages/atoum-atoum)[atoum/atoum-bundle

Bundle around atoum unit testing framework

44360.9k10](/packages/atoum-atoum-bundle)[quizlet/hammock

Hammock is a stand-alone mocking library for Hacklang.

27445.5k](/packages/quizlet-hammock)[atoum/stubs

Stubs for atoum, the simple modern and intuitive unit testing framework for PHP 5.3+

17785.0k53](/packages/atoum-stubs)

PHPackages © 2026

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