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:
Bruce Weirdan 2019-06-30 00:00:39 +03:00
parent d2e2c43aa1
commit 471fa67623
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D
3 changed files with 33 additions and 29 deletions

View File

@ -31,7 +31,7 @@ class Acceptance extends \Codeception\Module
$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));
$parser = new VersionParser();

View File

@ -40,6 +40,7 @@ Feature: Assert (PHPUnit 7.5+)
When I run Psalm
Then I see no errors
@gg
Scenario: Assert::assertIsBool()
Given I have the following code
"""
@ -47,7 +48,7 @@ Feature: Assert (PHPUnit 7.5+)
$b = mixed();
Assert::assertIsBool($b);
microtime($b);
class_exists(Assert::class, $b);
"""
When I run Psalm
Then I see no errors

View File

@ -40,7 +40,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: TestCase::expectException() accepts throwables
@ -190,7 +190,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Valid iterable data provider is allowed
@ -235,7 +235,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Valid generator data provider is allowed
@ -280,7 +280,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Underspecified array data provider is reported
@ -422,7 +422,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Invalid dataset array is reported
@ -446,7 +446,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Shape dataset with missing params is reported
@ -470,7 +470,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Referenced providers are not marked as unused
@ -514,7 +514,7 @@ Feature: TestCase
When I run Psalm with dead code detection
Then I see these errors
| 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
Scenario: Test method are never marked as unused
@ -556,7 +556,7 @@ Feature: TestCase
When I run Psalm with dead code detection
Then I see these errors
| 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
Scenario: Unreferenced TestCase descendants are never marked as unused
@ -670,7 +670,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
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
Then I see these errors
| 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
Scenario: Stateful grandchild test case with setUp produces no MissingConstructor
@ -901,7 +901,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Providers may omit variadic part for variadic tests
@ -914,6 +914,7 @@ Feature: TestCase
}
/**
* @dataProvider provide
* @param int ...$rest
* @return void
*/
public function testSomething(int $i, ...$rest) {}
@ -922,7 +923,7 @@ Feature: TestCase
When I run Psalm
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
"""
class MyTestCase extends TestCase {
@ -932,6 +933,7 @@ Feature: TestCase
}
/**
* @dataProvider provide
* @param int ...$rest
* @return void
*/
public function testSomething(int $i, string $s = "", ...$rest) {}
@ -940,7 +942,7 @@ Feature: TestCase
When I run Psalm
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
"""
class MyTestCase extends TestCase {
@ -950,6 +952,7 @@ Feature: TestCase
}
/**
* @dataProvider provide
* @param int ...$rest
* @return void
*/
public function testSomething(int $i, string $s, ...$rest) {}
@ -958,7 +961,7 @@ Feature: TestCase
When I run Psalm
Then I see these errors
| 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
Scenario: Providers generating incompatible datasets for variadic tests are reported