/** * Creates the tables needed for the backend. * * @return void * @throws \RuntimeException if something goes wrong * @author Karsten Dambekalns <*****@*****.**> */ protected function createTables($dsn, $username, $password) { try { $pdoHelper = new \F3\FLOW3\Utility\PdoHelper($dsn, $username, $password); $pdoHelper->importSql(__DIR__ . '/../Resources/Private/Persistence/SQL/DDL.sql'); } catch (\PDOException $e) { throw new \RuntimeException('Could not create persistence tables with DSN "' . $dsn . '". PDO error: ' . $e->getMessage()); } }
/** * Sets up the APC backend used for testing * * @return \F3\FLOW3\Cache\Backend\PdoBackend * @author Karsten Dambekalns <*****@*****.**> */ protected function setUpBackend() { $environment = $this->objectManager->getObject('F3\\FLOW3\\Utility\\Environment'); $this->fixtureFolder = $environment->getPathToTemporaryDirectory() . 'FLOW3/Tests/'; \F3\FLOW3\Utility\Files::createDirectoryRecursively($this->fixtureFolder); $this->fixtureDB = uniqid('Cache') . '.db'; $pdoHelper = new \F3\FLOW3\Utility\PdoHelper('sqlite:' . $this->fixtureFolder . $this->fixtureDB, '', ''); $pdoHelper->importSql(FLOW3_PATH_FLOW3 . 'Resources/Private/Cache/SQL/DDL.sql'); $mockSystemLogger = $this->getMock('F3\\FLOW3\\Log\\SystemLoggerInterface'); $mockCache = $this->getMock('F3\\FLOW3\\Cache\\Frontend\\FrontendInterface', array(), array(), '', FALSE); $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('TestCache')); $backend = new \F3\FLOW3\Cache\Backend\PdoBackend('Testing'); $backend->injectEnvironment($environment); $backend->injectSystemLogger($mockSystemLogger); $backend->setCache($mockCache); $backend->setDataSourceName('sqlite:' . $this->fixtureFolder . $this->fixtureDB); $backend->initializeObject(); return $backend; }