* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Serializer\DependencyInjection\SerializerPass; /** * Tests for the SerializerPass class. * * @author Javier Lopez */ class SerializerPassTest extends TestCase { /** * @expectedException \RuntimeException * @expectedExceptionMessage You must tag at least one service as "serializer.normalizer" to use the "serializer" service */ public function testThrowExceptionWhenNoNormalizers() { $container = new ContainerBuilder(); $container->register('serializer'); $serializerPass = new SerializerPass(); $serializerPass->process($container); } /** * @expectedException \RuntimeException * @expectedExceptionMessage You must tag at least one service as "serializer.encoder" to use the "serializer" service */ public function testThrowExceptionWhenNoEncoders() { $container = new ContainerBuilder(); $container->register('serializer') ->addArgument(array()) ->addArgument(array()); $container->register('normalizer')->addTag('serializer.normalizer'); $serializerPass = new SerializerPass(); $serializerPass->process($container); } public function testServicesAreOrderedAccordingToPriority() { $container = new ContainerBuilder(); $definition = $container->register('serializer')->setArguments(array(null, null)); $container->register('n2')->addTag('serializer.normalizer', array('priority' => 100))->addTag('serializer.encoder', array('priority' => 100)); $container->register('n1')->addTag('serializer.normalizer', array('priority' => 200))->addTag('serializer.encoder', array('priority' => 200)); $container->register('n3')->addTag('serializer.normalizer')->addTag('serializer.encoder'); $serializerPass = new SerializerPass(); $serializerPass->process($container); $expected = array( new Reference('n1'), new Reference('n2'), new Reference('n3'), ); $this->assertEquals($expected, $definition->getArgument(0)); $this->assertEquals($expected, $definition->getArgument(1)); } } __halt_compiler();----SIGNATURE:----QF4K+O3oAEbL5QvF4q6pGkD7UIjbtOA3IfchlVJE0zs7tbDqbatUU30RPOBZZmGMLcEmE7RUfJNlpG7iNohd5QqK/hazmWLA7OyEIa9/xUYUkEXsasN4QtqipYIDvvY5TI4fp5j2Egg3cpxKultFJ4x/bDKj2piIlttLCvNVd8ryrFgpY0lRPCwezxJChzToYMc3nQ8edD3VJhvB4vjM3vXApGf2N7YMki6DiExTaakXaE905FV/z7tIGXPSrh+U2u3xPlN4AxmuP8YtQF3othCns6LCB9ZW7xBJ4NXsoSkH3EkzTZwHmpPTq+sIieIEKTJpO2Zw/jtaaGFR/R6L6B6bxHydjrfX9MJYk8J0XX0YbP6eEE1ZiYsxmTFGRvAxZb9zH8ImSZvwwUiuwCUZBxfuAJqTUI80Ru9yiZlKUvn/G2+49GCLjPlqSYClmLsgLCt2bOQMXWTzy8wFFkvT5L9ttgpeGzRS4bD4uyZwUv5urd1S+Y5LZ4mxG+UMpwtKHtVxQPOI4W80RjI8J9GhEgNOmeO+NiePR+v1UUGHlPPn5MI04s0zzYwEBHPoY8uNegiVGNpYVeNB0rKrN9bxl6nPcxtROGpnACEcXVNyqXZyN6ig8NQ7JBEL3Y+wUIIqDSoz3xfwpeVgjomuMQSElhQyN1T6kWo3DO7LGA2TE2U=----ATTACHMENT:----MTIzOTc4MDYzNzg0ODM5MyA3MzY3Njk4ODQ2MDQ3NDI5IDg2MjE1NjM0NzUwMzIzNDI=