PackageTrack
Sign in Get early access

cloudcreativity/json-api-testing

PHPUnit test helpers to check JSON API documents.

v6.4.0 1.8M downloads/mo #4092 most downloaded on Packagist cloudcreativity/json-api-testing

What this package is like to depend on

Last release 4 months ago

02 Apr 2026

Ships fairly regularly

a new release about every 6 months

Nearly every release is documented

notes for 25 of 25 stable releases

Nothing withdrawn

no release was ever pulled

9 years old

26 releases · first in 2017

2 releases in the last 12 months

see the full history below

Release timeline

26 releases · Sep 2017 to Apr 2026
2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 26
  1. v6.4.0 02 Apr 2026
    Release notes

    Added

    • Package now supports PHPUnit 13.
    Open source →
  2. v6.3.0 28 Mar 2026
    Release notes

    Added

    • Package now supports Laravel 13.
    Open source →
  3. v6.2.0 09 Apr 2025
    Release notes

    Added

    • Package now supports PHPUnit 12.
    Open source →
  4. v6.1.0 24 Feb 2025
    Release notes

    Added

    • Package now requires illuminate/support 11 or 12.
    Open source →
  5. v6.0.1 30 Nov 2024
    Release notes

    Remove PHP 8.4 deprecation notices

    Open source →
    Release notes

    Fixed

    • Remove deprecation notices from PHP 8.4.
    Open source →
  6. v6.0.0 12 Mar 2024
    Release notes

    Changed

    • Package is now licensed under the MIT License.
    • BREAKING Package now requires illuminate/support 10 or 11, dropping support for 9.
    • BREAKING Package now requires PHPUnit 10 or 11, dropping support for 9.
    • Minimum PHP version is now 8.2.
    Open source →
  7. v5.0.0 18 Feb 2023
    Release notes

    PHPUnit 10 and drop old PHP, PHPUnit and Laravel versions.

    Open source →
    Release notes

    Changed

    • Package now supports PHPUnit 9 and 10 - this adds PHPUnit 10 and drops support for PHPUnit 8.
    • Minimum PHP version is now 8.1 - dropping support for PHP 7.4 and 8.0.
    • Drop support for Laravel 8.
    Open source →
  8. v4.1.0 14 Feb 2023
    Release notes

    Added

    • Package now supports Laravel 10 and PHP 8.2.
    Open source →
  9. v4.0.0 08 Feb 2022
    Release notes

    improvements. Refer to changelog for details.

    Open source →
    Release notes

    Added

    • Package now supports PHP 8.1.
    • Package now supports Laravel 9.
    • The package now correctly JSON encodes then decodes the expected values for assertions. This means an expected value can now contain JSON serializable objects, which improves the developer experience. For example, when using Carbon dates, the developer previously had to manually call $date->jsonSerialize() to put the expected JSON string value in their expected resource arrays. This also fixes a bug where the assertions failed to correctly compare floats that encoded to integers in JSON - e.g. 4.0 encodes as 4 but the assertion failed as it was attempting to compare a float to a decoded integer.

    Changed

    • Added return types to internal methods to remove deprecation messages in PHP 8.1.
    • Added property type hints to all classes and amended method type-hints where these needed updating.
    • The assertStatusCode method now expects the status code to be an integer. Previously it allowed strings.
    • The assertIncluded method type-hint for the expected value has changed from array to iterable.
    • Renamed the IdentifiersInDocument constraint IdentifiersInOrder. In addition, this now extends the SubsetsInOrder constraint, rather than the SubsetInDocument constraint.
    • The HasHttpAssertions trait now does not throw an exception for its getExpectedType() method if the expected string is empty. Instead an exception is thrown from the JsonObject method that casts an id value to a resource identifier if the expected type is empty. This is an improvement because it means an expected type only needs to be set if you are using a UrlRoutable, int or string value for an assertion. Previously an exception would be thrown stating that an expected type needed to be set even if the expected type did not need to be used, e.g. if using an array value that had the type key set.

    Removed

    • Removed the Assert::assertExactListInOrder assertion. Use Assert::assertExact instead.
    • Removed the HasDocumentAssertions::assertExactListInOrder assertion, which means it is also removed from the Document class. Use assertExact instead.
    • Removed the following methods from the Compare class and the HasHttpAssertions trait. The Utils\JsonObject and Utils\JsonStack classes should be used instead:
      • identifiers()
      • identifier()
      • identifiable()
    • Removed the following deprecated methods:
      • assertDeleted() - use assertNoContent() or assertMetaWithoutData() depending on your expected response.
      • assertUpdated() - use assertNoContent() or assertFetchedOne() depending on your expected response.
    • The HttpMessage class previously delegated methods calls to the Document class if the method did not exist on the message. This was not actually in use and unnecessarily increased the complexity of the messsage class. It has therefore been removed. Call methods directly on the document if needed.
    Open source →
  10. v3.5.0 22 Jan 2022
    Release notes

    Minor improvements, refer to changelog for details.

    Open source →
    Release notes

    Added

    • #18 The assertMetaWithoutData and assertExactMetaWithoutData assertions now assert a successful HTTP status code. Previously they were expecting 200 OK though this is too restrictive for a meta-only response. However, the assertions will continue to fail for 204 No Content responses because they are expecting the response to have content.
    • #14 The expected Location header passed to the assertCreatedWithClientId assertion can now include the expected resource id. Previously the expected header value had to be passed without the id.
    Open source →
  11. v3.4.0 16 Jan 2022
    Release notes

    Added

    • The assertCreatedWithServerId, assertCreatedWithClientId and assertCreatedNoContent methods will now fail with a better assertion message if the Location header is missing.
    • New assertDoesntHaveIncluded assertion to assert that the JSON:API document does not have the top-level included member.
    • New assertDoesntHaveMeta assertion to assert the JSON:API document does not have the top-level meta member.
    • New assertDoesntHaveLinks assertion to assert the JSON:API document does not have the top-level links member.

    Fixed

    • The assertFetchedManyInOrder assertion did not work if the expected data was an empty array.
    • The assertFetchedToMany and assertFetchedToManyInOrder assertions did not work if the expected data was an empty array.
    Open source →
  12. v3.3.0 31 Jul 2021
    Release notes

    Changed

    • Minimum PHP version is now 7.4.
    • Minimum Laravel version is now 8.0.
    • Minimum PHPUnit version is now 9.0.

    Fixed

    • #19 The expected location for the assertCreatedWithServerId() and assertCreatedWithClientId() can now be null, indicating that the Location header is not expected.

    Deprecated

    • The following methods are deprecated and will be removed in 4.0:
      • assertDeleted() - use assertNoContent() or assertMetaWithoutData() depending on your expected response.
      • assertUpdated() - use assertNoContent() or assertFetchedOne() depending on your expected response.
    Open source →
  13. v3.2.0 25 Nov 2020
    Release notes

    Added

    • Package now supports PHP 8.
    Open source →
  14. v3.1.0 09 Sep 2020
    Release notes

    Added

    • Package now supports Laravel 8.
    Open source →
  15. v3.0.0 12 Apr 2020
    Release notes

    Added

    • Package now supports PHP Unit 9.

    Changed

    • Dropped support for PHP Unit 7.
    • Dropped support for Laravel 5.
    Open source →
  16. v2.1.0 04 Mar 2020
    Release notes

    Added

    • Package now supports Laravel 7.
    • #9 Can now assert that there are no resources included - i.e. that the included member is not present or is an empty list.

    Fixed

    • #10 Pass expected and actual values to PHPUnit's assertion in correct order.
    Open source →
  17. v2.0.0 14 Oct 2019
    Release notes

    Changed

    • Minimum illuminate/support version is now 5.8 (previously 5.5).
    • Minimum PHPUnit version is now 7.5 (previously 6.0).

    Removed

    • Removed the assertNoContent() method from the Concerns\HasHttpAssertions trait. Unlike other assertion methods in that trait, this method refers to a HTTP status description which means it is likely to collide with assertions provided by frameworks. For example, Laravel 6.1.0 introduced an assertNoContent() method to its test response which is not compatible with the implementation provided by this package.
    Open source →
  18. v1.2.0 04 Sep 2019
    Release notes

    Added

    • Package now supports Laravel 6.
    Open source →
  19. v1.1.0 23 May 2019
    Release notes

    Added

    • Package now supports PHPUnit 8.
    Open source →
  20. v1.0.0 27 Feb 2019
    Release notes

    Added

    • #3 Can now assert exact errors on a document and HTTP message.
    • #5 Can now assert a server generated id with a known id.

    Fixed

    • #6 Fixed asserting that an error exists with only an integer HTTP status code.
    • #4 Fixed incorrect diff when asserting a resource identifier on a document that contains a resource object.
    Open source →
  21. v1.0.0-rc.1 03 Jan 2019 pre-release
    Release notes

    Added

    • New implementation using constraint classes. Assertions are now provided via the Assert and HttpAssert classes, with traits in the Concerns namespace for adding these to test classes.

    Changed

    • Minimum PHP version is now 7.1.

    Removed

    • Package no longer supports PHPUnit 5.
    • The previous implementation was deleted, removing these classes:
      • AbstractTraversableTester
      • DocumentTester
      • ErrorsTester
      • ErrorTester
      • ObjectTester
      • ResourceIdentifierTester
      • ResourceObjectsTester
      • ResourceObjectTester
    Open source →
  22. v0.4.0 29 Apr 2018
    Release notes

    Added

    • Object tester now had meta test helpers.
    • Can now assert the order of resources within the a resource object collection.
    Open source →
  23. v0.3.0 08 Feb 2018
    Release notes

    Added

    • Now supports PHP 5.6 to 7.2.
    • Now supports PHPUnit 5.7 to 7.0.
    Open source →
  24. v0.2.0 02 Sep 2017
    Release notes

    Removed

    • This package no longer supports PHP 5.6.
    • Updated to PHPUnit v6.
    Open source →
  25. v0.1.1 02 Sep 2017
    Release notes

    Added

    • Can now assert that a resource object is one of multiple types using assertTypeIs().
    • Can now assert that the data member of a document is null.
    • Can now assert that a resource object matches an expected structure.
    • Can now assert that the data member of a document is a resource identifier.
    • Can now assert that a document does not contain an errors member.

    Changed

    • Added a generic JSON API object tester class containing common assertions.

    Fixed

    • Resource object type assertion caused a PHP error.
    Open source →
  26. v0.1.0 02 Sep 2017
    Release notes

    Initial commit of classes and tests brought in from cloudcreativity/json-api at 0.10.1.

    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive