File tree Expand file tree Collapse file tree 5 files changed +104
-0
lines changed Expand file tree Collapse file tree 5 files changed +104
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Camelot \DoctrineInheritanceMapping \Bridge \Symfony \DependencyInjection ;
6+
7+ use Symfony \Component \Config \FileLocator ;
8+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
9+ use Symfony \Component \DependencyInjection \Extension \Extension ;
10+ use Symfony \Component \DependencyInjection \Loader \XmlFileLoader ;
11+
12+ final class DoctrineInheritanceMappingExtension extends Extension
13+ {
14+ public function load (array $ configs , ContainerBuilder $ container ): void
15+ {
16+ $ loader = new XmlFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
17+ $ loader ->load ('services.xml ' );
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Camelot \DoctrineInheritanceMapping \Bridge \Symfony ;
6+
7+ use Symfony \Component \HttpKernel \Bundle \Bundle ;
8+
9+ final class DoctrineInheritanceMappingBundle extends Bundle
10+ {
11+ }
Original file line number Diff line number Diff line change 1+ <container xmlns =" http://symfony.com/schema/dic/services"
2+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
4+ https://symfony.com/schema/dic/services/services-1.0.xsd" >
5+
6+ <services >
7+ <defaults autowire =" true"
8+ autoconfigure =" true"
9+ public =" false"
10+ />
11+
12+ <service id =" Camelot\DoctrineInheritanceMapping\Annotation\DiscriminatorMapLoader" >
13+ <argument key =" $config" type =" service" id =" doctrine.orm.default_configuration" />
14+ </service >
15+
16+ <service id =" Camelot\DoctrineInheritanceMapping\EventSubscriber\DiscriminatorSubscriber" >
17+ <tag name =" doctrine.event_listener" event =" loadClassMetadata" />
18+ </service >
19+
20+ </services >
21+ </container >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Camelot \DoctrineInheritanceMapping \Tests \Bridge \Symfony \DependencyInjection ;
6+
7+ use Camelot \DoctrineInheritanceMapping \Annotation \DiscriminatorMapLoader ;
8+ use Camelot \DoctrineInheritanceMapping \Bridge \Symfony \DependencyInjection \DoctrineInheritanceMappingExtension ;
9+ use Camelot \DoctrineInheritanceMapping \EventSubscriber \DiscriminatorSubscriber ;
10+ use PHPUnit \Framework \TestCase ;
11+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
12+ use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
13+
14+ /**
15+ * @covers \Camelot\DoctrineInheritanceMapping\Bridge\Symfony\DependencyInjection\DoctrineInheritanceMappingExtension
16+ */
17+ final class DoctrineInheritanceMappingExtensionTest extends TestCase
18+ {
19+ public function testLoad (): void
20+ {
21+ $ parameters = new ParameterBag ();
22+ $ container = new ContainerBuilder ($ parameters );
23+ $ extension = new DoctrineInheritanceMappingExtension ();
24+ $ extension ->load ([], $ container );
25+
26+ static ::assertArrayHasKey (DiscriminatorMapLoader::class, $ container ->getDefinitions ());
27+ static ::assertArrayHasKey (DiscriminatorSubscriber::class, $ container ->getDefinitions ());
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Camelot \DoctrineInheritanceMapping \Tests \Bridge \Symfony ;
6+
7+ use Camelot \DoctrineInheritanceMapping \Bridge \Symfony \DoctrineInheritanceMappingBundle ;
8+ use PHPUnit \Framework \TestCase ;
9+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
10+ use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
11+
12+ /**
13+ * @covers \Camelot\DoctrineInheritanceMapping\Bridge\Symfony\DoctrineInheritanceMappingBundle
14+ */
15+ final class DoctrineInheritanceMappingBundleTest extends TestCase
16+ {
17+ public function testBuild (): void
18+ {
19+ $ bundle = new DoctrineInheritanceMappingBundle ();
20+ $ bundle ->build (new ContainerBuilder (new ParameterBag ([])));
21+
22+ $ this ->addToAssertionCount (1 );
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments