public function test_a_string_class_can_be_use_as_extend()
 {
     ConnectionManager::extend('custom3', StubConnection::class);
     $driver = ConnectionManager::resolve('custom3');
     $this->assertContains('stub', $driver);
 }
 /**
  * Setup the entity managers
  * @return array
  */
 protected function setUpEntityManagers()
 {
     $managers = [];
     $connections = [];
     foreach ($this->config['managers'] as $manager => $settings) {
         $managerName = IlluminateRegistry::getManagerNamePrefix() . $manager;
         $connectionName = IlluminateRegistry::getConnectionNamePrefix() . $manager;
         // Bind manager
         $this->app->singleton($managerName, function () use($settings) {
             $configuration = MetaDataManager::resolve(array_get($settings, 'meta'));
             // Paths
             $configuration->getMetadataDriverImpl()->addPaths(array_get($settings, 'paths', []));
             // Repository
             $configuration->setDefaultRepositoryClassName(array_get($settings, 'repository', \Doctrine\ORM\EntityRepository::class));
             $configuration->setAutoGenerateProxyClasses(array_get($settings, 'proxies.auto_generate', false));
             if ($namespace = array_get($settings, 'proxies.namespace', false)) {
                 $configuration->setProxyNamespace($namespace);
             }
             $manager = EntityManager::create(ConnectionManager::resolve(array_get($settings, 'connection')), $configuration);
             // Listeners
             if (isset($settings['events']['listeners'])) {
                 foreach ($settings['events']['listeners'] as $event => $listener) {
                     $manager->getEventManager()->addEventListener($event, $listener);
                 }
             }
             // Subscribers
             if (isset($settings['events']['subscribers'])) {
                 foreach ($settings['events']['subscribers'] as $subscriber) {
                     $manager->getEventManager()->addEventSubscriber($subscriber);
                 }
             }
             // Filters
             if (isset($settings['filters'])) {
                 foreach ($settings['filters'] as $name => $filter) {
                     $configuration->getMetadataDriverImpl()->addFilter($name, $filter);
                     $manager->getFilters()->enable($name);
                 }
             }
             return $manager;
         });
         // Bind connection
         $this->app->singleton($connectionName, function ($app) use($manager) {
             $app->make(IlluminateRegistry::getManagerNamePrefix() . $manager)->getConnection();
         });
         $managers[$manager] = $manager;
         $connections[$manager] = $manager;
     }
     return [$managers, $connections];
 }