PHPackages                             sinevia/php-library-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. sinevia/php-library-testify

ActiveLibrary[Framework](/categories/framework)

sinevia/php-library-testify
===========================

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

v1.6.0(6y ago)11311GPL-3.0-or-laterPHPPHP &gt;=5.3.0

Since Jun 22Pushed 6y agoCompare

[ Source](https://github.com/Sinevia/php-library-testify)[ Packagist](https://packagist.org/packages/sinevia/php-library-testify)[ RSS](/packages/sinevia-php-library-testify/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

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

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

Testify is a micro unit testing framework for PHP.

[![No Dependencies](https://camo.githubusercontent.com/e5650883bec05bec967678c8203c32b160b75c93b5b745c80bd9e6f25eb4a3db/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f2d646570656e64656e636965732d737563636573732e737667)](https://camo.githubusercontent.com/e5650883bec05bec967678c8203c32b160b75c93b5b745c80bd9e6f25eb4a3db/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f2d646570656e64656e636965732d737563636573732e737667)[![Build status](https://camo.githubusercontent.com/ab872cec837ed5fea3a55a4f8edf00afb9fb0f78a4e63ae453978e53a58c6f5e/68747470733a2f2f6170692e7472617669732d63692e636f6d2f53696e657669612f7068702d7365727665726c6573732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/Sinevia/php-library-testify)[![GitHub stars](https://camo.githubusercontent.com/b67be8201d1a8e5236dd6ada3b48188a3e7e8782007cf8fc772b1c3a4d480fcd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f53696e657669612f7068702d6c6962726172792d746573746966792e7376673f7374796c653d736f6369616c266c6162656c3d53746172266d61784167653d32353932303030)](https://GitHub.com/Sinevia/php-library-testify/stargazers/)[![HitCount](https://camo.githubusercontent.com/174b83234460353a6dc7ba702c6ed8bc962492182649349fde67c176d0e50307/687474703a2f2f686974732e6477796c2e696f2f53696e657669612f6261646765732e737667)](http://hits.dwyl.io/Sinevia/badges)

Features
--------

[](#features)

- No external dependencies
- Testing your code is no longer a chore - it's fun again
- Strives for elegance instead of a feature bloat

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

[](#requirements)

- PHP 5.3+ is required

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

[](#installation)

- Via Composer. [Composer](http://getcomposer.org/) (recommended)

```
composer require sinevia/php-library-testify

```

- Manually. Download and add to your project

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
- `assertArray( mixed $arg, [string $message = ''] )` - Passes if $arg is an array
- `assertArrayHasKey( mixed $array, array $key, [string $message = ''] )` - Passes if $array has a $key
- `assertArray( mixed $arg, [string $message = ''] )` - Passes if $arg is an array
- `assertEquals( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 == $arg2
- `assertException( object $classInstance, string $methodName, [string $message = ''] )` - Passes if method throws Exception
- `assertFalse( boolean $arg, [string $message = ''] )` - Passes if given a falsy expression
- `assertInArray( mixed $arg, array $arr, string [string $message = ''] )` - Passes if $arg is an element of $arr
- `assertJson( string $arg, string [string $message = ''] )` - Passes if $arg is a JSON string
- `assertNotArray( mixed $arg, [string $message = ''] )` - Passes if $arg is not an array
- `assertNotEquals( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 != $arg2
- `assertNotArrayHasKey( mixed $array, array $key, [string $message = ''] )` - Passes if $array has not a $key
- `assertNotInArray( mixed $arg, array $arr, string [string $message = ''] )` - Passes if $arg is not an element of $arr
- `assertNotJson( string $arg, string [string $message = ''] )` - Passes if $arg is not a JSON string
- `assertNotNull( string $arg, string [string $message = ''] )` - Passes if $arg is not a NULL
- `assertNotSame( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 !== $arg2
- `assertNotStringContainsString( string $string, string $substring, [string $message = ''] )` - Passes if $string has no $substring
- `assertNotStringContainsStringIgnoringCase( string $string, string $substring, [string $message = ''] )` - Passes if $string has no $substring regardless of case
- `assertNull( string $arg, string [string $message = ''] )` - Passes if $arg is a NULL
- `assertRegExpr( string $arg1, string $arg2, [string $message = ''] )` - Passes if $arg1 is matched in $arg2
- `assertStringContainsString( string $string, string $substring, [string $message = ''] )` - Passes if $string has $substring
- `assertStringContainsStringIgnoringCase( string $string, string $substring, [string $message = ''] )` - Passes if $string has $substring regardless of case
- `assertSame( mixed $arg1, mixed $arg2, string [string $message = ''] )` - Passes if $arg1 === $arg2
- `assertTrue( boolean $arg, [string $message = ''] )` - Passes if given a truthfull expression
- `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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.6% 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 ~0 days

Total

7

Last Release

2516d ago

### Community

Maintainers

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

---

Top Contributors

[![Sinevia](https://avatars.githubusercontent.com/u/3450815?v=4)](https://github.com/Sinevia "Sinevia (58 commits)")[![BafS](https://avatars.githubusercontent.com/u/588205?v=4)](https://github.com/BafS "BafS (12 commits)")[![marcofiset](https://avatars.githubusercontent.com/u/1094085?v=4)](https://github.com/marcofiset "marcofiset (6 commits)")[![martinaglv](https://avatars.githubusercontent.com/u/883717?v=4)](https://github.com/martinaglv "martinaglv (5 commits)")

---

Tags

testingunitframework

### Embed Badge

![Health badge](/badges/sinevia-php-library-testify/health.svg)

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

###  Alternatives

[pestphp/pest-plugin

The Pest plugin manager

4458.2M109](/packages/pestphp-pest-plugin)[pestphp/pest-plugin-livewire

The Pest Livewire Plugin

635.6M544](/packages/pestphp-pest-plugin-livewire)[pestphp/pest-plugin-drift

The Pest Drift Plugin

734.0M74](/packages/pestphp-pest-plugin-drift)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

98548.9k4](/packages/defstudio-pest-plugin-laravel-expectations)[pestphp/pest-plugin-type-coverage

The Type Coverage plugin for Pest PHP.

343.3M732](/packages/pestphp-pest-plugin-type-coverage)[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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