mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-30 04:39:01 +01:00
test: that factory() helper is gone in Laravel 8+
This commit is contained in:
parent
c4a2cd6c4c
commit
89ed8f3d1b
@ -24,8 +24,9 @@ Feature: factory()
|
|||||||
use Tests\Psalm\LaravelPlugin\Models\User;
|
use Tests\Psalm\LaravelPlugin\Models\User;
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario:
|
Scenario: can use factory helper in Laravel 6.x and 7.x
|
||||||
Given I have the following code
|
Given I have the "laravel/framework" package satisfying the "6.* || 7.*"
|
||||||
|
And I have the following code
|
||||||
"""
|
"""
|
||||||
class FactoryTest {
|
class FactoryTest {
|
||||||
/**
|
/**
|
||||||
@ -73,3 +74,22 @@ Feature: factory()
|
|||||||
"""
|
"""
|
||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see no errors
|
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<User, 1>
|
||||||
|
*/
|
||||||
|
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 |
|
||||||
|
Loading…
Reference in New Issue
Block a user