Skip to content

Commit 260d99a

Browse files
committed
Add release notes for cakephp/cakephp#18213
1 parent e326e27 commit 260d99a

2 files changed

Lines changed: 35 additions & 5 deletions

File tree

en/appendices/5-2-migration-guide.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ Datasource
101101
This allows you to create dynamic validation messages based on the entity
102102
state and validation rule options.
103103

104+
Error
105+
-----
106+
107+
- Custom exceptions can have specific error handling logic defined in
108+
``ErrorController``.
109+
104110
ORM
105111
---
106112

@@ -112,6 +118,13 @@ ORM
112118
used to hydrate junction table records.
113119
- ``Table::findOrCreate()`` now accepts an array as second argument to directly pass data in.
114120

121+
TestSuite
122+
---------
123+
124+
- ``TestFixture::$strictFields`` was added. Enabling this property will make
125+
fixtures raise an error if a fixture's record list contains fields that do not
126+
exist in the schema.
127+
115128
View
116129
----
117130

@@ -122,8 +135,3 @@ View
122135
- ``FormHelper`` now uses the ``containerClass`` template to apply a class to
123136
the form control div. The default value is ``input``.
124137

125-
Error
126-
-----
127-
128-
- Custom exceptions can have specific error handling logic defined in
129-
``ErrorController``.

en/development/testing.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,28 @@ should be an associative array of the columns and values for the row. Just keep
629629
in mind that each record in the ``$records`` array must have the same keys as
630630
rows are bulk inserted.
631631

632+
As you evolve your schema your fixture records may accumulate unused or
633+
unsupported fields. You can enable ``strictFields`` on a fixture to have errors
634+
raised when a record contains fields that are not defined in the schema::
635+
636+
namespace App\Test\Fixture;
637+
638+
use Cake\TestSuite\Fixture\TestFixture;
639+
640+
class ArticlesFixture extends TestFixture
641+
{
642+
protected $strictFields = true;
643+
644+
// rest of fixture
645+
}
646+
647+
The ``strictFields`` mode can be useful in catching typos or when you want to
648+
enforce stricter maintenance of test data.
649+
650+
.. versionadded:: 5.2.0
651+
``TestFixture::$strictFields`` was added.
652+
653+
632654
Dynamic Data
633655
------------
634656

0 commit comments

Comments
 (0)