PHPackages                             synaq/mockery-extras - 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. synaq/mockery-extras

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

synaq/mockery-extras
====================

Extra matching tools for the Mockery framework.

1.0(6y ago)02.9kBSD Simplified LicensePHPCI failing

Since Jun 28Pushed 6y ago3 watchersCompare

[ Source](https://github.com/synaq/mockery-extras)[ Packagist](https://packagist.org/packages/synaq/mockery-extras)[ RSS](/packages/synaq-mockery-extras/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

mockery-extras
==============

[](#mockery-extras)

Extra matching tools for the Mockery framework.

ArrayPath
---------

[](#arraypath)

Matches an array if an element identified by the specified array path contains the expected value.

The syntax for array paths is as defined by `mathiasgrimm/arraypath`.

### Example

[](#example)

```
use Synaq\MockeryMatcher\ExtraMatchers;

$expectedValue = 'baz';
$arrayPath = 'foo/bar';

$dependency = Mockery::mock('DependencyOfObjectClassUnderTest');
$testSubject = new ObjectClassUnderTest($dependency);

$testSubject->performSomeAction();

$dependency->shouldHaveReceived('someMethodCallThatAcceptsAnArrayAsParameter')
    ->with(ExtraMatchers::arrayPath($expectedValue, $arrayPath))
    ->once;

```

The above invocation would match an array defined thus:

```
$array = [
    'foo' => [
        'bar' => 'baz'
    ]
];

```

These need not be the only elements in the array, nor does `bar` need to be the only child element of `foo`. This allows tests to be crafted with very discrete assertions regarding the structure of an array passed to a dependency of the object class under test.

JsonPath
--------

[](#jsonpath)

Matches a JSON string if a child node identified by the given `jsonpath`expression contains the expected value.

The syntax and behaviour are derived from the `skyscanner/jsonpath` library. The matcher uses the library's *SmartGet* behaviour by default, meaning that if a given path does not branch, the value will be returned directly, rather than a single element array containing the value, as is the usual `jsonpath` behaviour.

Please see documentation for the library package for more details on usage.

### Example

[](#example-1)

```
use Synaq\MockeryMatcher\ExtraMatchers;

$expectedValue = 'baz';
$jsonPath = '$.foo.bar';

$dependency = Mockery::mock('DependencyOfObjectClassUnderTest');
$testSubject = new ObjectClassUnderTest($dependency);

$testSubject->performSomeAction();

$dependency->shouldHaveReceived('someMethodCallThatAcceptsAJsonStringAsParameter')
    ->with(ExtraMatchers::jsonPath($expectedValue, $jsonPath))
    ->once;

```

The above invocation would match the following JSON string:

```
{
    "foo": {
        "bar": "baz"
    }
}

```

As with the ArrayPath matcher, the JSON string may encode any other arbitrary data. The string will always be matched as long as the given `jsonpath` expression leads to the expected value.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~679 days

Total

3

Last Release

2245d ago

Major Versions

0.2 → 1.02020-03-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/90eb43c3677e77dedb959c4c7548b1308ef2312a0448a168a6b4223dd351240a?d=identicon)[willemnviljoen](/maintainers/willemnviljoen)

![](https://www.gravatar.com/avatar/62f0a437ff440202031ecd1298cab18ef369d0090ea266498e7f1f66d7872fd4?d=identicon)[synaq](/maintainers/synaq)

---

Top Contributors

[![fah7eem](https://avatars.githubusercontent.com/u/16899806?v=4)](https://github.com/fah7eem "fah7eem (1 commits)")[![synaq](https://avatars.githubusercontent.com/u/2681984?v=4)](https://github.com/synaq "synaq (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/synaq-mockery-extras/health.svg)

```
[![Health](https://phpackages.com/badges/synaq-mockery-extras/health.svg)](https://phpackages.com/packages/synaq-mockery-extras)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[brain/monkey

Mocking utility for PHP functions and WordPress plugin API

33412.5M350](/packages/brain-monkey)[codeception/mockery-module

Mockery Module for Codeception

344.2M82](/packages/codeception-mockery-module)[lastzero/test-tools

Increases testing productivity by adding a service container and self-initializing fakes to PHPUnit

2244.3k13](/packages/lastzero-test-tools)

PHPackages © 2026

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