@@ -15,6 +15,13 @@ Feature: TestCase
15
15
<plugins>
16
16
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
17
17
</plugins>
18
+ <issueHandlers>
19
+ <DeprecatedMethod>
20
+ <errorLevel type="suppress">
21
+ <referencedMethod name="PhpUnit\Framework\TestCase::prophesize"/>
22
+ </errorLevel>
23
+ </DeprecatedMethod>
24
+ </issueHandlers>
18
25
</psalm>
19
26
"""
20
27
And I have the following code preamble
@@ -38,8 +45,8 @@ Feature: TestCase
38
45
"""
39
46
When I run Psalm
40
47
Then I see these errors
41
- | Type | Message |
42
- | InvalidArgument | Argument 1 of NS \MyTestCase ::expectException expects class -string <Throwable >, NS \MyTestCase ::class provided |
48
+ | Type | Message |
49
+ | InvalidArgument | / Argument 1 of NS \\ MyTestCase ::expectException expects class -string <Throwable >, ( but )? NS \\ MyTestCase ::class provided / |
43
50
And I see no other errors
44
51
45
52
Scenario : TestCase::expectException() accepts throwables
@@ -421,8 +428,8 @@ Feature: TestCase
421
428
"""
422
429
When I run Psalm
423
430
Then I see these errors
424
- | Type | Message |
425
- | InvalidArgument | /Argument 1 of NS \\MyTestCase ::testSomething expects int , string provided by NS \\MyTestCase ::provide \(\):\(iterable <string , array \{(0 : )?string \}>\)/ |
431
+ | Type | Message |
432
+ | InvalidArgument | /Argument 1 of NS \\MyTestCase ::testSomething expects int , string provided by NS \\MyTestCase ::provide \(\):\(iterable <string , ( array \{(0 : )?string \}\| list \{ string \}) >\)/ |
426
433
And I see no other errors
427
434
428
435
Scenario : Invalid dataset array is reported
@@ -469,8 +476,8 @@ Feature: TestCase
469
476
"""
470
477
When I run Psalm
471
478
Then I see these errors
472
- | Type | Message |
473
- | 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 \}>\)/ |
479
+ | Type | Message |
480
+ | 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 \}\| list \{ int \}) >\)/ |
474
481
And I see no other errors
475
482
476
483
Scenario : Referenced providers are not marked as unused
@@ -605,7 +612,7 @@ Feature: TestCase
605
612
When I run Psalm
606
613
Then I see no errors
607
614
608
- Scenario : Provider omitting offsets is fine when test method has defaults for those params (specified as constants)
615
+ Scenario : Provider omitting offsets is fine when test method has defaults for those params (specified as constants) [Psalm 4]
609
616
Given I have the following code
610
617
"""
611
618
class MyTestCase extends TestCase
@@ -625,6 +632,31 @@ Feature: TestCase
625
632
}
626
633
}
627
634
"""
635
+ And I have Psalm older than "5.0" (because of "sealed shapes" )
636
+ When I run Psalm
637
+ Then I see no errors
638
+
639
+ Scenario : Provider omitting offsets is fine when test method has defaults for those params (specified as constants) [Psalm 5]
640
+ Given I have the following code
641
+ """
642
+ class MyTestCase extends TestCase
643
+ {
644
+ /** @var string */
645
+ const S = "s";
646
+ /** @return iterable<string,list{int,...}> */
647
+ public function provide() {
648
+ yield "data set name" => rand(0,1) ? [1] : [1, "ss"];
649
+ }
650
+ /**
651
+ * @return void
652
+ * @dataProvider provide
653
+ */
654
+ public function testSomething(int $int, string $_str = self::S) {
655
+ $this->assertEquals(1, $int);
656
+ }
657
+ }
658
+ """
659
+ And I have Psalm newer than "4.99" (because of "sealed shapes" )
628
660
When I run Psalm
629
661
Then I see no errors
630
662
@@ -960,8 +992,8 @@ Feature: TestCase
960
992
"""
961
993
When I run Psalm
962
994
Then I see these errors
963
- | Type | Message |
964
- | 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 \}>\)/ |
995
+ | Type | Message |
996
+ | 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 \}\| list \{ int \}) >\)/ |
965
997
And I see no other errors
966
998
967
999
Scenario : Providers generating incompatible datasets for variadic tests are reported
0 commit comments