Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions docs/en/appendices/5-4-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just re-ordered the items so they are alphabatically sorted

### Commands

- You can use `$this->io` and `$this->args` inside your commands to access input/output and argument objects
Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions docs/en/development/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
```

<a id="integration-testing"></a>

## Controller Integration Testing
Expand Down