PHPackages                             solido/test-utils - 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. solido/test-utils

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

solido/test-utils
=================

Test utilities for solido suite

v0.4.1(2y ago)211.1k[1 issues](https://github.com/solid-o/test-utils/issues)2MITPHPPHP ^8.1CI failing

Since Feb 7Pushed 2w ago2 watchersCompare

[ Source](https://github.com/solid-o/test-utils)[ Packagist](https://packagist.org/packages/solido/test-utils)[ RSS](/packages/solido-test-utils/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (22)Versions (13)Used By (2)

Test utils
==========

[](#test-utils)

This package contains some testing utilities common to various solido suite packages.

Functional tests
----------------

[](#functional-tests)

#### JsonResponseTrait

[](#jsonresponsetrait)

Provides assertions to check content and deep properties of a returned json response. The response has to be provided by a static `getResponse` method and must be an instance of `Symfony\Component\HttpFoundation\Response`.

##### Property paths

[](#property-paths)

The assertions in this trait allow checking deep properties into the returned JSON passing a property path to the assertion method.

Dots (`.`) are used to access object properties, while brackets (`[]`) are used to access array indexes.

Example: `user.emails[1]` should return the second element of the `emails` property of the `user` object.

A special property path `.` can be used to indicate the entire json object or array contained in the response.

##### Assertions

[](#assertions)

`assertJsonResponse(string $message = '')`

Asserts that the response contains a JSON **and** has a `Content-Type` header containing `application/json`. If the response content cannot be decoded, the assertion will fail.

`assertJsonResponsePropertiesExist(array $expected, string $message = '')`

Asserts that the JSON response contains all the properties in the `$expected` array. The properties are specified as property paths.

`assertJsonResponsePropertyExists(string $propertyPath, string $message = '')`

Asserts that one property path exists in the response object.

`assertJsonResponsePropertyDoesNotExist(string $propertyPath, string $message = '')`

Asserts that one property path does not exist in the response object.

`assertJsonResponsePropertyEquals($expected, string $propertyPath, string $message = '')`

Asserts that the value in property path equals the `$expected` value. PHPUnit `IsEqual` constraint is used to check the values equality.

`assertJsonResponsePropertyNotEquals($expected, string $propertyPath, string $message = '')`

Asserts that the value in property path does not equal the `$expected` value.

`assertJsonResponsePropertyIsType(string $expected, string $propertyPath, string $message = '')`

Asserts that the value in property path is of the specified type. Type can be a FQCN or builtin type (array, bool, float, int, null, object, resource, string, scalar, callable). PHPUnit `IsType` constraint is used to check the property type.

`assertJsonResponsePropertyIsArray(string $propertyPath, string $message = '')`

Short-hand method for `assertJsonResponsePropertyIsType('array', $propertyPath, $message)`

`assertJsonResponsePropertyCount(int $expected, string $propertyPath, string $message = '')`

Asserts that the value in property path is countable and its count is equal to `$expected`.

`assertJsonResponsePropertyContains($expected, string $propertyPath, string $message = '')`

Asserts the specific response property contains the expected value.

Examples:

- `["Hello", "world", "!"]` contains "world"
- `[{one: "Hello"}]` contains `{ one: 'Hello' }`

`assertJsonResponsePropertyNotContains($unexpected, string $propertyPath, string $message = '')`

Asserts the specific response property does not contain the expected value.

`assertJsonResponsePropertyContainsString(string $expected, string $propertyPath, string $message = '')`

Asserts that the property is a string and contains the given value.

#### ResponseStatusTrait

[](#responsestatustrait)

Provides assertions to check the status code of a `Response` object retrieved by a static `getResponse` method.

`assertResponseIs(int $expectedCode, string $message = '')`

Asserts that the response code is exactly the one passed in `$expectedCode`.

Short-hand assertions:

- `assertResponseIsOk(string $message = '')` - Expects status code 200
- `assertResponseIsCreated(string $message = '')` - Expects status code 201
- `assertResponseIsAccepted(string $message = '')` - Expects status code 202
- `assertResponseIsNoContent(string $message = '')` - Expects status code 204
- `assertResponseIsBadRequest(string $message = '')` - Expects status code 400
- `assertResponseIsUnauthorized(string $message = '')` - Expects status code 401
- `assertResponseIsPaymentRequired(string $message = '')` - Expects status code 402
- `assertResponseIsForbidden(string $message = '')` - Expects status code 403
- `assertResponseIsNotFound(string $message = '')` - Expects status code 404
- `assertResponseIsMethodNotAllowed(string $message = '')` - Expects status code 405
- `assertResponseIsPreconditionFailed(string $message = '')` - Expects status code 412
- `assertResponseIsUnprocessableEntity(string $message = '')` - Expects status code 422

Assertions that checks multiple status codes:

- `assertResponseIsRedirect(string $message = '')` - Expects status code 3xx
- `assertResponseIsNotRedirect(string $message = '')` - Expects status code not to be 3xx
- `assertResponseIsSuccessful(string $message = '')` - Expects status code 2xx
- `assertResponseIsNotSuccessful(string $message = '')` - Expects status code not to be 2xx

#### FunctionalTestTrait

[](#functionaltesttrait)

Provides convenient methods to perform a request on a Symfony `WebTestCase`. Includes `ResponseStatusTrait` and `JsonResponseTrait`.

Doctrine ORM
------------

[](#doctrine-orm)

#### EntityManagerTrait

[](#entitymanagertrait)

Provides an instance of EntityManager upon a mocked DBAL connection.
Useful to test a raw SQL composition and result hydration.

**onEntityManagerCreated** method can be used to customize the entity manager instance (or load/inject metadata) just after entity manager creation.

#### MockPlatform

[](#mockplatform)

Dummy DBAL platform for EntityManagerTrait.

Doctrine Mongo ODM
------------------

[](#doctrine-mongo-odm)

#### DocumentManagerTrait

[](#documentmanagertrait)

Provides an instance of DocumentManager for mongo upon a mocked mongo Client.

Elastica ODM
------------

[](#elastica-odm)

#### DocumentManagerTrait

[](#documentmanagertrait-1)

Provides an instance of DocumentManager for elastica upon a mocked elastica Client.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance53

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

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.

###  Release Activity

Cadence

Every ~146 days

Recently: every ~219 days

Total

8

Last Release

894d ago

PHP version history (3 changes)v0.1.0PHP ^7.4|^8.0

v0.2.0PHP ^7.4 || ^8.0

v0.4.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/73dd7f3bebd03ec946b6b12359141ea461b770c3671acac4e8004e3c2d78e78f?d=identicon)[alekitto](/maintainers/alekitto)

![](https://www.gravatar.com/avatar/2ec273e505eac80af12ad5fb33f5111af2b9805f41cb50c598f6d36426331d8c?d=identicon)[massimilianobraglia](/maintainers/massimilianobraglia)

---

Top Contributors

[![alekitto](https://avatars.githubusercontent.com/u/1257206?v=4)](https://github.com/alekitto "alekitto (60 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/solido-test-utils/health.svg)

```
[![Health](https://phpackages.com/badges/solido-test-utils/health.svg)](https://phpackages.com/packages/solido-test-utils)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[pdepend/pdepend

Official version of pdepend to be handled with Composer

954110.9M815](/packages/pdepend-pdepend)[instaclick/php-webdriver

PHP WebDriver for Selenium 2

43761.8M22](/packages/instaclick-php-webdriver)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69417.9M510](/packages/spatie-phpunit-snapshot-assertions)[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3257.8M898](/packages/szepeviktor-phpstan-wordpress)

PHPackages © 2026

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