PHPackages                             bafs/testify - 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. bafs/testify

ActiveLibrary[Framework](/categories/framework)

bafs/testify
============

Testify makes writing unit tests fun again. It has an elegant syntax and keeps things simple

v1.0(10y ago)566.7k36GPL-3.0PHPPHP &gt;=5.3.0

Since Mar 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/BafS/Testify.php)[ Packagist](https://packagist.org/packages/bafs/testify)[ RSS](/packages/bafs-testify/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (6)

Testify - a micro unit testing framework
========================================

[](#testify---a-micro-unit-testing-framework)

Testify is a micro unit testing framework for PHP 5.3+. It strives for elegance instead of feature bloat. Testing your code is no longer a chore - it's fun again.

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

[](#requirements)

- PHP 5.3+ is required
- [Composer](http://getcomposer.org/) to install Testify is recommended (but you can do this manually)

Usage
-----

[](#usage)

Here is an example for a test suite with two test cases:

```
require 'vendor/autoload.php';

use Math\MyCalc;
use Testify\Testify;

$tf = new Testify("MyCalc Test Suite");

$tf->beforeEach(function($tf) {
	$tf->data->calc = new MyCalc(10);
});

$tf->test("Testing the add() method", function($tf) {
	$calc = $tf->data->calc;

	$calc->add(4);
	$tf->assert($calc->result() == 14);

	$calc->add(-6);
	$tf->assertEquals($calc->result(), 8);
});

$tf->test("Testing the mul() method", function($tf) {
	$calc = $tf->data->calc;

	$calc->mul(1.5);
	$tf->assertEquals($calc->result(), 12);

	$calc->mul(-1);
	$tf->assertEquals($calc->result(), -12);
});

$tf();
```

Documentation
=============

[](#documentation)

- `__construct( string $title )` - The constructor
- `test( string $name, [Closure $testCase = null] )` - Add a test case.
- `before( Closure $callback )` - Executed once before the test cases are run
- `after( Closure $callback )` - Executed once after the test cases are run
- `beforeEach( Closure $callback )` - Executed for every test case, before it is run
- `afterEach( Closure $callback )` - Executed for every test case, after it is run
- `run( )` - Run all the tests and before / after functions. Calls report() to generate the HTML report page
- `assert( boolean $arg, [string $message = ''] )` - Alias for assertTrue() method
- `assertTrue( boolean $arg, [string $message = ''] )` - Passes if given a truthfull expression
- `assertFalse( boolean $arg, [string $message = ''] )` - Passes if given a falsy expression
- `assertEquals( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 == $arg2
- `assertNotEquals( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 != $arg2
- `assertSame( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 === $arg2
- `assertNotSame( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 !== $arg2
- `assertInArray( mixed $arg, array $arr, string [string $message = ''] )` - Passes if $arg is an element of $arr
- `assertNotInArray( mixed $arg, array $arr, string [string $message = ''] )` - Passes if $arg is not an element of $arr
- `pass( string [string $message = ''] )` - Unconditional pass
- `fail( string [string $message = ''] )` - Unconditional fail
- `report( )` - Generates a pretty CLI or HTML5 report of the test suite status. Called implicitly by run()
- `__invoke( )` - Alias for run() method

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

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

3764d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/837170204c2dc6beffb28cfca8ff9036709ac38d5f5f16ab2b8b8a7cb025c089?d=identicon)[BafS](/maintainers/BafS)

---

Top Contributors

[![BafS](https://avatars.githubusercontent.com/u/588205?v=4)](https://github.com/BafS "BafS (20 commits)")[![martinaglv](https://avatars.githubusercontent.com/u/883717?v=4)](https://github.com/martinaglv "martinaglv (5 commits)")[![marcofiset](https://avatars.githubusercontent.com/u/1094085?v=4)](https://github.com/marcofiset "marcofiset (3 commits)")[![SenseException](https://avatars.githubusercontent.com/u/859964?v=4)](https://github.com/SenseException "SenseException (1 commits)")

---

Tags

testingunit-testingtestingunitframework

### Embed Badge

![Health badge](/badges/bafs-testify/health.svg)

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

###  Alternatives

[pestphp/pest-plugin

The Pest plugin manager

4770.7M143](/packages/pestphp-pest-plugin)[pestphp/pest-plugin-livewire

The Pest Livewire Plugin

666.7M816](/packages/pestphp-pest-plugin-livewire)[pestphp/pest-plugin-drift

The Pest Drift Plugin

745.1M107](/packages/pestphp-pest-plugin-drift)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

99600.5k8](/packages/defstudio-pest-plugin-laravel-expectations)[pestphp/pest-plugin-type-coverage

The Type Coverage plugin for Pest PHP.

354.3M1.1k](/packages/pestphp-pest-plugin-type-coverage)[pestphp/pest-plugin-stressless

Stressless plugin for Pest

681.0M18](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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