/**
  * Get connection.
  *
  * @return Connection
  */
 public function getConnection()
 {
     if (null === $this->connection) {
         $params = ['driver' => 'pdo_sqlite', 'path' => $this->config->getDatabaseFilePath()];
         $config = $this->getEntityManagerConfig();
         $eventManager = $this->getEventManager();
         $this->connection = DriverManager::getConnection($params, $config, $eventManager);
     }
     return $this->connection;
 }
Example #2
0
 /**
  * Test that the expected custom values are returned.
  */
 public function testCustomConfigValues()
 {
     $config = new Config();
     $config->setDatabaseFilePath('/path/to/database.file');
     $config->setCacheDirectory('/cache/directory');
     $config->setLogFilePath('/path/to/log.file');
     $config->setProcessTimeout(Config::DEFAULT_PROCESS_TIMEOUT + 10);
     $this->assertSame('/path/to/database.file', $config->getDatabaseFilePath());
     $this->assertSame('/cache/directory', $config->getCacheDirectory());
     $this->assertSame('/path/to/log.file', $config->getLogFilePath());
     $this->assertSame(Config::DEFAULT_PROCESS_TIMEOUT + 10, $config->getProcessTimeout());
 }