All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning and this changelog format.
- Package now supports PHPUnit 12.
- Package now requires
illuminate/support11 or 12.
- Remove deprecation notices from PHP 8.4.
- Package is now licensed under the MIT License.
- BREAKING Package now requires
illuminate/support10 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.
- 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.
- Package now supports Laravel 10 and PHP 8.2.
- 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
Carbondates, 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.0encodes as4but the assertion failed as it was attempting to compare a float to a decoded integer.
- 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
assertStatusCodemethod now expects the status code to be an integer. Previously it allowed strings. - The
assertIncludedmethod type-hint for the expected value has changed fromarraytoiterable. - Renamed the
IdentifiersInDocumentconstraintIdentifiersInOrder. In addition, this now extends theSubsetsInOrderconstraint, rather than theSubsetInDocumentconstraint. - The
HasHttpAssertionstrait now does not throw an exception for itsgetExpectedType()method if the expected string is empty. Instead an exception is thrown from theJsonObjectmethod 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 aUrlRoutable,intorstringvalue 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 thetypekey set.
- Removed the
Assert::assertExactListInOrderassertion. UseAssert::assertExactinstead. - Removed the
HasDocumentAssertions::assertExactListInOrderassertion, which means it is also removed from theDocumentclass. UseassertExactinstead. - Removed the following methods from the
Compareclass and theHasHttpAssertionstrait. TheUtils\JsonObjectandUtils\JsonStackclasses should be used instead:identifiers()identifier()identifiable()
- Removed the following deprecated methods:
assertDeleted()- useassertNoContent()orassertMetaWithoutData()depending on your expected response.assertUpdated()- useassertNoContent()orassertFetchedOne()depending on your expected response.
- The
HttpMessageclass previously delegated methods calls to theDocumentclass 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.
- #18 The
assertMetaWithoutDataandassertExactMetaWithoutDataassertions now assert a successful HTTP status code. Previously they were expecting200 OKthough this is too restrictive for a meta-only response. However, the assertions will continue to fail for204 No Contentresponses because they are expecting the response to have content. - #14 The expected
Locationheader passed to theassertCreatedWithClientIdassertion can now include the expected resource id. Previously the expected header value had to be passed without the id.
- The
assertCreatedWithServerId,assertCreatedWithClientIdandassertCreatedNoContentmethods will now fail with a better assertion message if the Location header is missing. - New
assertDoesntHaveIncludedassertion to assert that the JSON:API document does not have the top-levelincludedmember. - New
assertDoesntHaveMetaassertion to assert the JSON:API document does not have the top-levelmetamember. - New
assertDoesntHaveLinksassertion to assert the JSON:API document does not have the top-levellinksmember.
- The
assertFetchedManyInOrderassertion did not work if the expecteddatawas an empty array. - The
assertFetchedToManyandassertFetchedToManyInOrderassertions did not work if the expecteddatawas an empty array.
- Minimum PHP version is now
7.4. - Minimum Laravel version is now
8.0. - Minimum PHPUnit version is now
9.0.
- #19 The expected location for the
assertCreatedWithServerId()andassertCreatedWithClientId()can now benull, indicating that theLocationheader is not expected.
- The following methods are deprecated and will be removed in
4.0:assertDeleted()- useassertNoContent()orassertMetaWithoutData()depending on your expected response.assertUpdated()- useassertNoContent()orassertFetchedOne()depending on your expected response.
- Package now supports PHP 8.
- Package now supports Laravel 8.
- Package now supports PHP Unit 9.
- Dropped support for PHP Unit 7.
- Dropped support for Laravel 5.
- Package now supports Laravel 7.
- #9
Can now assert that there are no resources included - i.e. that the
includedmember is not present or is an empty list.
- #10 Pass expected and actual values to PHPUnit's assertion in correct order.
- Minimum
illuminate/supportversion is now5.8(previously5.5). - Minimum PHPUnit version is now
7.5(previously6.0).
- Removed the
assertNoContent()method from theConcerns\HasHttpAssertionstrait. 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, Laravel6.1.0introduced anassertNoContent()method to its test response which is not compatible with the implementation provided by this package.
- Package now supports Laravel 6.
- Package now supports PHPUnit 8.
- #3 Can now assert exact errors on a document and HTTP message.
- #5 Can now assert a server generated id with a known id.
- #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.
- New implementation using constraint classes. Assertions are now provided via the
AssertandHttpAssertclasses, with traits in theConcernsnamespace for adding these to test classes.
- Minimum PHP version is now
7.1.
- Package no longer supports PHPUnit 5.
- The previous implementation was deleted, removing these classes:
AbstractTraversableTesterDocumentTesterErrorsTesterErrorTesterObjectTesterResourceIdentifierTesterResourceObjectsTesterResourceObjectTester
- Object tester now had meta test helpers.
- Can now assert the order of resources within the a resource object collection.
- Now supports PHP 5.6 to 7.2.
- Now supports PHPUnit 5.7 to 7.0.
- This package no longer supports PHP 5.6.
- Updated to PHPUnit v6.
- Can now assert that a resource object is one of multiple types using
assertTypeIs(). - Can now assert that the
datamember of a document isnull. - Can now assert that a resource object matches an expected structure.
- Can now assert that the
datamember of a document is a resource identifier. - Can now assert that a document does not contain an
errorsmember.
- Added a generic JSON API object tester class containing common assertions.
- Resource object type assertion caused a PHP error.
Initial commit of classes and tests brought in from cloudcreativity/json-api at 0.10.1.