class LessFilterTest

@group integration

Hierarchy

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

Expanded class hierarchy of LessFilterTest

File

drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Filter/LessFilterTest.php, line 21

Namespace

Assetic\Test\Filter
View source
class LessFilterTest extends \PHPUnit_Framework_TestCase {
  protected $filter;
  protected function setUp() {
    if (!isset($_SERVER['NODE_BIN']) || !isset($_SERVER['NODE_PATH'])) {
      $this
        ->markTestSkipped('No node.js configuration.');
    }
    $this->filter = new LessFilter($_SERVER['NODE_BIN'], array(
      $_SERVER['NODE_PATH'],
    ));
  }
  public function testFilterLoad() {
    $asset = new StringAsset('.foo{.bar{width:1+1;}}');
    $asset
      ->load();
    $this->filter
      ->filterLoad($asset);
    $this
      ->assertEquals(".foo .bar {\n  width: 2;\n}\n", $asset
      ->getContent(), '->filterLoad() parses the content');
  }
  public function testImport() {
    $expected = <<<EOF
.foo {
  color: blue;
}
.foo {
  color: red;
}

EOF;
    $asset = new FileAsset(__DIR__ . '/fixtures/less/main.less');
    $asset
      ->load();
    $this->filter
      ->filterLoad($asset);
    $this
      ->assertEquals($expected, $asset
      ->getContent(), '->filterLoad() sets an include path based on source url');
  }

}

Members