diff --git a/docs/en/appendices/5-4-migration-guide.md b/docs/en/appendices/5-4-migration-guide.md index 1f84e5c1d0..6a87c8f22a 100644 --- a/docs/en/appendices/5-4-migration-guide.md +++ b/docs/en/appendices/5-4-migration-guide.md @@ -71,6 +71,12 @@ version is reported as `unknown`), the header is omitted. `league/container` implementation by setting `App.container` to `cake` inside your `config/app.php`. See [Dependency Injection Container](../development/dependency-injection) for more details. +### Collection + +- Added [`keys()`](../core-libraries/collections#keys) and [`values()`](../core-libraries/collections#values) methods for extracting keys or re-indexing values. +- Added [`implode()`](../core-libraries/collections#implode) method to concatenate elements into a string. +- Added [`when()`](../core-libraries/collections#when) and [`unless()`](../core-libraries/collections#unless) methods for conditional method chaining. + ### Commands - You can use `$this->io` and `$this->args` inside your commands to access input/output and argument objects @@ -99,6 +105,12 @@ version is reported as `unknown`), the header is omitted. - Added `inOrNull()` and `notInOrNull()` methods for combining `IN` conditions with `IS NULL`. - Added `isDistinctFrom()` and `isNotDistinctFrom()` methods for null-safe comparisons. +### Http + +- Added PSR-13 Link implementation with `Cake\Http\Link\Link` and `Cake\Http\Link\LinkProvider` + classes for hypermedia link support. Links added to responses are automatically emitted + as HTTP `Link` headers. See [Hypermedia Links](../controllers/request-response#hypermedia-links). + ### I18n - `Number::toReadableSize()` now uses decimal units (KB = 1000 bytes) by default. @@ -110,11 +122,9 @@ version is reported as `unknown`), the header is omitted. nested array format matching `contain()` syntax. See [Converting Request Data into Entities](../orm/saving-data#converting-request-data-into-entities). -### Http +### Testsuite -- Added PSR-13 Link implementation with `Cake\Http\Link\Link` and `Cake\Http\Link\LinkProvider` - classes for hypermedia link support. Links added to responses are automatically emitted - as HTTP `Link` headers. See [Hypermedia Links](../controllers/request-response#hypermedia-links). +- `TestCase::mockModel()` has been added to allow mocking of model classes in tests using Mockery mocks. ### Utility @@ -124,12 +134,6 @@ version is reported as `unknown`), the header is omitted. - `Security::encrypt()` can now be configured to use longer keys with separate encryption and authentication keys that are derived from the provided key. You can set `Security.encryptWithRawKey` to enable this behavior. See [here](https://github.com/cakephp/cakephp/pull/19325) for more details. -### Collection - -- Added [`keys()`](../core-libraries/collections#keys) and [`values()`](../core-libraries/collections#values) methods for extracting keys or re-indexing values. -- Added [`implode()`](../core-libraries/collections#implode) method to concatenate elements into a string. -- Added [`when()`](../core-libraries/collections#when) and [`unless()`](../core-libraries/collections#unless) methods for conditional method chaining. - ### View - Added `{{inputId}}` template variable to `inputContainer` and `error` templates diff --git a/docs/en/development/testing.md b/docs/en/development/testing.md index 4acde5c865..ada6eb4817 100644 --- a/docs/en/development/testing.md +++ b/docs/en/development/testing.md @@ -1043,6 +1043,23 @@ In your `tearDown()` method be sure to remove the mock with: $this->getTableLocator()->clear(); ``` +::: info Added in version 5.4 +::: + +If you prefer Mockery mocks you can use `mockModel()` instead of `getMockForModel()`. + +```php +public function testSendingEmails(): void +{ + $model = $this->mockModel('EmailVerification'); + $mock->shouldReceive('send') + ->once() + ->andReturn(true); + + $model->verifyEmail('test@example.com'); +} +``` + ## Controller Integration Testing