Skip to content

Commit c7c0f0a

Browse files
committed
Merge branch 'release/4.0.0'
2 parents fb5cbb9 + 1a89f70 commit c7c0f0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2380
-2343
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main, develop, 4.x ]
66
pull_request:
7-
branches: [ main, develop ]
7+
branches: [ main, develop, 4.x ]
88

99
jobs:
1010
build:
@@ -14,8 +14,11 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: ['7.4', '8.0']
18-
laravel: ['^8.0']
17+
php: [7.4, '8.0', 8.1]
18+
laravel: [8, 9]
19+
exclude:
20+
- php: 7.4
21+
laravel: 9
1922

2023
steps:
2124
- name: Checkout Code
@@ -25,19 +28,19 @@ jobs:
2528
uses: shivammathur/setup-php@v2
2629
with:
2730
php-version: ${{ matrix.php }}
28-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
31+
extensions: dom, curl, libxml, mbstring, zip
2932
tools: composer:v2
3033
coverage: none
3134

3235
- name: Set Laravel Version
33-
run: composer require "illuminate/support:${{ matrix.laravel }}" --no-update -n
36+
run: composer require "illuminate/contracts:^${{ matrix.laravel }}" --no-update
3437

3538
- name: Install dependencies
3639
uses: nick-invision/retry@v1
3740
with:
3841
timeout_minutes: 5
3942
max_attempts: 5
40-
command: composer install --no-suggest --prefer-dist -n -o
43+
command: composer update --prefer-dist --no-interaction --no-progress
4144

4245
- name: Execute tests
4346
run: vendor/bin/phpunit

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,52 @@
33
All notable changes to this project will be documented in this file. This project adheres to
44
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
55

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+
652
## [3.5.0] - 2022-01-22
753

854
### Added

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
"require": {
2424
"php": "^7.4|^8.0",
2525
"ext-json": "*",
26-
"illuminate/support": "^8.0",
27-
"phpunit/phpunit": "^9.0"
26+
"illuminate/contracts": "^8.0|^9.0",
27+
"illuminate/support": "^8.0|^9.0",
28+
"phpunit/phpunit": "^9.5.10"
2829
},
2930
"autoload": {
3031
"psr-4": {
@@ -38,7 +39,7 @@
3839
},
3940
"extra": {
4041
"branch-alias": {
41-
"dev-develop": "3.x-dev"
42+
"dev-develop": "4.x-dev"
4243
}
4344
},
4445
"minimum-stability": "stable",

phpunit.xml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@
88
convertErrorsToExceptions="true"
99
convertNoticesToExceptions="true"
1010
convertWarningsToExceptions="true"
11+
convertDeprecationsToExceptions="true"
1112
processIsolation="false"
1213
stopOnError="false"
1314
stopOnFailure="false"
1415
verbose="true"
1516
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
1617
>
17-
<coverage>
18-
<include>
19-
<directory suffix="Test.php">src/</directory>
20-
</include>
21-
</coverage>
22-
<testsuites>
23-
<testsuite name="Unit">
24-
<directory>./tests/</directory>
25-
</testsuite>
26-
</testsuites>
18+
<coverage>
19+
<include>
20+
<directory suffix="Test.php">src/</directory>
21+
</include>
22+
</coverage>
23+
<testsuites>
24+
<testsuite name="Unit">
25+
<directory>./tests/</directory>
26+
</testsuite>
27+
</testsuites>
28+
<php>
29+
<ini name="error_reporting" value="E_ALL"/>
30+
</php>
2731
</phpunit>

0 commit comments

Comments
 (0)