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

AbandonedArchivedLibrary

boukeversteegh/phpunit-bliss
============================

Collection of assertions for PhpUnit

07191PHP

Since Nov 25Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

PHPUnit Bliss
=============

[](#phpunit-bliss)

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

[](#installation)

```
composer require boukeversteegh/phpunit-bliss dev-master

```

Usage
-----

[](#usage)

Add `use \PhpUnitBliss\Assertions;` to your test class

assertArrayMatches
------------------

[](#assertarraymatches)

See `tests/AssertionsTest.php` for many examples.

Add a useful assertion to your TestCase: `assertArrayMatches`, which allows you to test that a given array matches a certain subset. You can match by value, or by other assertions.

```
class AssertionsTest extends \PHPUnit_Framework_TestCase
{
    use \PhpUnitBliss\Assertions;

    public function testSimpleExample()
    {
        $array = [
            'id' => 1,
            'name' => 'John',
            'preferences' => [
                'vegetables' => true,
                'beer' => false,
            ],
        ];

        $pattern = [
            'name' => 'John',
            'preferences' => [
                'vegetables' => true,
            ],
        ];

        $this->assertArrayMatches($array, $pattern);

        $notPattern = [
            'name' => 'John',
            'preferences' => [
                'beer' => true,
            ],
        ];

        $this->assertArrayNotMatches($array, $notPattern);
    }

    /**
     * You can use constraints to match values inside arrays
     */
    public function testComplexExample()
    {
        $array = [
            'id' => 1,
            'age' => 25,
            'friends' => [
                [
                    'name' => 'Sally',
                ]
            ],
            'other' => 'some field that is ignored',
            'tree' => [
                'subtree' => ['foo', 'bar', 'baz']
            ],
        ];

        $pattern = [
            'id' => self::anything(),
            'age' => self::greaterThan(18),
            'friends' => self::contains(['name' => 'Sally']),
            'tree' => [
                'subtree' => self::logicalAnd(
                    self::countOf(3),
                    self::arrayMatches([1 => 'bar'])
                )
            ],
        ];

        $this->assertArrayMatches($array, $pattern);
    }
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

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

---

Top Contributors

[![boukeversteegh](https://avatars.githubusercontent.com/u/53926?v=4)](https://github.com/boukeversteegh "boukeversteegh (6 commits)")

### Embed Badge

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

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

PHPackages © 2026

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