Exemple #1
0
 /**
  * Verify that the PHP bootstrap script:
  *
  * - verifies the signature
  * - self extracts
  * - executes the primary script
  */
 public function testPhpBootstrapScriptFunctionsAsIntended()
 {
     $hello = new Memory('<?php echo "Hello, world!\\n";');
     $primary = new Memory("<?php require __DIR__ . '/../hello.php';");
     $bootstrap = str_replace("<?php\n", "<?php\n\necho __COMPILER_HALT_OFFSET__, \"\\n\";\n", Sqon::createBootstrap());
     $this->sqon->setBootstrap($bootstrap)->setPath(Sqon::PRIMARY, $primary)->setPath('hello.php', $hello)->commit();
     exec(sprintf('php %s', escapeshellarg($this->path)), $output);
     self::assertRegExp("/66(90|88)\nHello, world!/", join("\n", $output), 'The PHP bootstrap script did not function as intended.');
 }
Exemple #2
0
 /**
  * Verify that a new PHP bootstrap script can be created.
  */
 public function testCreateNewPHPBootstrapScript()
 {
     self::assertEquals(trim(file_get_contents(Sqon::BOOTSTRAP_FILE)), Sqon::createBootstrap(), 'The PHP bootstrap script was not created.');
     self::assertEquals("#!/usr/bin/env php\n" . trim(file_get_contents(Sqon::BOOTSTRAP_FILE)), Sqon::createBootstrap('#!/usr/bin/env php'), 'The PHP bootstrap script was not created with the shebang line.');
 }