Skip to content

Commit

Permalink
Differentiate tests for psalm 4 and Psalm 5
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed Jan 31, 2023
1 parent 7d6af0b commit a5a7a22
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/acceptance/EloquentBuilderTypes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Feature: Eloquent Builder types
When I run Psalm
Then I see no errors

Scenario: can not call whereDate with incompatible type
Scenario: can not call whereDate with incompatible type [ Psalm 5 ]
Given I have the following code
"""
/**
Expand All @@ -240,11 +240,29 @@ Feature: Eloquent Builder types
return $builder->whereDate('created_at', '>', 1);
}
"""
And I have Psalm newer than "5.0" (because of "changed issue type")
When I run Psalm
Then I see these errors
| Type | Message |
| InvalidArgument | Argument 3 of Illuminate\Database\Eloquent\Builder::whereDate expects DateTimeInterface\|null\|string, but 1 provided |

Scenario: can not call whereDate with incompatible type [ Psalm 4 ]
Given I have the following code
"""
/**
* @psalm-param Builder $builder
* @psalm-return Builder
*/
function test_whereDateWithInt(Builder $builder): Builder {
return $builder->whereDate('created_at', '>', 1);
}
"""
And I have Psalm older than "5.0.0" (because of "changed issue type")
When I run Psalm
Then I see these errors
| Type | Message |
| InvalidScalarArgument | Argument 3 of Illuminate\Database\Eloquent\Builder::whereDate expects DateTimeInterface\|null\|string, but 1 provided |

Scenario: can call count on the builder instance
Given I have the following code
"""
Expand Down

0 comments on commit a5a7a22

Please sign in to comment.