Пример #1
0
 /**
  * Creates a new database manager.
  */
 protected function setUp()
 {
     $this->pdo = new PDO('sqlite:' . $this->createTemporaryFile(), null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
     $this->manager = new Database($this->pdo);
     $this->manager->createSchema();
     $columns = ['path', 'type', 'compression', 'modified', 'permissions', 'contents'];
     $this->insert = $this->pdo->prepare(sprintf('INSERT INTO paths (%s) VALUES (:%s)', join(', ', $columns), join(', :', $columns)));
     $this->values = ['compression' => Database::NONE, 'path' => 'test.php', 'type' => Memory::FILE, 'modified' => time(), 'permissions' => 0644, 'contents' => 'test'];
 }
Пример #2
0
Файл: Sqon.php Проект: sqon/sqon
 /**
  * {@inheritdoc}
  */
 public static function create($path, $bootstrap = null)
 {
     if (null === $bootstrap) {
         $bootstrap = self::createBootstrap();
     }
     $temp = tempnam(sys_get_temp_dir(), 'sqon-');
     if (!$temp) {
         // @codeCoverageIgnoreStart
         throw new SqonException('A new temporary file could not be created.');
         // @codeCoverageIgnoreEnd
     }
     $database = new Database(new PDO("sqlite:{$temp}"));
     $database->createSchema();
     return new self($path, $bootstrap, $temp, $database);
 }