Skip to content

Commit

Permalink
Merge pull request #782 from alexandre-abrioux/master
Browse files Browse the repository at this point in the history
[defaultContext] update ContextFactoryInterface aliases
  • Loading branch information
goetas authored Dec 21, 2019
2 parents 706b9a6 + 33159dc commit 2f2c397
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions DependencyInjection/JMSSerializerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public function loadInternal(array $config, ContainerBuilder $container)

if (isset($config['default_context'][$configKey]['id'])) {
$container->setAlias('jms_serializer.' . $configKey . '_context_factory', new Alias($config['default_context'][$configKey]['id'], true));
$container->setAlias('JMS\\Serializer\\ContextFactory\\' . ucfirst($configKey) . 'ContextFactoryInterface', new Alias($config['default_context'][$configKey]['id'], true));
$container->removeDefinition($serviceId);
continue;
}
Expand Down
7 changes: 7 additions & 0 deletions Tests/DependencyInjection/JMSSerializerExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ public function testSerializerContextFactoriesWithId()

$this->assertEquals('foo', (string)$serializationFactoryArg);
$this->assertEquals('bar', (string)$deSerializationFactoryArg);

$serializationContextFactoryAlias = $container->getAlias('JMS\Serializer\ContextFactory\SerializationContextFactoryInterface');
$deserializationContextFactoryAlias = $container->getAlias('JMS\Serializer\ContextFactory\DeserializationContextFactoryInterface');

$this->assertEquals('foo', (string)$serializationContextFactoryAlias);
$this->assertEquals('bar', (string)$deserializationContextFactoryAlias);

}

public function testLoadWithoutTranslator()
Expand Down

0 comments on commit 2f2c397

Please sign in to comment.