You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update PHPUnit documentation for CakePHP 5.x requirements (#8186)
CakePHP 5.x now requires PHPUnit ^11.5.3 || ^12.1.3, making the previous
PHPUnit 10 documentation outdated. This updates the guide to cover:
- Current version requirements (PHPUnit 11.5+ or 12.1+)
- Migration from annotations to PHP 8 attributes
- Data provider static requirements
- Test double changes (createStub vs createMock)
- PHPUnit 12 specific breaking changes
- Comprehensive upgrade checklist
Fixes#8172
With CakePHP 5 the minimum PHPUnit version has changed from `^8.5 || ^9.3` to `^10.1`. This introduces a few breaking changes from PHPUnit as well as from CakePHP's side.
3
+
This guide covers the PHPUnit version requirements and migration steps for CakePHP 5.x applications.
4
+
5
+
## Current Requirements
6
+
7
+
CakePHP 5.x requires **PHPUnit ^11.5.3 or ^12.1.3**. This means:
8
+
9
+
- PHPUnit 11.5.3+ requires **PHP 8.2** or later
10
+
- PHPUnit 12.1.3+ requires **PHP 8.3** or later
11
+
12
+
> [!NOTE]
13
+
> PHPUnit 10 is no longer supported in CakePHP 5.x. If you are still on PHPUnit 10,
14
+
> you must upgrade to PHPUnit 11 or 12.
4
15
5
16
## phpunit.xml adjustments
6
17
@@ -9,60 +20,131 @@ It is recommended to let PHPUnit update its configuration file via the following
9
20
vendor/bin/phpunit --migrate-configuration
10
21
11
22
> [!NOTE]
12
-
> Make sure you are already on PHPUnit 10 via `vendor/bin/phpunit --version` before executing this command!
23
+
> Make sure you verify your PHPUnit version via `vendor/bin/phpunit --version` before executing this command!
13
24
14
-
With this command out of the way your `phpunit.xml` already has most of the recommended changes present.
25
+
### Extension Configuration
15
26
16
-
### New event system
27
+
CakePHP's fixture extension uses PHPUnit's event system. Your `phpunit.xml` should have:
17
28
18
-
PHPUnit 10 removed the old hook system and introduced a new [Event system](https://docs.phpunit.de/en/10.5/extending-phpunit.html#extending-the-test-runner)
19
-
which requires the following code in your `phpunit.xml` to be adjusted from:
0 commit comments