From f1bda4672397705b97a2db0feccdeb0e9faca2b8 Mon Sep 17 00:00:00 2001 From: kj Date: Sat, 5 Sep 2026 12:37:41 -0300 Subject: [PATCH] test(factories): add abstract Factory base class --- tests/Factories/Factory.php | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/Factories/Factory.php diff --git a/tests/Factories/Factory.php b/tests/Factories/Factory.php new file mode 100644 index 0000000..d169166 --- /dev/null +++ b/tests/Factories/Factory.php @@ -0,0 +1,55 @@ + $attributes + * @return array + */ + protected static function attributes(array $attributes = []): array + { + return array_merge(static::definition(), $attributes); + } + + /** + * Atributos por defecto de la fábrica. + * + * @return array + */ + abstract protected static function definition(): array; + + /** + * Crea una instancia del modelo con los atributos dados. + * + * @param array $attributes + */ + abstract public static function create(array $attributes = []): object; +}