Ejemplo n.º 1
0
 public function testFilterLoad()
 {
     $asset = new FileAsset(__DIR__ . '/fixtures/sprockets/main.js');
     $asset->load();
     $filter = new SprocketsFilter($_SERVER['SPROCKETS_LIB'], $_SERVER['RUBY_BIN']);
     $filter->addIncludeDir(__DIR__ . '/fixtures/sprockets/lib1');
     $filter->addIncludeDir(__DIR__ . '/fixtures/sprockets/lib2');
     $filter->setAssetRoot($this->assetRoot);
     $filter->filterLoad($asset);
     $this->assertContains('/* header.js */', $asset->getContent());
     $this->assertContains('/* include.js */', $asset->getContent());
     $this->assertContains('/* footer.js */', $asset->getContent());
     $this->assertFileExists($this->assetRoot . '/images/image.gif');
 }
Ejemplo n.º 2
0
    /**
     * @group integration
     */
    public function testFilterLoad()
    {
        if (!isset($_SERVER['SPROCKETIZE_BIN'])) {
            $this->markTestSkipped('There is no SPROCKETIZE_BIN environment variable.');
        }

        $asset = new FileAsset(__DIR__.'/fixtures/sprockets/main.js', array(), 'main.js');
        $asset->load();

        $filter = new SprocketsFilter(__DIR__.'/fixtures/sprockets', $_SERVER['SPROCKETIZE_BIN']);
        $filter->addIncludeDir(__DIR__.'/fixtures/sprockets/lib1');
        $filter->addIncludeDir(__DIR__.'/fixtures/sprockets/lib2');
        $filter->setAssetRoot($this->assetRoot);
        $filter->filterLoad($asset);

        $this->assertContains('/* header.js */', $asset->getContent());
        $this->assertContains('/* include.js */', $asset->getContent());
        $this->assertContains('/* footer.js */', $asset->getContent());
        $this->assertFileExists($this->assetRoot.'/images/image.gif');
    }