| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Bdf\PrimeBundle\Tests; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | require_once __DIR__.'/TestKernel.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Bdf\Prime\Cache\ArrayCache; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Bdf\Prime\Cache\DoctrineCacheAdapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Bdf\Prime\Connection\SimpleConnection; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Bdf\Prime\Console\UpgraderCommand; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Bdf\Prime\Migration\MigrationManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Bdf\Prime\Schema\RepositoryUpgrader; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Bdf\Prime\Schema\StructureUpgraderResolverAggregate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Bdf\Prime\Schema\StructureUpgraderResolverInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Bdf\Prime\ServiceLocator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Bdf\Prime\Sharding\ShardingConnection; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Bdf\Prime\Sharding\ShardingQuery; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Bdf\Prime\Types\ArrayType; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use Bdf\Prime\Types\TypeInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use Bdf\PrimeBundle\Collector\PrimeDataCollector; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use Bdf\PrimeBundle\DependencyInjection\Compiler\PrimeConnectionFactoryPass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use Bdf\PrimeBundle\PrimeBundle; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | use Doctrine\Common\Cache\Psr6\DoctrineProvider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | use PHPUnit\Framework\TestCase; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use Symfony\Bundle\FrameworkBundle\Console\Application; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use Symfony\Component\Cache\Adapter\FilesystemAdapter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use Symfony\Component\Config\Loader\LoaderInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use Symfony\Component\DependencyInjection\ContainerBuilder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use Symfony\Component\HttpFoundation\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | use Symfony\Component\HttpKernel\Kernel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | use Symfony\Component\Routing\RouteCollectionBuilder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  * BdfSerializerBundleTest. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | class BdfPrimeBundleTest extends TestCase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     public function testDefaultConfig() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $builder = new ContainerBuilder(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $bundle = new PrimeBundle(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $bundle->build($builder); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         $compilerPasses = $builder->getCompiler()->getPassConfig()->getPasses(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $found = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         foreach ($compilerPasses as $pass) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |             if ($pass instanceof PrimeConnectionFactoryPass) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |                 ++$found; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $this->assertSame(1, $found); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     public function testKernel() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $kernel = new \TestKernel('dev', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $this->assertInstanceOf(ServiceLocator::class, $kernel->getContainer()->get('prime')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $this->assertSame($kernel->getContainer()->get('prime'), $kernel->getContainer()->get(ServiceLocator::class)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         $this->assertInstanceOf(MigrationManager::class, $kernel->getContainer()->get(MigrationManager::class)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $this->assertInstanceOf(SimpleConnection::class, $kernel->getContainer()->get(ServiceLocator::class)->connection('test')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     public function testStructureUpgrader() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         if (!interface_exists(StructureUpgraderResolverInterface::class)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |             $this->markTestSkipped('StructureUpgraderResolverInterface not present'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         $kernel = new \TestKernel('dev', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         $this->assertInstanceOf(StructureUpgraderResolverAggregate::class, $kernel->getContainer()->get(StructureUpgraderResolverInterface::class)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         $this->assertInstanceOf(StructureUpgraderResolverAggregate::class, $kernel->getContainer()->get(StructureUpgraderResolverAggregate::class)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         $console = new Application($kernel); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         $command = $console->get(UpgraderCommand::getDefaultName()); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         $r = new \ReflectionProperty($command, 'resolver'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $r->setAccessible(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         $this->assertSame( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |             $kernel->getContainer()->get(StructureUpgraderResolverAggregate::class), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |             $r->getValue($command) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         $upgrader = $kernel->getContainer()->get(StructureUpgraderResolverAggregate::class)->resolveByDomainClass(\TestEntity::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         $this->assertInstanceOf(RepositoryUpgrader::class, $upgrader); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         $this->assertEquals('test_', $upgrader->table()->name()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         $this->assertEquals($upgrader, $kernel->getContainer()->get(StructureUpgraderResolverAggregate::class)->resolveByMapperClass(\TestEntityMapper::class)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     public function testCollector() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         $kernel = new \TestKernel('dev', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         $collector = $kernel->getContainer()->get(PrimeDataCollector::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         $this->assertInstanceOf(PrimeDataCollector::class, $collector); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         $kernel->handle(Request::create('http://127.0.0.1/')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |         $this->assertGreaterThanOrEqual(3, $collector->getQueryCount()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |         $queries = array_map(function ($entry) { return $entry['sql']; }, $collector->getQueries()['']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         $this->assertContains('SELECT * FROM test_ WHERE id = ? LIMIT 1', $queries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     public function testFunctional() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         $kernel = new \TestKernel('dev', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         \TestEntity::repository()->schema()->migrate(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         $entity = new \TestEntity(['name' => 'foo']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $entity->insert(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         $this->assertEquals([$entity], \TestEntity::all()); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |         $this->assertEquals($entity, \TestEntity::where('name', 'foo')->first()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     public function testShardingConnection() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         $kernel = new class('test', true) extends Kernel { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             use \Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |             public function registerBundles(): iterable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |                 return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |                     new FrameworkBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |                     new PrimeBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |                 ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |                 $loader->import(__DIR__.'/Fixtures/sharding.yaml'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             protected function configureRoutes(RouteCollectionBuilder $routes) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |         }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |         /** @var ServiceLocator $prime */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         $prime = $kernel->getContainer()->get(ServiceLocator::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |         $this->assertInstanceOf(ShardingConnection::class, $prime->connection('test')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |         $this->assertInstanceOf(ShardingQuery::class, $prime->connection('test')->builder()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |         /** @var SimpleConnection $connection */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |         $connection = $prime->connection('test.shard1'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |         $this->assertSame($prime->connection('test')->getConfiguration(), $connection->getConfiguration()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |     public function testArrayCache() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         $kernel = new class('test', true) extends Kernel { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |             use \Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             public function registerBundles(): iterable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |                 return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |                     new FrameworkBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |                     new PrimeBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |                 ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |             protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                 $loader->import(__DIR__.'/Fixtures/array_cache.yaml'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |             protected function configureRoutes($routes) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         /** @var ServiceLocator $prime */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |         $prime = $kernel->getContainer()->get(ServiceLocator::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         $this->assertEquals(new ArrayCache(), $prime->mappers()->getResultCache()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     public function testPoolCache() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |         $kernel = new class('test', true) extends Kernel { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |             use \Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |             public function registerBundles(): iterable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |                 return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |                     new FrameworkBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |                     new PrimeBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |                 ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |             protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |                 $c->register('custom.cache', FilesystemAdapter::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |                 $loader->import(__DIR__.'/Fixtures/pool_cache.yaml'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |             protected function configureRoutes($routes) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |         }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |         /** @var ServiceLocator $prime */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |         $prime = $kernel->getContainer()->get(ServiceLocator::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         $this->assertEquals(new DoctrineCacheAdapter(DoctrineProvider::wrap(new FilesystemAdapter())), $prime->mappers()->getResultCache()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     public function testGlobalConfig() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         $kernel = new class('test', true) extends Kernel { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |             use \Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |             public function registerBundles(): iterable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |                 return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |                     new FrameworkBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |                     new PrimeBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |                 ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |             protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |                 $loader->import(__DIR__.'/Fixtures/config.yaml'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |             protected function configureRoutes($routes) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |         }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |         $kernel->boot(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         /** @var ServiceLocator $prime */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |         $prime = $kernel->getContainer()->get(ServiceLocator::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |         /** @var SimpleConnection $connection */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         $connection = $prime->connection('test2'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |         $this->assertNotNull($connection->getConfiguration()->getSQLLogger()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |         $this->assertTrue($connection->getConfiguration()->getAutoCommit()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |         $this->assertInstanceOf(FooType::class, $connection->getConfiguration()->getTypes()->get('foo')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |         $this->assertInstanceOf(BarType::class, $connection->getConfiguration()->getTypes()->get('bar')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |         $this->assertInstanceOf(ArrayType::class, $connection->getConfiguration()->getTypes()->get('array')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     public function testConnectionConfig() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |         $kernel = new class('test', true) extends Kernel { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |             use \Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |             public function registerBundles(): iterable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                 return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |                     new FrameworkBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |                     new PrimeBundle(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |                 ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |             protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |             { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |                 $loader->import(__DIR__.'/Fixtures/config.yaml'); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 281 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 282 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 283 |  |  |             protected function configureRoutes($routes) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 284 |  |  |             { | 
            
                                                                        
                            
            
                                    
            
            
                | 285 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 286 |  |  |         }; | 
            
                                                                        
                            
            
                                    
            
            
                | 287 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 288 |  |  |         $kernel->boot(); | 
            
                                                                        
                            
            
                                    
            
            
                | 289 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 290 |  |  |         /** @var ServiceLocator $prime */ | 
            
                                                                        
                            
            
                                    
            
            
                | 291 |  |  |         $prime = $kernel->getContainer()->get(ServiceLocator::class); | 
            
                                                                        
                            
            
                                    
            
            
                | 292 |  |  |         /** @var SimpleConnection $connection */ | 
            
                                                                        
                            
            
                                    
            
            
                | 293 |  |  |         $connection = $prime->connection('test'); | 
            
                                                                        
                            
            
                                    
            
            
                | 294 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 295 |  |  |         $this->assertNull($connection->getConfiguration()->getSQLLogger()); | 
            
                                                                        
                            
            
                                    
            
            
                | 296 |  |  |         $this->assertFalse($connection->getConfiguration()->getAutoCommit()); | 
            
                                                                        
                            
            
                                    
            
            
                | 297 |  |  |         $this->assertInstanceOf(BarType::class, $connection->getConfiguration()->getTypes()->get('foo')); | 
            
                                                                        
                            
            
                                    
            
            
                | 298 |  |  |         $this->assertInstanceOf(BarType::class, $connection->getConfiguration()->getTypes()->get('bar')); | 
            
                                                                        
                            
            
                                    
            
            
                | 299 |  |  |         $this->assertInstanceOf(ArrayType::class, $connection->getConfiguration()->getTypes()->get('array')); | 
            
                                                                        
                            
            
                                    
            
            
                | 300 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 301 |  |  | } | 
            
                                                                        
                            
            
                                    
            
            
                | 302 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 303 |  |  | class FooType implements TypeInterface | 
            
                                                                        
                            
            
                                    
            
            
                | 304 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 305 |  |  |     public function fromDatabase($value, array $fieldOptions = []) | 
            
                                                                        
                            
            
                                    
            
            
                | 306 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 307 |  |  |         // TODO: Implement fromDatabase() method. | 
            
                                                                        
                            
            
                                    
            
            
                | 308 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 309 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 310 |  |  |     public function toDatabase($value) | 
            
                                                                        
                            
            
                                    
            
            
                | 311 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 312 |  |  |         // TODO: Implement toDatabase() method. | 
            
                                                                        
                            
            
                                    
            
            
                | 313 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     public function name(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |         // TODO: Implement name() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     } | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |     public function phpType(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |         // TODO: Implement phpType() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |     } | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  | class BarType implements TypeInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |     public function fromDatabase($value, array $fieldOptions = []) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |         // TODO: Implement fromDatabase() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |     public function toDatabase($value) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |         // TODO: Implement toDatabase() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |     public function name(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |         // TODO: Implement name() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |     } | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |     public function phpType(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |         // TODO: Implement phpType() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |     } | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 346 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 347 |  |  |  |