Skip to content

Commit

Permalink
Merge pull request #533 from kamil-tekiela/Native-param-types-in-tests
Browse files Browse the repository at this point in the history
Add native param types in tests
  • Loading branch information
MauricioFauth authored Jan 16, 2024
2 parents b05c846 + 1a27fbc commit be871d1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/Components/GroupKeywordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function provideExpressions(): Generator

/** @param GroupKeyword|array<GroupKeyword> $component */
#[DataProvider('provideExpressions')]
public function testBuild($component, string $expected): void
public function testBuild(GroupKeyword|array $component, string $expected): void
{
if (is_array($component)) {
$this->assertSame($expected, GroupKeyword::buildAll($component));
Expand Down
3 changes: 1 addition & 2 deletions tests/Lexer/ContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ public function testLoadError(): void
$this->assertFalse(Context::load('Foo'));
}

/** @param int|string $mode */
#[DataProvider('providerForTestMode')]
public function testMode($mode, int $expected): void
public function testMode(int|string $mode, int $expected): void
{
Context::setMode($mode);
$this->assertSame($expected, Context::getMode());
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getTokensList(string $query): TokensList
* : list<array{string, Token|null, int}>
* )
*/
public function getErrorsAsArray($obj): array
public function getErrorsAsArray(Lexer|Parser $obj): array
{
$ret = [];
if ($obj instanceof Lexer) {
Expand Down
12 changes: 6 additions & 6 deletions tests/Utils/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testGetopt(): void

/** @param array<string, bool|string>|false $getopt */
#[DataProvider('highlightParamsProvider')]
public function testRunHighlight($getopt, string $output, int $result): void
public function testRunHighlight(array|false $getopt, string $output, int $result): void
{
$cli = $this->getCLI($getopt);
$this->expectOutputString($output);
Expand Down Expand Up @@ -122,7 +122,7 @@ public static function highlightParamsProvider(): array

/** @param array<string, bool|string>|false $getopt */
#[DataProvider('highlightParamsStdInProvider')]
public function testRunHighlightStdIn(string $input, $getopt, string $output, int $result): void
public function testRunHighlightStdIn(string $input, array|false $getopt, string $output, int $result): void
{
$cli = $this->getCLIStdIn($input, $getopt);
$this->expectOutputString($output);
Expand Down Expand Up @@ -187,7 +187,7 @@ public static function highlightParamsStdInProvider(): array

/** @param array<string, bool|string>|false $getopt */
#[DataProvider('lintParamsStdInProvider')]
public function testRunLintFromStdIn(string $input, $getopt, string $output, int $result): void
public function testRunLintFromStdIn(string $input, array|false $getopt, string $output, int $result): void
{
$cli = $this->getCLIStdIn($input, $getopt);
$this->expectOutputString($output);
Expand Down Expand Up @@ -249,7 +249,7 @@ public static function lintParamsStdInProvider(): array

/** @param array<string, bool|string>|false $getopt */
#[DataProvider('lintParamsProvider')]
public function testRunLint($getopt, string $output, int $result): void
public function testRunLint(array|false $getopt, string $output, int $result): void
{
$cli = $this->getCLI($getopt);
$this->expectOutputString($output);
Expand Down Expand Up @@ -313,7 +313,7 @@ public static function lintParamsProvider(): array

/** @param array<string, bool|string>|false $getopt */
#[DataProvider('tokenizeParamsProvider')]
public function testRunTokenize($getopt, string $output, int $result): void
public function testRunTokenize(array|false $getopt, string $output, int $result): void
{
$cli = $this->getCLI($getopt);
$this->expectOutputString($output);
Expand Down Expand Up @@ -365,7 +365,7 @@ public static function tokenizeParamsProvider(): array

/** @param array<string, bool|string>|false $getopt */
#[DataProvider('tokenizeParamsStdInProvider')]
public function testRunTokenizeStdIn(string $input, $getopt, string $output, int $result): void
public function testRunTokenizeStdIn(string $input, array|false $getopt, string $output, int $result): void
{
$cli = $this->getCLIStdIn($input, $getopt);
$this->expectOutputString($output);
Expand Down

0 comments on commit be871d1

Please sign in to comment.