class CssEmbedFilterTest

@group integration

Hierarchy

  • class \Assetic\Test\Filter\CssEmbedFilterTest extends \Assetic\Test\Filter\PHPUnit_Framework_TestCase

Expanded class hierarchy of CssEmbedFilterTest

File

drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Filter/CssEmbedFilterTest.php, line 20

Namespace

Assetic\Test\Filter
View source
class CssEmbedFilterTest extends \PHPUnit_Framework_TestCase {
  protected function setUp() {
    if (!isset($_SERVER['CSSEMBED_JAR'])) {
      $this
        ->markTestSkipped('There is no CSSEMBED_JAR environment variable.');
    }
  }
  public function testCssEmbedDataUri() {
    $data = base64_encode(file_get_contents(__DIR__ . '/fixtures/home.png'));
    $asset = new FileAsset(__DIR__ . '/fixtures/cssembed/test.css');
    $asset
      ->load();
    $filter = new CssEmbedFilter($_SERVER['CSSEMBED_JAR']);
    $filter
      ->filterDump($asset);
    $this
      ->assertContains('url(data:image/png;base64,' . $data, $asset
      ->getContent());
  }
  public function testCssEmbedMhtml() {
    $asset = new FileAsset(__DIR__ . '/fixtures/cssembed/test.css');
    $asset
      ->load();
    $filter = new CssEmbedFilter($_SERVER['CSSEMBED_JAR']);
    $filter
      ->setMhtml(true);
    $filter
      ->setMhtmlRoot('/test');
    $filter
      ->filterDump($asset);
    $this
      ->assertContains('url(mhtml:/test/!', $asset
      ->getContent());
  }

}

Members