From 77b8f48375116aa88c3f79cf46614aca88ec160a Mon Sep 17 00:00:00 2001 From: insolita Date: Thu, 26 Nov 2020 04:43:56 +0800 Subject: [PATCH] fix faker: set attributes without validation --- src/generator/default/faker.php | 2 +- tests/specs/blog/models/CategoryFaker.php | 2 +- tests/specs/blog/models/CommentFaker.php | 2 +- tests/specs/blog/models/FakerableFaker.php | 2 +- tests/specs/blog/models/PostFaker.php | 2 +- tests/specs/blog/models/UserFaker.php | 2 +- tests/specs/blog_v2/models/CategoryFaker.php | 2 +- tests/specs/blog_v2/models/CommentFaker.php | 2 +- tests/specs/blog_v2/models/PostFaker.php | 2 +- tests/specs/blog_v2/models/TagFaker.php | 2 +- tests/specs/blog_v2/models/UserFaker.php | 2 +- tests/specs/menu/models/MenuFaker.php | 2 +- tests/specs/petstore/models/PetFaker.php | 2 +- tests/specs/petstore/models/StoreFaker.php | 2 +- tests/specs/petstore_arrayref/models/PetFaker.php | 2 +- tests/specs/petstore_jsonapi/models/PetFaker.php | 2 +- tests/specs/petstore_namespace/mymodels/faker/PetFaker.php | 2 +- tests/specs/petstore_namespace/mymodels/faker/StoreFaker.php | 2 +- tests/specs/petstore_xtable/models/PetFaker.php | 2 +- tests/specs/postgres_custom/models/CustomFaker.php | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/generator/default/faker.php b/src/generator/default/faker.php index 5be1feca..8a463a22 100644 --- a/src/generator/default/faker.php +++ b/src/generator/default/faker.php @@ -49,7 +49,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog/models/CategoryFaker.php b/tests/specs/blog/models/CategoryFaker.php index fb9bd890..b22fecf7 100644 --- a/tests/specs/blog/models/CategoryFaker.php +++ b/tests/specs/blog/models/CategoryFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog/models/CommentFaker.php b/tests/specs/blog/models/CommentFaker.php index c364c052..20ace610 100644 --- a/tests/specs/blog/models/CommentFaker.php +++ b/tests/specs/blog/models/CommentFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog/models/FakerableFaker.php b/tests/specs/blog/models/FakerableFaker.php index d8d2f509..b13525c9 100644 --- a/tests/specs/blog/models/FakerableFaker.php +++ b/tests/specs/blog/models/FakerableFaker.php @@ -42,7 +42,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog/models/PostFaker.php b/tests/specs/blog/models/PostFaker.php index c503a205..b94e1473 100644 --- a/tests/specs/blog/models/PostFaker.php +++ b/tests/specs/blog/models/PostFaker.php @@ -31,7 +31,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog/models/UserFaker.php b/tests/specs/blog/models/UserFaker.php index d7b0d5ce..d4da2c3a 100644 --- a/tests/specs/blog/models/UserFaker.php +++ b/tests/specs/blog/models/UserFaker.php @@ -33,7 +33,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog_v2/models/CategoryFaker.php b/tests/specs/blog_v2/models/CategoryFaker.php index 32c615be..192b8809 100644 --- a/tests/specs/blog_v2/models/CategoryFaker.php +++ b/tests/specs/blog_v2/models/CategoryFaker.php @@ -30,7 +30,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog_v2/models/CommentFaker.php b/tests/specs/blog_v2/models/CommentFaker.php index 2fb80c99..9c643311 100644 --- a/tests/specs/blog_v2/models/CommentFaker.php +++ b/tests/specs/blog_v2/models/CommentFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog_v2/models/PostFaker.php b/tests/specs/blog_v2/models/PostFaker.php index 668041dd..9c63db1f 100644 --- a/tests/specs/blog_v2/models/PostFaker.php +++ b/tests/specs/blog_v2/models/PostFaker.php @@ -32,7 +32,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog_v2/models/TagFaker.php b/tests/specs/blog_v2/models/TagFaker.php index 7c12fb34..dc7996e3 100644 --- a/tests/specs/blog_v2/models/TagFaker.php +++ b/tests/specs/blog_v2/models/TagFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/blog_v2/models/UserFaker.php b/tests/specs/blog_v2/models/UserFaker.php index 4f53c19e..62891d08 100644 --- a/tests/specs/blog_v2/models/UserFaker.php +++ b/tests/specs/blog_v2/models/UserFaker.php @@ -33,7 +33,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/menu/models/MenuFaker.php b/tests/specs/menu/models/MenuFaker.php index eb522b04..35f80d84 100644 --- a/tests/specs/menu/models/MenuFaker.php +++ b/tests/specs/menu/models/MenuFaker.php @@ -30,7 +30,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/petstore/models/PetFaker.php b/tests/specs/petstore/models/PetFaker.php index bd2bba7d..ab971a5c 100644 --- a/tests/specs/petstore/models/PetFaker.php +++ b/tests/specs/petstore/models/PetFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/petstore/models/StoreFaker.php b/tests/specs/petstore/models/StoreFaker.php index 9699be2d..0d8020ac 100644 --- a/tests/specs/petstore/models/StoreFaker.php +++ b/tests/specs/petstore/models/StoreFaker.php @@ -28,7 +28,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/petstore_arrayref/models/PetFaker.php b/tests/specs/petstore_arrayref/models/PetFaker.php index bd2bba7d..ab971a5c 100644 --- a/tests/specs/petstore_arrayref/models/PetFaker.php +++ b/tests/specs/petstore_arrayref/models/PetFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/petstore_jsonapi/models/PetFaker.php b/tests/specs/petstore_jsonapi/models/PetFaker.php index bd2bba7d..ab971a5c 100644 --- a/tests/specs/petstore_jsonapi/models/PetFaker.php +++ b/tests/specs/petstore_jsonapi/models/PetFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/petstore_namespace/mymodels/faker/PetFaker.php b/tests/specs/petstore_namespace/mymodels/faker/PetFaker.php index 37b19cd3..b62bcd36 100644 --- a/tests/specs/petstore_namespace/mymodels/faker/PetFaker.php +++ b/tests/specs/petstore_namespace/mymodels/faker/PetFaker.php @@ -30,7 +30,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/petstore_namespace/mymodels/faker/StoreFaker.php b/tests/specs/petstore_namespace/mymodels/faker/StoreFaker.php index 5588685e..9ce20e6f 100644 --- a/tests/specs/petstore_namespace/mymodels/faker/StoreFaker.php +++ b/tests/specs/petstore_namespace/mymodels/faker/StoreFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/petstore_xtable/models/PetFaker.php b/tests/specs/petstore_xtable/models/PetFaker.php index bd2bba7d..ab971a5c 100644 --- a/tests/specs/petstore_xtable/models/PetFaker.php +++ b/tests/specs/petstore_xtable/models/PetFaker.php @@ -29,7 +29,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); } diff --git a/tests/specs/postgres_custom/models/CustomFaker.php b/tests/specs/postgres_custom/models/CustomFaker.php index 93d75c01..a80a9c8a 100644 --- a/tests/specs/postgres_custom/models/CustomFaker.php +++ b/tests/specs/postgres_custom/models/CustomFaker.php @@ -33,7 +33,7 @@ public function generateModel() public static function makeOne(array $attributes, bool $save = false) { $model = (new static())->generateModel(); - $model->setAttributes($attributes); + $model->setAttributes($attributes, false); if ($save === true) { $model->save(); }