6
6
use Psalm \Exception \ConfigException ;
7
7
use Psalm \SymfonyPsalmPlugin \Symfony \ContainerMeta ;
8
8
use Psalm \SymfonyPsalmPlugin \Symfony \Service ;
9
+ use Symfony \Component \HttpKernel \Kernel ;
9
10
10
11
/**
11
12
* @testdox ContainerMetaTest
@@ -28,18 +29,64 @@ public function tearDown()
28
29
}
29
30
30
31
/**
31
- * @testdox service attributes
32
+ * @testdox service attributes for > Symfony 3
32
33
* @dataProvider publicServices
33
34
*/
34
35
public function testServices ($ id , string $ className , bool $ isPublic )
35
36
{
37
+ if (3 === Kernel::MAJOR_VERSION ) {
38
+ $ this ->markTestSkipped ('Should run for > Symfony 3 ' );
39
+ }
40
+
36
41
$ service = $ this ->containerMeta ->get ($ id );
37
42
$ this ->assertInstanceOf (Service::class, $ service );
38
43
$ this ->assertSame ($ className , $ service ->getClassName ());
39
44
$ this ->assertSame ($ isPublic , $ service ->isPublic ());
40
45
}
41
46
42
47
public function publicServices ()
48
+ {
49
+ return [
50
+ [
51
+ 'id ' => 'service_container ' ,
52
+ 'className ' => 'Symfony\Component\DependencyInjection\ContainerInterface ' ,
53
+ 'isPublic ' => true ,
54
+ ],
55
+ [
56
+ 'id ' => 'Foo\Bar ' ,
57
+ 'className ' => 'Foo\Bar ' ,
58
+ 'isPublic ' => false ,
59
+ ],
60
+ [
61
+ 'id ' => 'Symfony\Component\HttpKernel\HttpKernelInterface ' ,
62
+ 'className ' => 'Symfony\Component\HttpKernel\HttpKernel ' ,
63
+ 'isPublic ' => true ,
64
+ ],
65
+ [
66
+ 'id ' => 'public_service_wo_public_attr ' ,
67
+ 'className ' => 'Foo\Bar ' ,
68
+ 'isPublic ' => false ,
69
+ ],
70
+ ];
71
+ }
72
+
73
+ /**
74
+ * @testdox service attributes for Symfony 3
75
+ * @dataProvider publicServices3
76
+ */
77
+ public function testServices3 ($ id , string $ className , bool $ isPublic )
78
+ {
79
+ if (Kernel::MAJOR_VERSION > 3 ) {
80
+ $ this ->markTestSkipped ('Should run for Symfony 3 ' );
81
+ }
82
+
83
+ $ service = $ this ->containerMeta ->get ($ id );
84
+ $ this ->assertInstanceOf (Service::class, $ service );
85
+ $ this ->assertSame ($ className , $ service ->getClassName ());
86
+ $ this ->assertSame ($ isPublic , $ service ->isPublic ());
87
+ }
88
+
89
+ public function publicServices3 ()
43
90
{
44
91
return [
45
92
[
0 commit comments