All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning and this changelog format.
- Remove deprecation notices from PHP 8.4.
- 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
.
- 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
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 as4
but 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
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 fromarray
toiterable
. - Renamed the
IdentifiersInDocument
constraintIdentifiersInOrder
. In addition, this now extends theSubsetsInOrder
constraint, rather than theSubsetInDocument
constraint. - The
HasHttpAssertions
trait now does not throw an exception for itsgetExpectedType()
method if the expected string is empty. Instead an exception is thrown from theJsonObject
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 aUrlRoutable
,int
orstring
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 thetype
key set.
- Removed the
Assert::assertExactListInOrder
assertion. UseAssert::assertExact
instead. - Removed the
HasDocumentAssertions::assertExactListInOrder
assertion, which means it is also removed from theDocument
class. UseassertExact
instead. - Removed the following methods from the
Compare
class and theHasHttpAssertions
trait. TheUtils\JsonObject
andUtils\JsonStack
classes 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
HttpMessage
class previously delegated methods calls to theDocument
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.
- #18 The
assertMetaWithoutData
andassertExactMetaWithoutData
assertions now assert a successful HTTP status code. Previously they were expecting200 OK
though this is too restrictive for a meta-only response. However, the assertions will continue to fail for204 No Content
responses because they are expecting the response to have content. - #14 The expected
Location
header passed to theassertCreatedWithClientId
assertion can now include the expected resource id. Previously the expected header value had to be passed without the id.
- The
assertCreatedWithServerId
,assertCreatedWithClientId
andassertCreatedNoContent
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-levelincluded
member. - New
assertDoesntHaveMeta
assertion to assert the JSON:API document does not have the top-levelmeta
member. - New
assertDoesntHaveLinks
assertion to assert the JSON:API document does not have the top-levellinks
member.
- The
assertFetchedManyInOrder
assertion did not work if the expecteddata
was an empty array. - The
assertFetchedToMany
andassertFetchedToManyInOrder
assertions did not work if the expecteddata
was 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 theLocation
header 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
included
member is not present or is an empty list.
- #10 Pass expected and actual values to PHPUnit's assertion in correct order.
- Minimum
illuminate/support
version is now5.8
(previously5.5
). - Minimum PHPUnit version is now
7.5
(previously6.0
).
- Removed the
assertNoContent()
method from theConcerns\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, Laravel6.1.0
introduced 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
Assert
andHttpAssert
classes, with traits in theConcerns
namespace 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:
AbstractTraversableTester
DocumentTester
ErrorsTester
ErrorTester
ObjectTester
ResourceIdentifierTester
ResourceObjectsTester
ResourceObjectTester
- 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
data
member of a document isnull
. - 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.
- 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
.