mirror of
https://github.com/danog/psalm-plugin-phpunit.git
synced 2024-11-27 12:35:02 +01:00
Fixed easiest build failures
- Syntax error in Acceptance helper - Adjust expected output to match newer Psalm version (and use wildcards where possible)
This commit is contained in:
parent
d2e2c43aa1
commit
471fa67623
@ -31,7 +31,7 @@ class Acceptance extends \Codeception\Module
|
|||||||
|
|
||||||
$op = (string) self::VERSION_OPERATORS[$operator];
|
$op = (string) self::VERSION_OPERATORS[$operator];
|
||||||
|
|
||||||
$currentVersion = (string) explode('@', Versions::getVersion('phpunit/phpunit')[0];
|
$currentVersion = (string) explode('@', Versions::getVersion('phpunit/phpunit'))[0];
|
||||||
$this->debug(sprintf("Current version: %s", $currentVersion));
|
$this->debug(sprintf("Current version: %s", $currentVersion));
|
||||||
|
|
||||||
$parser = new VersionParser();
|
$parser = new VersionParser();
|
||||||
|
@ -40,6 +40,7 @@ Feature: Assert (PHPUnit 7.5+)
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see no errors
|
Then I see no errors
|
||||||
|
|
||||||
|
@gg
|
||||||
Scenario: Assert::assertIsBool()
|
Scenario: Assert::assertIsBool()
|
||||||
Given I have the following code
|
Given I have the following code
|
||||||
"""
|
"""
|
||||||
@ -47,7 +48,7 @@ Feature: Assert (PHPUnit 7.5+)
|
|||||||
$b = mixed();
|
$b = mixed();
|
||||||
|
|
||||||
Assert::assertIsBool($b);
|
Assert::assertIsBool($b);
|
||||||
microtime($b);
|
class_exists(Assert::class, $b);
|
||||||
"""
|
"""
|
||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see no errors
|
Then I see no errors
|
||||||
|
@ -40,7 +40,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidArgument | Argument 1 of PHPUnit\Framework\TestCase::expectException expects class-string<Throwable>, NS\MyTestCase::class provided |
|
| InvalidArgument | Argument 1 of NS\MyTestCase::expectexception expects class-string<Throwable>, NS\MyTestCase::class provided |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: TestCase::expectException() accepts throwables
|
Scenario: TestCase::expectException() accepts throwables
|
||||||
@ -190,7 +190,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidReturnType | Providers must return iterable<int\|string, array<array-key, mixed>>, iterable<int, int> provided |
|
| InvalidReturnType | Providers must return iterable<array-key, array%>, iterable<int, int> provided |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Valid iterable data provider is allowed
|
Scenario: Valid iterable data provider is allowed
|
||||||
@ -235,7 +235,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidReturnType | Providers must return iterable<int\|string, array<array-key, mixed>>, Generator<int, int, mixed, void> provided |
|
| InvalidReturnType | Providers must return iterable<array-key, array%>, Generator<int, int, mixed, void> provided |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Valid generator data provider is allowed
|
Scenario: Valid generator data provider is allowed
|
||||||
@ -280,7 +280,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidReturnType | Providers must return iterable<int\|string, array<array-key, mixed>>, array<int, int> provided |
|
| InvalidReturnType | Providers must return iterable<array-key, array%>, array<int, int> provided |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Underspecified array data provider is reported
|
Scenario: Underspecified array data provider is reported
|
||||||
@ -422,7 +422,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string provided by NS\MyTestCase::provide():(iterable<string, array{0:string}>) |
|
| InvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string provided by NS\MyTestCase::provide():(iterable<string, array%>) |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Invalid dataset array is reported
|
Scenario: Invalid dataset array is reported
|
||||||
@ -446,7 +446,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| PossiblyInvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string\|int provided by NS\MyTestCase::provide():(iterable<string, array<int, string\|int>>) |
|
| PossiblyInvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string\|int provided by NS\MyTestCase::provide():(iterable<string, array%>) |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Shape dataset with missing params is reported
|
Scenario: Shape dataset with missing params is reported
|
||||||
@ -470,7 +470,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| TooFewArguments | Too few arguments for NS\MyTestCase::testSomething - expecting at least 2, but saw 1 provided by NS\MyTestCase::provide():(iterable<string, array{0:int}>) |
|
| TooFewArguments | Too few arguments for NS\MyTestCase::testSomething - expecting at least 2, but saw 1 provided by NS\MyTestCase::provide():(iterable<string, %>) |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Referenced providers are not marked as unused
|
Scenario: Referenced providers are not marked as unused
|
||||||
@ -514,7 +514,7 @@ Feature: TestCase
|
|||||||
When I run Psalm with dead code detection
|
When I run Psalm with dead code detection
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| PossiblyUnusedMethod | Cannot find public calls to method NS\MyTestCase::provide |
|
| PossiblyUnusedMethod | Cannot find any calls to method NS\MyTestCase::provide |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Test method are never marked as unused
|
Scenario: Test method are never marked as unused
|
||||||
@ -556,7 +556,7 @@ Feature: TestCase
|
|||||||
When I run Psalm with dead code detection
|
When I run Psalm with dead code detection
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| PossiblyUnusedMethod | Cannot find public calls to method NS\MyTestCase::somethingElse |
|
| PossiblyUnusedMethod | Cannot find any calls to method NS\MyTestCase::somethingElse |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Unreferenced TestCase descendants are never marked as unused
|
Scenario: Unreferenced TestCase descendants are never marked as unused
|
||||||
@ -670,7 +670,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string provided by NS\MyTestCase::provide():(iterable<string, array{0?:string}>) |
|
| InvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string provided by NS\MyTestCase::provide():(iterable<string, array%>) |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Provider returning possibly undefined offset is marked when test method has no default for that param
|
Scenario: Provider returning possibly undefined offset is marked when test method has no default for that param
|
||||||
@ -694,7 +694,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidArgument | Argument 1 of NS\MyTestCase::testSomething has no default value, but possibly undefined int provided by NS\MyTestCase::provide():(iterable<string, array{0?:int}>) |
|
| InvalidArgument | Argument 1 of NS\MyTestCase::testSomething has no default value, but possibly undefined int provided by NS\MyTestCase::provide():(iterable<string, array%>) |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Stateful grandchild test case with setUp produces no MissingConstructor
|
Scenario: Stateful grandchild test case with setUp produces no MissingConstructor
|
||||||
@ -901,7 +901,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| InvalidArgument | Argument 1 of NS\MyTestTrait::testSomething expects string, int provided by NS\MyTestTrait::provide():(iterable<int, array<array-key, int>>) |
|
| InvalidArgument | Argument 1 of NS\MyTestTrait::testSomething expects string, int provided by NS\MyTestTrait::provide():(iterable<int, array%>) |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Providers may omit variadic part for variadic tests
|
Scenario: Providers may omit variadic part for variadic tests
|
||||||
@ -914,6 +914,7 @@ Feature: TestCase
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @dataProvider provide
|
* @dataProvider provide
|
||||||
|
* @param int ...$rest
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSomething(int $i, ...$rest) {}
|
public function testSomething(int $i, ...$rest) {}
|
||||||
@ -922,7 +923,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see no errors
|
Then I see no errors
|
||||||
|
|
||||||
Scenario: Providers may omit non-varidic params with default for variadic tests
|
Scenario: Providers may omit non-variadic params with default for variadic tests
|
||||||
Given I have the following code
|
Given I have the following code
|
||||||
"""
|
"""
|
||||||
class MyTestCase extends TestCase {
|
class MyTestCase extends TestCase {
|
||||||
@ -932,6 +933,7 @@ Feature: TestCase
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @dataProvider provide
|
* @dataProvider provide
|
||||||
|
* @param int ...$rest
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSomething(int $i, string $s = "", ...$rest) {}
|
public function testSomething(int $i, string $s = "", ...$rest) {}
|
||||||
@ -940,7 +942,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see no errors
|
Then I see no errors
|
||||||
|
|
||||||
Scenario: Providers may not omit non-varidic params with no default for variadic tests
|
Scenario: Providers may not omit non-variadic params with no default for variadic tests
|
||||||
Given I have the following code
|
Given I have the following code
|
||||||
"""
|
"""
|
||||||
class MyTestCase extends TestCase {
|
class MyTestCase extends TestCase {
|
||||||
@ -950,6 +952,7 @@ Feature: TestCase
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @dataProvider provide
|
* @dataProvider provide
|
||||||
|
* @param int ...$rest
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSomething(int $i, string $s, ...$rest) {}
|
public function testSomething(int $i, string $s, ...$rest) {}
|
||||||
@ -958,7 +961,7 @@ Feature: TestCase
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see these errors
|
Then I see these errors
|
||||||
| Type | Message |
|
| Type | Message |
|
||||||
| TooFewArguments | Too few arguments for NS\MyTestCase::testSomething - expecting at least 2, but saw 1 provided by NS\MyTestCase::provide():(iterable<string, array{0:int}>) |
|
| TooFewArguments | Too few arguments for NS\MyTestCase::testSomething - expecting at least 2, but saw 1 provided by NS\MyTestCase::provide():(iterable<string, array%>) |
|
||||||
And I see no other errors
|
And I see no other errors
|
||||||
|
|
||||||
Scenario: Providers generating incompatible datasets for variadic tests are reported
|
Scenario: Providers generating incompatible datasets for variadic tests are reported
|
||||||
|
Loading…
Reference in New Issue
Block a user