From 89ed8f3d1bf14f343f382a2a3431dcc2d0217adc Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 9 Jul 2021 22:28:56 +0200 Subject: [PATCH] test: that factory() helper is gone in Laravel 8+ --- tests/acceptance/FactoryTypes.feature | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/FactoryTypes.feature b/tests/acceptance/FactoryTypes.feature index cd1dfbc..aaf16a0 100644 --- a/tests/acceptance/FactoryTypes.feature +++ b/tests/acceptance/FactoryTypes.feature @@ -24,8 +24,9 @@ Feature: factory() use Tests\Psalm\LaravelPlugin\Models\User; """ - Scenario: - Given I have the following code + Scenario: can use factory helper in Laravel 6.x and 7.x + Given I have the "laravel/framework" package satisfying the "6.* || 7.*" + And I have the following code """ class FactoryTest { /** @@ -73,3 +74,22 @@ Feature: factory() """ When I run Psalm Then I see no errors + + Scenario: cannot use factory helper in Laravel 8.x and later + Given I have the "laravel/framework" package satisfying the ">= 8.0" + And I have the following code + """ + class FactoryTest { + /** + * @return FactoryBuilder + */ + public function getFactory(): FactoryBuilder + { + return factory(User::class); + } + } + """ + When I run Psalm + Then I see these errors + | Type | Message | + | UndefinedFunction | Function factory does not exist |