Beispiel #1
0
 /**
  * Verify that an event can prevent a path from being set.
  */
 public function testEventPreventsAPathFromBeingSet()
 {
     $this->eventDispatcher->addListener(BeforeSetPathEvent::NAME, function (BeforeSetPathEvent $event) {
         $event->skip();
     });
     $this->sqon->setPath('test.php', new Memory('test'));
     self::assertFalse($this->sqon->hasPath('test.php'), 'The event did not prevent a path from being set.');
 }
Beispiel #2
0
    /**
     * Verify that the PHP bootstrap script:
     *
     * - verifies the signature
     * - self extracts
     * - executes the primary script
     *
     * with varying compression modes.
     */
    public function testPhpBootstrapScriptFunctionsAsIntendedWithCompression()
    {
        $hello = new Memory('<?php echo "Hello, world!\\n";');
        $hello_bzip2 = new Memory('<?php echo "Hello, bzip2!\\n";');
        $hello_gzip = new Memory('<?php echo "Hello, gzip!\\n";');
        $primary = new Memory(<<<PHP
<?php

require __DIR__ . '/../hello.php';
require __DIR__ . '/../hello-bzip2.php';
require __DIR__ . '/../hello-gzip.php';
PHP
);
        $this->sqon->setPath(Sqon::PRIMARY, $primary)->setPath('hello.php', $hello)->setCompression(Sqon::BZIP2)->setPath('hello-bzip2.php', $hello_bzip2)->setCompression(Sqon::GZIP)->setPath('hello-gzip.php', $hello_gzip)->commit();
        exec(sprintf('php %s', escapeshellarg($this->path)), $output);
        self::assertEquals("Hello, world!\nHello, bzip2!\nHello, gzip!", join("\n", $output), 'The PHP bootstrap script did not function as intended.');
    }