@@ -12,45 +12,57 @@ final class ServiceDynamicReturnTypeExtensionTest extends ExtensionTestCase
12
12
/**
13
13
* @dataProvider servicesProvider
14
14
*/
15
- public function testServices (string $ expression , string $ type ): void
15
+ public function testServices (string $ expression , string $ type, ? string $ container ): void
16
16
{
17
17
$ this ->processFile (
18
18
__DIR__ . '/ExampleController.php ' ,
19
19
$ expression ,
20
20
$ type ,
21
- new ServiceDynamicReturnTypeExtension (Controller::class, true , (new XmlServiceMapFactory (__DIR__ . ' / container.xml ' ))->create ())
21
+ new ServiceDynamicReturnTypeExtension (Controller::class, true , (new XmlServiceMapFactory ($ container ))->create ())
22
22
);
23
23
}
24
24
25
25
public function servicesProvider (): Iterator
26
26
{
27
- yield ['$service1 ' , 'Foo ' ];
28
- yield ['$service2 ' , 'object ' ];
29
- yield ['$service3 ' , 'object ' ];
30
- yield ['$service4 ' , 'object ' ];
31
- yield ['$has1 ' , 'true ' ];
32
- yield ['$has2 ' , 'false ' ];
33
- yield ['$has3 ' , 'bool ' ];
34
- yield ['$has4 ' , 'bool ' ];
27
+ yield ['$service1 ' , 'Foo ' , __DIR__ . '/container.xml ' ];
28
+ yield ['$service2 ' , 'object ' , __DIR__ . '/container.xml ' ];
29
+ yield ['$service3 ' , 'object ' , __DIR__ . '/container.xml ' ];
30
+ yield ['$service4 ' , 'object ' , __DIR__ . '/container.xml ' ];
31
+ yield ['$has1 ' , 'true ' , __DIR__ . '/container.xml ' ];
32
+ yield ['$has2 ' , 'false ' , __DIR__ . '/container.xml ' ];
33
+ yield ['$has3 ' , 'bool ' , __DIR__ . '/container.xml ' ];
34
+ yield ['$has4 ' , 'bool ' , __DIR__ . '/container.xml ' ];
35
+
36
+ yield ['$service1 ' , 'object ' , null ];
37
+ yield ['$service2 ' , 'object ' , null ];
38
+ yield ['$service3 ' , 'object ' , null ];
39
+ yield ['$service4 ' , 'object ' , null ];
40
+ yield ['$has1 ' , 'bool ' , null ];
41
+ yield ['$has2 ' , 'bool ' , null ];
42
+ yield ['$has3 ' , 'bool ' , null ];
43
+ yield ['$has4 ' , 'bool ' , null ];
35
44
}
36
45
37
46
/**
38
47
* @dataProvider constantHassersOffProvider
39
48
*/
40
- public function testConstantHassersOff (string $ expression , string $ type ): void
49
+ public function testConstantHassersOff (string $ expression , string $ type, ? string $ container ): void
41
50
{
42
51
$ this ->processFile (
43
52
__DIR__ . '/ExampleController.php ' ,
44
53
$ expression ,
45
54
$ type ,
46
- new ServiceDynamicReturnTypeExtension (Controller::class, false , (new XmlServiceMapFactory (__DIR__ . ' / container.xml ' ))->create ())
55
+ new ServiceDynamicReturnTypeExtension (Controller::class, false , (new XmlServiceMapFactory ($ container ))->create ())
47
56
);
48
57
}
49
58
50
59
public function constantHassersOffProvider (): Iterator
51
60
{
52
- yield ['$has1 ' , 'bool ' ];
53
- yield ['$has2 ' , 'bool ' ];
61
+ yield ['$has1 ' , 'bool ' , __DIR__ . '/container.xml ' ];
62
+ yield ['$has2 ' , 'bool ' , __DIR__ . '/container.xml ' ];
63
+
64
+ yield ['$has1 ' , 'bool ' , null ];
65
+ yield ['$has2 ' , 'bool ' , null ];
54
66
}
55
67
56
68
}
0 commit comments