|
@@ 161-177 (lines=17) @@
|
| 158 |
|
$pass->process($container); |
| 159 |
|
} |
| 160 |
|
|
| 161 |
|
public function testSubscribingHandler() |
| 162 |
|
{ |
| 163 |
|
$container = $this->getContainer(); |
| 164 |
|
|
| 165 |
|
$def = new Definition('JMS\SerializerBundle\Tests\DependencyInjection\Fixture\SubscribingHandler'); |
| 166 |
|
$def->addTag('jms_serializer.subscribing_handler'); |
| 167 |
|
$container->setDefinition('my_service', $def); |
| 168 |
|
|
| 169 |
|
$pass = new CustomHandlersPass(); |
| 170 |
|
$pass->process($container); |
| 171 |
|
|
| 172 |
|
$args = $container->getDefinition('jms_serializer.handler_registry')->getArguments(); |
| 173 |
|
|
| 174 |
|
$this->assertSame([ |
| 175 |
|
1 => ['DateTime' => ['json' => ['my_service', 'onDateTime']]] |
| 176 |
|
], $args[1]); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
public function testSubscribingHandlerCanBePrivate() |
| 180 |
|
{ |
|
@@ 179-196 (lines=18) @@
|
| 176 |
|
], $args[1]); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
public function testSubscribingHandlerCanBePrivate() |
| 180 |
|
{ |
| 181 |
|
$container = $this->getContainer(); |
| 182 |
|
|
| 183 |
|
$def = new Definition('JMS\SerializerBundle\Tests\DependencyInjection\Fixture\SubscribingHandler'); |
| 184 |
|
$def->addTag('jms_serializer.subscribing_handler'); |
| 185 |
|
$def->setPublic(false); |
| 186 |
|
$container->setDefinition('my_service', $def); |
| 187 |
|
|
| 188 |
|
$pass = new CustomHandlersPass(); |
| 189 |
|
$pass->process($container); |
| 190 |
|
|
| 191 |
|
$args = $container->getDefinition('jms_serializer.handler_registry')->getArguments(); |
| 192 |
|
|
| 193 |
|
$this->assertEquals([ |
| 194 |
|
1 => ['DateTime' => ['json' => [new Reference('my_service'), 'onDateTime']]] |
| 195 |
|
], $args[1]); |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
/** |
| 199 |
|
* @expectedException RuntimeException |