Skip to content

Commit ed70eb2

Browse files
committed
Merge branch 'hotfix/4.0.1'
2 parents b912901 + 8879097 commit ed70eb2

File tree

5 files changed

+44
-55
lines changed

5 files changed

+44
-55
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file. This project adheres to
44
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
55

6+
## [4.0.1] - 2022-04-24
7+
8+
### Fixed
9+
10+
- Fixed deprecation messages in tests originating from the `fakerphp/faker` package.
11+
612
## [4.0.0] - 2022-02-09
713

814
### Added

tests/dummy/database/factories/ClientJobFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@
5050
$factory->state(ClientJob::class, 'with_download', function () {
5151
return [
5252
'resource_type' => 'downloads',
53-
'resource_id' => factory(Download::class)->create()->getRouteKey(),
53+
'resource_id' => factory(Download::class),
5454
];
5555
});

tests/dummy/database/factories/ModelFactory.php

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
use DummyApp\User;
1918
use Faker\Generator as Faker;
2019
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
2120
use Illuminate\Support\Str;
@@ -27,45 +26,37 @@
2726
return [
2827
'path' => 'avatars/' . Str::random(6) . '.jpg',
2928
'media_type' => 'image/jpeg',
30-
'user_id' => function () {
31-
return factory(DummyApp\User::class)->create()->getKey();
32-
},
29+
'user_id' => factory(DummyApp\User::class),
3330
];
3431
});
3532

3633
/** Comment */
3734
$factory->define(DummyApp\Comment::class, function (Faker $faker) {
3835
return [
39-
'content' => $faker->paragraph,
40-
'user_id' => function () {
41-
return factory(DummyApp\User::class)->create()->getKey();
42-
},
36+
'content' => $faker->paragraph(),
37+
'user_id' => factory(DummyApp\User::class),
4338
];
4439
});
4540

4641
$factory->state(DummyApp\Comment::class, 'post', function () {
4742
return [
4843
'commentable_type' => DummyApp\Post::class,
49-
'commentable_id' => function () {
50-
return factory(DummyApp\Post::class)->states('published')->create()->getKey();
51-
}
44+
'commentable_id' => factory(DummyApp\Post::class)->states('published'),
5245
];
5346
});
5447

5548
$factory->state(DummyApp\Comment::class, 'video', function () {
5649
return [
5750
'commentable_type' => DummyApp\Video::class,
58-
'commentable_id' => function () {
59-
return factory(DummyApp\Video::class)->create()->getKey();
60-
}
51+
'commentable_id' => factory(DummyApp\Video::class),
6152
];
6253
});
6354

6455
/** Country */
6556
$factory->define(DummyApp\Country::class, function (Faker $faker) {
6657
return [
67-
'name' => $faker->country,
68-
'code' => $faker->countryCode,
58+
'name' => $faker->country(),
59+
'code' => $faker->countryCode(),
6960
];
7061
});
7162

@@ -92,21 +83,17 @@
9283

9384
$factory->state(DummyApp\Phone::class, 'user', function (Faker $faker) {
9485
return [
95-
'user_id' => function () {
96-
return factory(DummyApp\User::class)->create()->getKey();
97-
},
86+
'user_id' => factory(DummyApp\User::class),
9887
];
9988
});
10089

10190
/** Post */
10291
$factory->define(DummyApp\Post::class, function (Faker $faker) {
10392
return [
104-
'title' => $faker->sentence,
105-
'slug' => $faker->unique()->slug,
106-
'content' => $faker->text,
107-
'author_id' => function () {
108-
return factory(DummyApp\User::class)->states('author')->create()->getKey();
109-
},
93+
'title' => $faker->sentence(),
94+
'slug' => $faker->unique()->slug(),
95+
'content' => $faker->text(),
96+
'author_id' => factory(DummyApp\User::class)->states('author'),
11097
];
11198
});
11299

@@ -118,22 +105,22 @@
118105

119106
/** Role */
120107
$factory->define(DummyApp\Role::class, function (Faker $faker) {
121-
return ['name' => $faker->colorName];
108+
return ['name' => $faker->colorName()];
122109
});
123110

124111
/** Tag */
125112
$factory->define(DummyApp\Tag::class, function (Faker $faker) {
126113
return [
127-
'uuid' => $faker->uuid,
128-
'name' => $faker->country,
114+
'uuid' => $faker->unique()->uuid(),
115+
'name' => $faker->country(),
129116
];
130117
});
131118

132119
/** User */
133120
$factory->define(DummyApp\User::class, function (Faker $faker) {
134121
return [
135-
'name' => $faker->name,
136-
'email' => $faker->unique()->email,
122+
'name' => $faker->name(),
123+
'email' => $faker->unique()->email(),
137124
'password' => bcrypt(Str::random(10)),
138125
];
139126
});
@@ -149,29 +136,25 @@
149136
/** Video */
150137
$factory->define(DummyApp\Video::class, function (Faker $faker) {
151138
return [
152-
'uuid' => $faker->unique()->uuid,
153-
'url' => $faker->url,
139+
'uuid' => $faker->unique()->uuid(),
140+
'url' => $faker->url(),
154141
'title' => $faker->words(3, true),
155-
'description' => $faker->paragraph,
156-
'user_id' => function () {
157-
return factory(DummyApp\User::class)->create()->getKey();
158-
},
142+
'description' => $faker->paragraph(),
143+
'user_id' => factory(DummyApp\User::class),
159144
];
160145
});
161146

