/** * 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.'); }
/** * Verify that an existing Sqon can be opened. */ public function testExistingSqonCanBeOpened() { $script = '<?php __HALT_COMPILER();'; $this->sqon->setBootstrap($script)->commit(); $this->sqon = null; $sqon = Sqon::open($this->file); self::assertEquals($script, $sqon->getBootstrap(), 'The existing Sqon was not opened.'); }