@@ -612,31 +612,7 @@ Feature: TestCase
612
612
When I run Psalm
613
613
Then I see no errors
614
614
615
- Scenario : Provider omitting offsets is fine when test method has defaults for those params (specified as constants) [Psalm 4]
616
- Given I have the following code
617
- """
618
- class MyTestCase extends TestCase
619
- {
620
- /** @var string */
621
- const S = "s";
622
- /** @return iterable<string,array{0:int}> */
623
- public function provide() {
624
- yield "data set name" => rand(0,1) ? [1] : [1, "ss"];
625
- }
626
- /**
627
- * @return void
628
- * @dataProvider provide
629
- */
630
- public function testSomething(int $int, string $_str = self::S) {
631
- $this->assertEquals(1, $int);
632
- }
633
- }
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]
615
+ Scenario : Provider omitting offsets is fine when test method has defaults for those params (specified as constants)
640
616
Given I have the following code
641
617
"""
642
618
class MyTestCase extends TestCase
@@ -1000,7 +976,7 @@ Feature: TestCase
1000
976
Given I have the following code
1001
977
"""
1002
978
class MyTestCase extends TestCase {
1003
- /** @return iterable<string,array{float,1?:string}> */
979
+ /** @return iterable<string,array{0: float, 1?:string}> */
1004
980
public function provide() {
1005
981
yield "data set" => [1., "a"];
1006
982
}
@@ -1173,21 +1149,6 @@ Feature: TestCase
1173
1149
When I run Psalm
1174
1150
Then I see no errors
1175
1151
1176
- @ExternalProviders
1177
- Scenario : Missing external provider classes are reported
1178
- Given I have the following code
1179
- """
1180
- class MyTestCase extends TestCase {
1181
- /** @dataProvider External::provide */
1182
- public function testSomething(int $_p): void {}
1183
- }
1184
- """
1185
- When I run Psalm
1186
- Then I see these errors
1187
- | Type | Message |
1188
- | UndefinedClass | Class NS \External does not exist |
1189
-
1190
-
1191
1152
@ExternalProviders
1192
1153
Scenario : External providers are not marked as unused
1193
1154
Given I have the following code
@@ -1260,12 +1221,26 @@ Feature: TestCase
1260
1221
When I run Psalm on "test.php"
1261
1222
Then I see no errors
1262
1223
1224
+ @ExternalProviders
1225
+ Scenario : Missing external provider classes are reported
1226
+ Given I have the following code
1227
+ """
1228
+ class MyTestCase extends TestCase {
1229
+ /** @dataProvider External::provide */
1230
+ public function testSomething(int $_p): void {}
1231
+ }
1232
+ """
1233
+ When I run Psalm
1234
+ Then I see these errors
1235
+ | Type | Message |
1236
+ | UndefinedClass | Class NS \External does not exist |
1237
+
1263
1238
@List
1264
1239
Scenario : Providers returning list are ok
1265
1240
Given I have the following code
1266
1241
"""
1267
1242
class MyTestCase extends TestCase {
1268
- /** @return iterable<string, list<int>> */
1243
+ /** @return iterable<string, non-empty- list<int>> */
1269
1244
public function provide(): iterable {
1270
1245
yield "dataset name" => [1];
1271
1246
}
@@ -1281,7 +1256,7 @@ Feature: TestCase
1281
1256
Given I have the following code
1282
1257
"""
1283
1258
class MyTestCase extends TestCase {
1284
- /** @return iterable<string, list<string>> */
1259
+ /** @return iterable<string, non-empty- list<string>> */
1285
1260
public function provide(): iterable {
1286
1261
yield "dataset name" => ["1"];
1287
1262
}
@@ -1292,7 +1267,7 @@ Feature: TestCase
1292
1267
When I run Psalm
1293
1268
Then I see these errors
1294
1269
| Type | Message |
1295
- | InvalidArgument | Argument 1 of NS \MyTestCase ::testSomething expects int , string provided by NS \MyTestCase ::provide ():(iterable <string , list <string >>) |
1270
+ | InvalidArgument | Argument 1 of NS \MyTestCase ::testSomething expects int , string provided by NS \MyTestCase ::provide ():(iterable <string , non - empty - list <string >>) |
1296
1271
1297
1272
Scenario : Providers returning nullable generator are ok
1298
1273
Given I have the following code
0 commit comments