Skip to content

Commit

Permalink
[console] add tests for suggested values
Browse files Browse the repository at this point in the history
  • Loading branch information
seferov committed Jun 19, 2024
1 parent 58e1092 commit 10e59e1
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/acceptance/acceptance/console/ConsoleArgument.feature
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,33 @@ Feature: ConsoleArgument
| Type | Message |
| Trace | $arg: null\|string |
And I see no other errors

Scenario: Use suggested values for argument
Given I have the following code
"""
class MyCommand extends Command
{
public function configure(): void
{
$this->addArgument(
'format',
InputArgument::OPTIONAL,
'The format to use',
null,
[
'pdf',
'excel',
'csv',
],
);
}
public function execute(InputInterface $input, OutputInterface $output): int
{
return self::SUCCESS;
}
}
"""
When I run Psalm
Then I see no errors

30 changes: 30 additions & 0 deletions tests/acceptance/acceptance/console/ConsoleOption.feature
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,33 @@ Feature: ConsoleOption
| MixedAssignment | Unable to determine the type that $option is being assigned to |
| Trace | $option: mixed |
And I see no other errors

Scenario: Using suggested values for option
Given I have the following code
"""
class MyCommand extends Command
{
public function configure(): void
{
$this->addOption(
'format',
null,
InputOption::VALUE_OPTIONAL,
'The format to use',
null,
[
'pdf',
'excel',
'csv',
],
);
}
public function execute(InputInterface $input, OutputInterface $output): int
{
return self::SUCCESS;
}
}
"""
When I run Psalm
Then I see no errors

0 comments on commit 10e59e1

Please sign in to comment.