@@ -30,6 +30,9 @@ protected function setUp(): void
30
30
$ this ->evm = new ContainerAwareEventManager ($ this ->container );
31
31
}
32
32
33
+ /**
34
+ * @group legacy
35
+ */
33
36
public function testDispatchEventRespectOrder ()
34
37
{
35
38
$ this ->evm = new ContainerAwareEventManager ($ this ->container , ['sub1 ' , [['foo ' ], 'list1 ' ], 'sub2 ' ]);
@@ -38,9 +41,14 @@ public function testDispatchEventRespectOrder()
38
41
$ this ->container ->set ('sub1 ' , $ subscriber1 = new MySubscriber (['foo ' ]));
39
42
$ this ->container ->set ('sub2 ' , $ subscriber2 = new MySubscriber (['foo ' ]));
40
43
44
+ $ this ->expectDeprecation ('Since symfony/doctrine-bridge 6.3: Passing subscribers is deprecated, use listeners instead ' );
45
+
41
46
$ this ->assertSame ([$ subscriber1 , $ listener1 , $ subscriber2 ], array_values ($ this ->evm ->getListeners ('foo ' )));
42
47
}
43
48
49
+ /**
50
+ * @group legacy
51
+ */
44
52
public function testDispatchEvent ()
45
53
{
46
54
$ this ->evm = new ContainerAwareEventManager ($ this ->container , ['lazy4 ' ]);
@@ -57,6 +65,7 @@ public function testDispatchEvent()
57
65
$ this ->container ->set ('lazy3 ' , $ listener5 = new MyListener ());
58
66
$ this ->evm ->addEventListener ('foo ' , $ listener5 = new MyListener ());
59
67
$ this ->evm ->addEventListener ('bar ' , $ listener5 );
68
+
60
69
$ this ->evm ->addEventSubscriber ($ subscriber2 = new MySubscriber (['bar ' ]));
61
70
62
71
$ this ->assertSame (1 , $ subscriber2 ->calledSubscribedEventsCount );
@@ -83,6 +92,9 @@ public function testDispatchEvent()
83
92
$ this ->assertSame (0 , $ subscriber2 ->calledByEventNameCount );
84
93
}
85
94
95
+ /**
96
+ * @group legacy
97
+ */
86
98
public function testAddEventListenerAndSubscriberAfterDispatchEvent ()
87
99
{
88
100
$ this ->evm = new ContainerAwareEventManager ($ this ->container , ['lazy7 ' ]);
@@ -101,6 +113,7 @@ public function testAddEventListenerAndSubscriberAfterDispatchEvent()
101
113
$ this ->container ->set ('lazy3 ' , $ listener5 = new MyListener ());
102
114
$ this ->evm ->addEventListener ('foo ' , $ listener5 = new MyListener ());
103
115
$ this ->evm ->addEventListener ('bar ' , $ listener5 );
116
+
104
117
$ this ->evm ->addEventSubscriber ($ subscriber2 = new MySubscriber (['bar ' ]));
105
118
106
119
$ this ->assertSame (1 , $ subscriber2 ->calledSubscribedEventsCount );
@@ -120,6 +133,7 @@ public function testAddEventListenerAndSubscriberAfterDispatchEvent()
120
133
$ this ->container ->set ('lazy6 ' , $ listener10 = new MyListener ());
121
134
$ this ->evm ->addEventListener ('foo ' , $ listener10 = new MyListener ());
122
135
$ this ->evm ->addEventListener ('bar ' , $ listener10 );
136
+
123
137
$ this ->evm ->addEventSubscriber ($ subscriber3 = new MySubscriber (['bar ' ]));
124
138
125
139
$ this ->assertSame (1 , $ subscriber1 ->calledSubscribedEventsCount );
@@ -162,12 +176,17 @@ public function testAddEventListenerAndSubscriberAfterDispatchEvent()
162
176
$ this ->assertSame (0 , $ subscriber3 ->calledByEventNameCount );
163
177
}
164
178
179
+ /**
180
+ * @group legacy
181
+ */
165
182
public function testGetListenersForEvent ()
166
183
{
167
184
$ this ->evm = new ContainerAwareEventManager ($ this ->container , ['lazy2 ' ]);
168
185
169
186
$ this ->container ->set ('lazy ' , $ listener1 = new MyListener ());
170
187
$ this ->container ->set ('lazy2 ' , $ subscriber1 = new MySubscriber (['foo ' ]));
188
+
189
+ $ this ->expectDeprecation ('Since symfony/doctrine-bridge 6.3: Passing subscribers is deprecated, use listeners instead ' );
171
190
$ this ->evm ->addEventListener ('foo ' , 'lazy ' );
172
191
$ this ->evm ->addEventListener ('foo ' , $ listener2 = new MyListener ());
173
192
@@ -191,6 +210,7 @@ public function testGetListeners()
191
210
public function testGetAllListeners ()
192
211
{
193
212
$ this ->container ->set ('lazy ' , $ listener1 = new MyListener ());
213
+
194
214
$ this ->evm ->addEventListener ('foo ' , 'lazy ' );
195
215
$ this ->evm ->addEventListener ('foo ' , $ listener2 = new MyListener ());
196
216
@@ -200,6 +220,7 @@ public function testGetAllListeners()
200
220
public function testRemoveEventListener ()
201
221
{
202
222
$ this ->container ->set ('lazy ' , $ listener1 = new MyListener ());
223
+
203
224
$ this ->evm ->addEventListener ('foo ' , 'lazy ' );
204
225
$ this ->evm ->addEventListener ('foo ' , $ listener2 = new MyListener ());
205
226
@@ -213,6 +234,7 @@ public function testRemoveEventListener()
213
234
public function testRemoveEventListenerAfterDispatchEvent ()
214
235
{
215
236
$ this ->container ->set ('lazy ' , $ listener1 = new MyListener ());
237
+
216
238
$ this ->evm ->addEventListener ('foo ' , 'lazy ' );
217
239
$ this ->evm ->addEventListener ('foo ' , $ listener2 = new MyListener ());
218
240
0 commit comments