Skip to content

Commit b7f493e

Browse files
committed
Add missing property types to fixture and test class examples.
1 parent 56d2c35 commit b7f493e

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

docs/en/appendices/5-0-migration-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ changes made:
113113
### Database
114114

115115
- The `DateTimeType` and `DateType` now always return immutable objects.
116-
Additionally the interface for `Date` objects reflects the `ChronosDate`
116+
Additionally, the interface for `Date` objects reflects the `ChronosDate`
117117
interface which lacks all the time related methods that were present in
118118
CakePHP 4.x.
119119
- `DateType::setLocaleFormat()` no longer accepts an array.

docs/en/console-commands/commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ use Cake\Console\ConsoleOptionParser;
170170
class UserCommand extends Command
171171
{
172172
// Define the default table. This allows you to use `fetchTable()` without any argument.
173-
protected $defaultTable = 'Users';
173+
protected string $defaultTable = 'Users';
174174

175175
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
176176
{
@@ -485,7 +485,7 @@ class UpdateTableCommandTest extends TestCase
485485
{
486486
use ConsoleIntegrationTestTrait;
487487

488-
protected $fixtures = [
488+
protected array $fixtures = [
489489
// assumes you have a UsersFixture
490490
'app.Users',
491491
];

docs/en/development/testing.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ incorrect.
216216
By using test cases you can describe the relationship between a set of
217217
known inputs and their expected output. This helps you be more confident of the
218218
code you're writing as you can ensure that the code you wrote fulfills the
219-
expectations and assertions your tests make. Additionally because tests are
219+
expectations and assertions your tests make. Additionally, because tests are
220220
code, they can be re-run whenever you make a change. This helps prevent
221221
the creation of new bugs.
222222

@@ -548,19 +548,19 @@ class ArticlesFixture extends TestFixture
548548
{
549549
// Optional. Set this property to load fixtures
550550
// to a different test datasource
551-
public $connection = 'test';
551+
public string $connection = 'test';
552552

553553
// Optional. Lets you define which table alias is used when
554554
// reflecting schema and inserting rows. Inferred from the
555555
// class name by default. Added in 5.3.0
556-
public $tableAlias = 'Articles';
556+
public string $tableAlias = 'Articles';
557557

558558
// Optional. Lets you define the table name for a fixture.
559559
// If defined, this table name will be camelized to create
560560
// $tableAlias.
561-
public $table = 'articles';
561+
public string $table = 'articles';
562562

563-
public $records = [
563+
public array $records = [
564564
[
565565
'title' => 'First Article',
566566
'body' => 'First Article Body',
@@ -617,7 +617,7 @@ use Cake\TestSuite\Fixture\TestFixture;
617617

618618
class ArticlesFixture extends TestFixture
619619
{
620-
protected $strictFields = true;
620+
protected bool $strictFields = true;
621621

622622
// rest of fixture
623623
}
@@ -671,7 +671,7 @@ you define the `$fixtures` property in your model:
671671
``` php
672672
class ArticlesTest extends TestCase
673673
{
674-
protected $fixtures = ['app.Articles', 'app.Comments'];
674+
protected array $fixtures =['app.Articles', 'app.Comments'];
675675
}
676676
```
677677

@@ -694,7 +694,7 @@ Fixture directory. You can also load fixtures from CakePHP core, or plugins:
694694
``` php
695695
class ArticlesTest extends TestCase
696696
{
697-
protected $fixtures = [
697+
protected array $fixtures =[
698698
'plugin.DebugKit.Articles',
699699
'plugin.MyVendorName/MyPlugin.Messages',
700700
'core.Comments',
@@ -713,7 +713,7 @@ name:
713713
``` php
714714
class ArticlesTest extends CakeTestCase
715715
{
716-
protected $fixtures = ['app.Blog/Articles', 'app.Blog/Comments'];
716+
protected array $fixtures =['app.Blog/Articles', 'app.Blog/Comments'];
717717
}
718718
```
719719

@@ -926,7 +926,7 @@ use Cake\TestSuite\TestCase;
926926

927927
class ArticlesTableTest extends TestCase
928928
{
929-
protected $fixtures = ['app.Articles'];
929+
protected array $fixtures =['app.Articles'];
930930
}
931931
```
932932

@@ -948,7 +948,7 @@ use Cake\TestSuite\TestCase;
948948

949949
class ArticlesTableTest extends TestCase
950950
{
951-
protected $fixtures = ['app.Articles'];
951+
protected array $fixtures =['app.Articles'];
952952

953953
public function setUp(): void
954954
{
@@ -1100,7 +1100,7 @@ class ArticlesControllerTest extends TestCase
11001100
{
11011101
use IntegrationTestTrait;
11021102

1103-
protected $fixtures = ['app.Articles'];
1103+
protected array $fixtures =['app.Articles'];
11041104

11051105
public function testIndex(): void
11061106
{
@@ -1976,7 +1976,7 @@ use Cake\TestSuite\TestCase;
19761976

19771977
class OrdersTableTest extends TestCase
19781978
{
1979-
protected $fixtures = ['app.Orders'];
1979+
protected array $fixtures =['app.Orders'];
19801980

19811981
public function setUp(): void
19821982
{
@@ -2062,7 +2062,7 @@ use Cake\TestSuite\TestCase;
20622062
class BlogPostsTableTest extends TestCase
20632063
{
20642064
// Plugin fixtures located in /plugins/Blog/tests/Fixture/
2065-
protected $fixtures = ['plugin.Blog.BlogPosts'];
2065+
protected array $fixtures =['plugin.Blog.BlogPosts'];
20662066

20672067
public function testSomething(): void
20682068
{
@@ -2073,7 +2073,7 @@ class BlogPostsTableTest extends TestCase
20732073

20742074
If you want to use plugin fixtures in the app tests you can
20752075
reference them using `plugin.pluginName.fixtureName` syntax in the
2076-
`$fixtures` array. Additionally if you use vendor plugin name or fixture
2076+
`$fixtures` array. Additionally, if you use vendor plugin name or fixture
20772077
directories you can use the following: `plugin.vendorName/pluginName.folderName/fixtureName`.
20782078

20792079
Before you can use fixtures you should ensure you have the [fixture

0 commit comments

Comments
 (0)