|
3 | 3 | All notable changes to this project will be documented in this file. This project adheres to |
4 | 4 | [Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/). |
5 | 5 |
|
| 6 | +## [4.0.0] - 2022-02-08 |
| 7 | + |
| 8 | +### Added |
| 9 | + |
| 10 | +- Package now supports PHP 8.1. |
| 11 | +- Package now supports Laravel 9. |
| 12 | +- The package now correctly JSON encodes then decodes the expected values for assertions. This means an expected value |
| 13 | + can now contain JSON serializable objects, which improves the developer experience. For example, when using `Carbon` |
| 14 | + dates, the developer previously had to manually call `$date->jsonSerialize()` to put the expected JSON string value |
| 15 | + in their expected resource arrays. This also fixes a bug where the assertions failed to correctly compare floats that |
| 16 | + encoded to integers in JSON - e.g. `4.0` encodes as `4` but the assertion failed as it was attempting to compare a |
| 17 | + float to a decoded integer. |
| 18 | + |
| 19 | +### Changed |
| 20 | + |
| 21 | +- Added return types to internal methods to remove deprecation messages in PHP 8.1. |
| 22 | +- Added property type hints to all classes and amended method type-hints where these needed updating. |
| 23 | +- The `assertStatusCode` method now expects the status code to be an integer. Previously it allowed |
| 24 | + strings. |
| 25 | +- The `assertIncluded` method type-hint for the expected value has changed from `array` to `iterable`. |
| 26 | +- Renamed the `IdentifiersInDocument` constraint `IdentifiersInOrder`. In addition, this now extends the |
| 27 | + `SubsetsInOrder` constraint, rather than the `SubsetInDocument` constraint. |
| 28 | +- The `HasHttpAssertions` trait now does not throw an exception for its `getExpectedType()` method if the expected |
| 29 | + string is empty. Instead an exception is thrown from the `JsonObject` method that casts an id value to a resource |
| 30 | + identifier if the expected type is empty. This is an improvement because it means an expected type only needs to be |
| 31 | + set if you are using a `UrlRoutable`, `int` or `string` value for an assertion. Previously an exception would be |
| 32 | + 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 |
| 33 | + an array value that had the `type` key set. |
| 34 | + |
| 35 | +### Removed |
| 36 | + |
| 37 | +- Removed the `Assert::assertExactListInOrder` assertion. Use `Assert::assertExact` instead. |
| 38 | +- Removed the `HasDocumentAssertions::assertExactListInOrder` assertion, which means it is also removed from the |
| 39 | + `Document` class. Use `assertExact` instead. |
| 40 | +- Removed the following methods from the `Compare` class and the `HasHttpAssertions` trait. The `Utils\JsonObject` and |
| 41 | + `Utils\JsonStack` classes should be used instead: |
| 42 | + - `identifiers()` |
| 43 | + - `identifier()` |
| 44 | + - `identifiable()` |
| 45 | +- Removed the following deprecated methods: |
| 46 | + - `assertDeleted()` - use `assertNoContent()` or `assertMetaWithoutData()` depending on your expected response. |
| 47 | + - `assertUpdated()` - use `assertNoContent()` or `assertFetchedOne()` depending on your expected response. |
| 48 | +- The `HttpMessage` class previously delegated methods calls to the `Document` class if the method did not exist on the |
| 49 | + message. This was not actually in use and unnecessarily increased the complexity of the messsage class. It has |
| 50 | + therefore been removed. Call methods directly on the document if needed. |
| 51 | + |
6 | 52 | ## [3.5.0] - 2022-01-22 |
7 | 53 |
|
8 | 54 | ### Added |
|
0 commit comments