Example #1
0
 /**
  * Verify that the PHP bootstrap script can be read.
  */
 public function testReadPhpBootstrapScriptFromSqon()
 {
     $reader = new Reader(new File($this->script, 'r'));
     self::assertEquals(trim(file_get_contents($this->script)), $reader->getBootstrap(), 'The PHP bootstrap script was not read properly from the Sqon.');
 }
Example #2
0
File: Sqon.php Project: sqon/sqon
 /**
  * {@inheritdoc}
  */
 public static function open($path)
 {
     if (!self::isValid($path)) {
         // @codeCoverageIgnoreStart
         throw new SqonException("The Sqon \"{$path}\" has an invalid signature.");
         // @codeCoverageIgnoreEnd
     }
     $temp = tempnam(sys_get_temp_dir(), 'sqon-');
     if (!$temp) {
         // @codeCoverageIgnoreStart
         throw new SqonException('A new temporary file could not be created.');
         // @codeCoverageIgnoreEnd
     }
     $reader = new Reader(new File($path, 'r'));
     $reader->getDatabase(new File($temp, 'w'));
     return new self($path, $reader->getBootstrap(), $temp, new Database(new PDO("sqlite:{$temp}")));
 }