PHPackages                             jbzoo/phpunit - 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. jbzoo/phpunit

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

jbzoo/phpunit
=============

PHPUnit toolbox with short assert aliases and useful functions around testing

7.2.0(7mo ago)51.1M↓40%20MITPHPPHP ^8.2CI passing

Since Oct 14Pushed 7mo ago3 watchersCompare

[ Source](https://github.com/JBZoo/PHPUnit)[ Packagist](https://packagist.org/packages/jbzoo/phpunit)[ RSS](/packages/jbzoo-phpunit/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (98)Used By (20)

JBZoo / PHPUnit
===============

[](#jbzoo--phpunit)

[![CI](https://github.com/JBZoo/PHPUnit/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/PHPUnit/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://camo.githubusercontent.com/8e218d2264f692fc64368bf4e0de527eb1781130338c023a7e36cd29be7e274a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4a425a6f6f2f504850556e69742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/JBZoo/PHPUnit?branch=master) [![Psalm Coverage](https://camo.githubusercontent.com/97138a8f8d51a3dd949a28c6a74767e598ce157b75013f04658d804ee57ae0ac/68747470733a2f2f73686570686572642e6465762f6769746875622f4a425a6f6f2f504850556e69742f636f7665726167652e737667)](https://shepherd.dev/github/JBZoo/PHPUnit) [![Psalm Level](https://camo.githubusercontent.com/0488e9aa371f097529dd191b07a3e7157004176e5c9df212ac0800a68fc6dd9e/68747470733a2f2f73686570686572642e6465762f6769746875622f4a425a6f6f2f504850556e69742f6c6576656c2e737667)](https://shepherd.dev/github/JBZoo/PHPUnit) [![CodeFactor](https://camo.githubusercontent.com/7b2487964831b854501adf93cd76cdfbf63d761f831c6effb348303e5e69bd78/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6a627a6f6f2f706870756e69742f6261646765)](https://www.codefactor.io/repository/github/jbzoo/phpunit/issues)[![Stable Version](https://camo.githubusercontent.com/c07417bd27566520645eae9b3b0fefbef0fef096a1e6e4a0e1ab501336b1e908/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f706870756e69742f76657273696f6e)](https://packagist.org/packages/jbzoo/phpunit/) [![Total Downloads](https://camo.githubusercontent.com/4fc2f4efde2c0ea3a4e8f802bd9f610fbcf0481651cd978fab547f4d54ec7b98/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f706870756e69742f646f776e6c6f616473)](https://packagist.org/packages/jbzoo/phpunit/stats) [![Dependents](https://camo.githubusercontent.com/088695b4fb94c1adcb99bd48a20e8d45f3ce3d7c4099b5e1849cbadd18602a65/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f706870756e69742f646570656e64656e7473)](https://packagist.org/packages/jbzoo/phpunit/dependents?order_by=downloads) [![GitHub License](https://camo.githubusercontent.com/5fe240c66b0febe6bf1aac2b5304828524e6c514f08219c8eebae4c61cb44d42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a627a6f6f2f706870756e6974)](https://github.com/JBZoo/PHPUnit/blob/master/LICENSE)

PHPUnit toolbox with short assertion aliases and useful testing utilities. This library provides a more concise and readable way to write tests by offering shorter function names for common PHPUnit assertions.

Features
--------

[](#features)

- **Short assertion aliases** - Use `isTrue()` instead of `$this->assertTrue()`
- **Extended assertions** - Additional assertions for emails, dates, amounts, file contents
- **Environment detection** - Detect if running under TeamCity, Travis, PhpStorm
- **Built-in utilities** - Tools for test organization and debugging
- **PHP 8.2+ support** - Modern PHP features and strict typing

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

[](#installation)

```
composer require jbzoo/phpunit --dev
```

Quick Start
-----------

[](#quick-start)

```
namespace JBZoo\PHPUnit;

/**
 * Class PackageTest
 * @package JBZoo\PHPUnit
 */
class PackageTest extends PHPUnit
{
    public function testSimple()
    {
        // Boolean
        isTrue(true);
        isFalse(false);

        // null
        isNull(null);

        // Check is variable empty
        isEmpty(0);
        isEmpty('');
        isEmpty(null);
        isEmpty('0');
        isEmpty(.0);
        isEmpty(array());

        // Equals
        is(1, true);
        is(array(1, 2, 3), array(1, 2, 3));
        isSame(array(1, 2, 3), array(1, 2, 3));

        // Array, Object etc
        isKey('test', array('test' => true));
        isNotKey('undef-kest', array('test' => true));

        isAttr('test', (object)array('test' => true));
        isNotAttr('undef-test', (object)array('test' => true));

        // Instance Of ...
        isClass(JBZoo\PHPUnit\PHPUnit::class, $this);

        // Count props
        isCount(0, array());
        isCount(1, array(1));
        isCount(2, array(1, 3));

        // regExp
        isLike('#t.st#i', 'TESTO');
        isNotLike('#teeest#i', 'TESTO');

        // Strings
        isContain('t', 'test');
        isNotContain('x', 'test');

        // Filesystem
        isFileEq(__FILE__, __FILE__);
        isFile(__FILE__);
        isDir(__DIR__);
    }

    public function testSkip()
    {
        skip('Some reason to skip this test');
    }

    public function testFail()
    {
        fail('Some reason to fail this test');
    }
}
```

Available Assertions
--------------------

[](#available-assertions)

### Basic Assertions

[](#basic-assertions)

- `is($expected, $actual)` - assertEquals
- `isNot($expected, $actual)` - assertNotEquals
- `isSame($expected, $actual)` - assertSame
- `isNotSame($expected, $actual)` - assertNotSame
- `isTrue($value)` - assertTrue
- `isFalse($value)` - assertFalse
- `isNull($value)` - assertNull
- `isNotNull($value)` - assertNotNull
- `isEmpty($value)` - assertEmpty
- `isNotEmpty($value)` - assertNotEmpty

### Arrays &amp; Objects

[](#arrays--objects)

- `isKey($key, $array)` - assertArrayHasKey
- `isNotKey($key, $array)` - assertArrayNotHasKey
- `isAttr($name, $object)` - Check object attribute exists
- `isNotAttr($name, $object)` - Check object attribute doesn't exist
- `isClass($expected, $actual)` - assertInstanceOf
- `isCount($expected, $countable)` - assertCount

### Strings &amp; RegExp

[](#strings--regexp)

- `isLike($pattern, $value)` - assertMatchesRegularExpression
- `isNotLike($pattern, $value)` - assertDoesNotMatchRegularExpression
- `isContain($needle, $haystack)` - String contains check
- `isNotContain($needle, $haystack)` - String doesn't contain check

### Files &amp; Filesystem

[](#files--filesystem)

- `isFile($path)` - assertFileExists
- `isNotFile($path)` - File doesn't exist
- `isDir($path)` - Directory exists
- `isNotDir($path)` - Directory doesn't exist
- `isFileEq($expected, $actual)` - assertFileEquals
- `isFileContains($expected, $filepath)` - File contains string
- `isFileNotContains($expected, $filepath)` - File doesn't contain string

### Extended Assertions

[](#extended-assertions)

- `isEmail($email)` - Valid email check
- `isNotEmail($email)` - Invalid email check
- `isCurrentDate($date, $timeDiff)` - Date is close to current time
- `isSameDate($expected, $actual, $format)` - Date comparison
- `isAmount($expected, $actual, $allowableDiff)` - Amount comparison with tolerance
- `isDiffBetweenDates($date1, $date2, $expectedDiff)` - Time difference check

### Test Control

[](#test-control)

- `skip($message)` - markTestSkipped
- `fail($message)` - fail test
- `incomplete($message)` - markTestIncomplete
- `success($message)` - Mark test as successful

### Environment Detection

[](#environment-detection)

- `isWin()` - Running on Windows
- `isTeamCity()` - Running under TeamCity
- `isTravis()` - Running under Travis CI
- `isPhpStorm()` - Running in PhpStorm

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

[](#requirements)

- PHP 8.2 or higher
- PHPUnit ^9.6.29
- ext-filter, ext-mbstring

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License
-------

[](#license)

MIT

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance62

Regular maintenance activity

Popularity39

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 98.4% 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 ~38 days

Recently: every ~152 days

Total

96

Last Release

233d ago

Major Versions

1.11.0 → 2.02017-03-30

2.2.2 → 3.0.02019-11-24

3.2.0 → 4.0.02020-07-14

4.13.1 → 5.0.02022-06-05

5.0.0 → 7.0.02023-07-09

PHP version history (10 changes)1.0.0PHP &gt;=5.3.10

1.0.3PHP &gt;=5.3

2.0PHP &gt;=5.5

2.2.0PHP &gt;=7.0

2.3.0PHP &gt;=7.1

4.0.0PHP ^7.2

4.3.0PHP &gt;=7.2

5.0.0PHP &gt;=7.4

7.0.0PHP ^8.1

7.1.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/75e6de2785f6d099699f430ff58404af4fc0e83060d2953028c9664a54704a5f?d=identicon)[smetdenis](/maintainers/smetdenis)

---

Top Contributors

[![SmetDenis](https://avatars.githubusercontent.com/u/1118678?v=4)](https://github.com/SmetDenis "SmetDenis (314 commits)")[![Cheren](https://avatars.githubusercontent.com/u/4447959?v=4)](https://github.com/Cheren "Cheren (5 commits)")

---

Tags

jbzoophpunittesttest-frameworktestingtoolboxtestingphpunitdebugassertassertionaliasesjbzooshort-syntax

### Embed Badge

![Health badge](/badges/jbzoo-phpunit/health.svg)

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

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69617.9M510](/packages/spatie-phpunit-snapshot-assertions)[yoast/phpunit-polyfills

Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests

18438.5M841](/packages/yoast-phpunit-polyfills)[fr3d/swagger-assertions

Test your API requests and responses against your swagger definition

138850.9k5](/packages/fr3d-swagger-assertions)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10745.9M13](/packages/ta-tikoma-phpunit-architecture-test)[matthiasnoback/symfony-config-test

Library for testing user classes related to the Symfony Config Component

1679.8M395](/packages/matthiasnoback-symfony-config-test)

PHPackages © 2026

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