162147
/** Supplier */
163148
$factory->define(DummyApp\Supplier::class, function (Faker $faker) {
164149
return [
165-
'name' => $faker->company,
150+
'name' => $faker->company(),
166151
];
167152
});
168153

169154
/** History */
170155
$factory->define(DummyApp\History::class, function (Faker $faker) {
171156
return [
172-
'detail' => $faker->paragraph,
173-
'user_id' => function () {
174-
return factory(DummyApp\User::class)->create()->getKey();
175-
},
157+
'detail' => $faker->paragraph(),
158+
'user_id' => factory(DummyApp\User::class),
176159
];
177160
});

tests/lib/Integration/Pagination/CursorPagingTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testOnlyLimit()
8585
/** @var Collection $comments */
8686
$comments = factory(Comment::class, 5)->create([
8787
'created_at' => function () {
88-
return $this->faker->dateTime;
88+
return $this->faker->dateTime();
8989
}
9090
])->sortByDesc('created_at')->values();
9191

@@ -115,7 +115,7 @@ public function testBefore()
115115
/** @var Collection $comments */
116116
$comments = factory(Comment::class, 10)->create([
117117
'created_at' => function () {
118-
return $this->faker->dateTime;
118+
return $this->faker->dateTime();
119119
}
120120
])->sortByDesc('created_at')->values();
121121

@@ -158,7 +158,7 @@ public function testBeforeAscending()
158158
/** @var Collection $comments */
159159
$comments = factory(Comment::class, 10)->create([
160160
'created_at' => function () {
161-
return $this->faker->dateTime;
161+
return $this->faker->dateTime();
162162
}
163163
])->sortBy('created_at')->values();
164164

@@ -261,7 +261,7 @@ public function testAfter()
261261
/** @var Collection $comments */
262262
$comments = factory(Comment::class, 10)->create([
263263
'created_at' => function () {
264-
return $this->faker->dateTime;
264+
return $this->faker->dateTime();
265265
}
266266
])->sortByDesc('created_at')->values();
267267

@@ -303,7 +303,7 @@ public function testAfterAscending()
303303
/** @var Collection $comments */
304304
$comments = factory(Comment::class, 10)->create([
305305
'created_at' => function () {
306-
return $this->faker->dateTime;
306+
return $this->faker->dateTime();
307307
}
308308
])->sortBy('created_at')->values();
309309

@@ -343,7 +343,7 @@ public function testAfterWithoutMore()
343343
/** @var Collection $comments */
344344
$comments = factory(Comment::class, 4)->create([
345345
'created_at' => function () {
346-
return $this->faker->dateTime;
346+
return $this->faker->dateTime();
347347
}
348348
])->sortByDesc('created_at')->values();
349349

@@ -437,7 +437,7 @@ public function testAfterWithCustomKey()
437437
/** @var Collection $comments */
438438
$comments = factory(Comment::class, 6)->create([
439439
'created_at' => function () {
440-
return $this->faker->dateTime;
440+
return $this->faker->dateTime();
441441
}
442442
])->sortByDesc('created_at')->values();
443443

@@ -525,7 +525,7 @@ public function testBeforeAndAfter()
525525
/** @var Collection $comments */
526526
$comments = factory(Comment::class, 6)->create([
527527
'created_at' => function () {
528-
return $this->faker->dateTime;
528+
return $this->faker->dateTime();
529529
}
530530
])->sortByDesc('created_at')->values();
531531

@@ -573,7 +573,7 @@ public function testSameColumnAndIdentifier()
573573
/** @var Collection $comments */
574574
$comments = factory(Comment::class, 6)->create([
575575
'created_at' => function () {
576-
return $this->faker->dateTime;
576+
return $this->faker->dateTime();
577577
}
578578
])->sortByDesc('id')->values();
579579

@@ -620,7 +620,7 @@ public function testCustomMeta()
620620
/** @var Collection $comments */
621621
$comments = factory(Comment::class, 6)->create([
622622
'created_at' => function () {
623-
return $this->faker->dateTime;
623+
return $this->faker->dateTime();
624624
}
625625
])->sortByDesc('created_at')->values();
626626

@@ -665,7 +665,7 @@ public function testColumn()
665665
/** @var Collection $comments */
666666
$comments = factory(Comment::class, 6)->create([
667667
'updated_at' => function () {
668-
return $this->faker->dateTime;
668+
return $this->faker->dateTime();
669669
}
670670
])->sortByDesc('updated_at')->values();
671671

tests/package/database/factories/ModelFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
/** Blog */
2525
$factory->define(Blog::class, function (Faker $faker) {
2626
return [
27-
'title' => $faker->sentence,
28-
'article' => $faker->text,
27+
'title' => $faker->sentence(),
28+
'article' => $faker->text(),
2929
];
3030
});
3131

0 commit comments

Comments
 (0)