@@ 149-159 (lines=11) @@ | ||
146 | * @expectedException RuntimeException |
|
147 | * @expectedExceptionMessage Each tag named "jms_serializer.handler" of service "my_service" must have at least two attributes: "type" and "format" |
|
148 | */ |
|
149 | public function testHandlerMustHaveTypeAndFormat() |
|
150 | { |
|
151 | $container = $this->getContainer(); |
|
152 | ||
153 | $def = new Definition('Foo'); |
|
154 | $def->addTag('jms_serializer.handler'); |
|
155 | $container->setDefinition('my_service', $def); |
|
156 | ||
157 | $pass = new CustomHandlersPass(); |
|
158 | $pass->process($container); |
|
159 | } |
|
160 | ||
161 | public function testSubscribingHandler() |
|
162 | { |
|
@@ 202-212 (lines=11) @@ | ||
199 | * @expectedException RuntimeException |
|
200 | * @expectedExceptionMessage The service "my_service" must implement the SubscribingHandlerInterface |
|
201 | */ |
|
202 | public function testSubscribingHandlerInterface() |
|
203 | { |
|
204 | $container = $this->getContainer(); |
|
205 | ||
206 | $def = new Definition('JMS\SerializerBundle\Tests\DependencyInjection\Fixture\SimpleObject'); |
|
207 | $def->addTag('jms_serializer.subscribing_handler'); |
|
208 | $container->setDefinition('my_service', $def); |
|
209 | ||
210 | $pass = new CustomHandlersPass(); |
|
211 | $pass->process($container); |
|
212 | } |
|
213 | } |
|
214 |
@@ 63-76 (lines=14) @@ | ||
60 | * @expectedException RuntimeException |
|
61 | * @expectedExceptionMessage The tag "jms_serializer.event_listener" of service "my_listener" requires an attribute named "event". |
|
62 | */ |
|
63 | public function testEventListenerMustHaveEventDefined() |
|
64 | { |
|
65 | $container = $this->getContainer(); |
|
66 | ||
67 | $def = new Definition('Foo'); |
|
68 | $def->addTag('jms_serializer.event_listener', [ |
|
69 | 'class' => 'Bar', |
|
70 | ]); |
|
71 | ||
72 | $container->setDefinition('my_listener', $def); |
|
73 | ||
74 | $pass = new RegisterEventListenersAndSubscribersPass(); |
|
75 | $pass->process($container); |
|
76 | } |
|
77 | ||
78 | public function testEventListenerCanBePrivate() |
|
79 | { |
|
@@ 231-242 (lines=12) @@ | ||
228 | * @expectedException RuntimeException |
|
229 | * @expectedExceptionMessage The service "my_listener" (class: JMS\SerializerBundle\Tests\DependencyInjection\Fixture\VersionedObject) does not implement the EventSubscriberInterface. |
|
230 | */ |
|
231 | public function testEventSubscriberInterface() |
|
232 | { |
|
233 | $container = $this->getContainer(); |
|
234 | ||
235 | $def = new Definition('JMS\SerializerBundle\Tests\DependencyInjection\Fixture\VersionedObject'); |
|
236 | $def->addTag('jms_serializer.event_subscriber'); |
|
237 | ||
238 | $container->setDefinition('my_listener', $def); |
|
239 | ||
240 | $pass = new RegisterEventListenersAndSubscribersPass(); |
|
241 | $pass->process($container); |
|
242 | } |
|
243 | ||
244 | public function testEventSubscriberCanBePrivate() |
|
245 | { |