Skip to content

Commit 89ed8f3

Browse files
committed
test: that factory() helper is gone in Laravel 8+
1 parent c4a2cd6 commit 89ed8f3

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

tests/acceptance/FactoryTypes.feature

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ Feature: factory()
2424
use Tests\Psalm\LaravelPlugin\Models\User;
2525
"""
2626

27-
Scenario:
28-
Given I have the following code
27+
Scenario: can use factory helper in Laravel 6.x and 7.x
28+
Given I have the "laravel/framework" package satisfying the "6.* || 7.*"
29+
And I have the following code
2930
"""
3031
class FactoryTest {
3132
/**
@@ -73,3 +74,22 @@ Feature: factory()
7374
"""
7475
When I run Psalm
7576
Then I see no errors
77+
78+
Scenario: cannot use factory helper in Laravel 8.x and later
79+
Given I have the "laravel/framework" package satisfying the ">= 8.0"
80+
And I have the following code
81+
"""
82+
class FactoryTest {
83+
/**
84+
* @return FactoryBuilder<User, 1>
85+
*/
86+
public function getFactory(): FactoryBuilder
87+
{
88+
return factory(User::class);
89+
}
90+
}
91+
"""
92+
When I run Psalm
93+
Then I see these errors
94+
| Type | Message |
95+
| UndefinedFunction | Function factory does not exist |

0 commit comments

Comments
 (0)