psalm-plugin-laravel/tests/acceptance/PathHelpers.feature
Martin Zurowietz f6193ad5cb Replace deprecated totallyTyped attribute
totallyTyped was deprecated in Psalm v4.21.0 [1].

totallyTyped="true" is equivalent to errorLevel="1" and
totallyTyped="false" is equivalent to errorLevel="2" plus
reportMixedIssues="false" [2].

[1] https://github.com/vimeo/psalm/releases/tag/4.21.0
[2] https://psalm.dev/docs/running_psalm/configuration/#totallytyped
2022-02-21 10:15:13 +01:00

159 lines
4.5 KiB
Gherkin

Feature: Path helpers
The global path helpers will return the correct path
Background:
Given I have the following config
"""
<?xml version="1.0"?>
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
</plugins>
</psalm>
"""
And I have the following code preamble
"""
<?php declare(strict_types=1);
"""
Scenario: base path can be resolved
Given I have the following code
"""
require_once base_path('routes/console.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: basePath can be resolved from application instance
Given I have the following code
"""
require_once app()->basePath('routes/console.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: app path can be resolved
Given I have the following code
"""
require_once app_path('model.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: path can be resolved from application instance
Given I have the following code
"""
require_once app()->path('model.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: config path can be resolved
Given I have the following code
"""
require_once config_path('file.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: path can be resolved from application instance
Given I have the following code
"""
require_once app()->configPath('file.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: database path can be resolved
Given I have the following code
"""
require_once database_path('migration.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: databasePath can be resolved from application instance
Given I have the following code
"""
require_once app()->databasePath('migration.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: public path can be resolved
Given I have the following code
"""
require_once public_path('file.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: public path can be resolved from application instance
Given I have the following code
"""
require_once app()->make('path.public');
"""
When I run Psalm
Then I see no errors
Scenario: resource path can be resolved
Given I have the following code
"""
require_once resource_path('file.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: resource path can be resolved from application instance
Given I have the following code
"""
require_once app()->resourcePath('file.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: storage path can be resolved
Given I have the following code
"""
require_once storage_path('file.php');
"""
When I run Psalm
Then I see these errors
| Type | Message |
| MissingFile | Cannot find file |
Scenario: storage path can be resolved from application instance
Given I have the following code
"""
require_once app()->make('path.storage');
"""
When I run Psalm
Then I see no errors