@@ -41,20 +41,20 @@ public function testProcess()
41
41
42
42
public function testProcessThrowsExceptionOnInvalidReference ()
43
43
{
44
- $ this ->expectException (ServiceNotFoundException::class);
45
44
$ container = new ContainerBuilder ();
46
45
47
46
$ container
48
47
->register ('a ' , '\stdClass ' )
49
48
->addArgument (new Reference ('b ' ))
50
49
;
51
50
51
+ $ this ->expectException (ServiceNotFoundException::class);
52
+
52
53
$ this ->process ($ container );
53
54
}
54
55
55
56
public function testProcessThrowsExceptionOnInvalidReferenceFromInlinedDefinition ()
56
57
{
57
- $ this ->expectException (ServiceNotFoundException::class);
58
58
$ container = new ContainerBuilder ();
59
59
60
60
$ def = new Definition ();
@@ -65,6 +65,8 @@ public function testProcessThrowsExceptionOnInvalidReferenceFromInlinedDefinitio
65
65
->addArgument ($ def )
66
66
;
67
67
68
+ $ this ->expectException (ServiceNotFoundException::class);
69
+
68
70
$ this ->process ($ container );
69
71
}
70
72
@@ -84,34 +86,36 @@ public function testProcessDefinitionWithBindings()
84
86
85
87
public function testWithErroredServiceLocator ()
86
88
{
87
- $ this ->expectException (ServiceNotFoundException::class);
88
- $ this ->expectExceptionMessage ('The service "foo" in the container provided to "bar" has a dependency on a non-existent service "baz". ' );
89
89
$ container = new ContainerBuilder ();
90
90
91
91
ServiceLocatorTagPass::register ($ container , ['foo ' => new Reference ('baz ' )], 'bar ' );
92
92
93
93
(new AnalyzeServiceReferencesPass ())->process ($ container );
94
94
(new InlineServiceDefinitionsPass ())->process ($ container );
95
+
96
+ $ this ->expectException (ServiceNotFoundException::class);
97
+ $ this ->expectExceptionMessage ('The service "foo" in the container provided to "bar" has a dependency on a non-existent service "baz". ' );
98
+
95
99
$ this ->process ($ container );
96
100
}
97
101
98
102
public function testWithErroredHiddenService ()
99
103
{
100
- $ this ->expectException (ServiceNotFoundException::class);
101
- $ this ->expectExceptionMessage ('The service "bar" has a dependency on a non-existent service "foo". ' );
102
104
$ container = new ContainerBuilder ();
103
105
104
106
ServiceLocatorTagPass::register ($ container , ['foo ' => new Reference ('foo ' )], 'bar ' );
105
107
106
108
(new AnalyzeServiceReferencesPass ())->process ($ container );
107
109
(new InlineServiceDefinitionsPass ())->process ($ container );
110
+
111
+ $ this ->expectException (ServiceNotFoundException::class);
112
+ $ this ->expectExceptionMessage ('The service "bar" has a dependency on a non-existent service "foo". ' );
113
+
108
114
$ this ->process ($ container );
109
115
}
110
116
111
117
public function testProcessThrowsExceptionOnInvalidReferenceWithAlternatives ()
112
118
{
113
- $ this ->expectException (ServiceNotFoundException::class);
114
- $ this ->expectExceptionMessage ('The service "a" has a dependency on a non-existent service "@ccc". Did you mean this: "ccc"? ' );
115
119
$ container = new ContainerBuilder ();
116
120
117
121
$ container
@@ -121,19 +125,22 @@ public function testProcessThrowsExceptionOnInvalidReferenceWithAlternatives()
121
125
$ container
122
126
->register ('ccc ' , '\stdClass ' );
123
127
128
+ $ this ->expectException (ServiceNotFoundException::class);
129
+ $ this ->expectExceptionMessage ('The service "a" has a dependency on a non-existent service "@ccc". Did you mean this: "ccc"? ' );
130
+
124
131
$ this ->process ($ container );
125
132
}
126
133
127
134
public function testCurrentIdIsExcludedFromAlternatives ()
128
135
{
129
- $ this ->expectException (ServiceNotFoundException::class);
130
- $ this ->expectExceptionMessage ('The service "app.my_service" has a dependency on a non-existent service "app.my_service2". ' );
131
-
132
136
$ container = new ContainerBuilder ();
133
137
$ container
134
138
->register ('app.my_service ' , \stdClass::class)
135
139
->addArgument (new Reference ('app.my_service2 ' ));
136
140
141
+ $ this ->expectException (ServiceNotFoundException::class);
142
+ $ this ->expectExceptionMessage ('The service "app.my_service" has a dependency on a non-existent service "app.my_service2". ' );
143
+
137
144
$ this ->process ($ container );
138
145
}
139
146
0 commit comments