You are here

public function LessUnitTest::test_less_rewrite_paths in Less CSS Preprocessor 7.4

Same name and namespace in other branches
  1. 8 tests/less.test \LessUnitTest::test_less_rewrite_paths()

Test the _less_rewrite_paths() function.

See also

_less_rewrite_paths()

File

tests/less.test, line 70

Class

LessUnitTest

Code

public function test_less_rewrite_paths() {
  $input_file_path = 'sites/all/modules/custom/less/less_demo/styles/less_demo.info.css.less';
  $less_compiled_css = <<<'EOD'
#less_demo_gradient .less_demo_logo {
  background: transparent url(../images/logo.png) center center no-repeat;
}
EOD;
  $expected_rewritten_output_data = <<<EOD
#less_demo_gradient .less_demo_logo {
  background: transparent url({<span class="php-variable">$GLOBALS</span>[<span class="php-string">'base_path'</span>]}sites/all/modules/custom/less/less_demo/images/logo.png) center center no-repeat;
}
EOD;
  $actual_rewritten_output_data = _less_rewrite_paths($input_file_path, $less_compiled_css);
  $this
    ->assertIdentical($actual_rewritten_output_data, $expected_rewritten_output_data, 'Rewritten paths are correct.');
}