diff --git a/unit-tests/AssetsTest.php b/unit-tests/AssetsTest.php index 31f53c2fb34..3fe67d1d1b2 100644 --- a/unit-tests/AssetsTest.php +++ b/unit-tests/AssetsTest.php @@ -18,6 +18,22 @@ +------------------------------------------------------------------------+ */ +class TrimFilter implements \Phalcon\Assets\FilterInterface +{ + public function filter($s) + { + return str_replace(array("\n", "\r", " ", "\t"), '', $s); + } +} + +class UppercaseFilter implements \Phalcon\Assets\FilterInterface +{ + public function filter($s) + { + return strtoupper($s); + } +} + class AssetsTest extends PHPUnit_Framework_TestCase { @@ -484,4 +500,22 @@ public function testFilterMultiplesSourcesFilterJoin() $this->assertEquals($assets->outputJs('js'), '' . PHP_EOL); } -} \ No newline at end of file + public function testIssue1198() + { + @unlink(__DIR__ . '/assets/production/1198.css'); + $di = new \Phalcon\DI\FactoryDefault(); + $assets = new \Phalcon\Assets\Manager(); + $assets->useImplicitOutput(false); + $css = $assets->collection('css'); + $css->setTargetPath(__DIR__ . '/assets/production/1198.css'); + $css->addCss(__DIR__ . '/assets/1198.css'); + $css->addFilter(new UppercaseFilter()); + $css->addFilter(new TrimFilter()); + $css->join(true); + $assets->outputCss('css'); + + $this->assertEquals(file_get_contents(__DIR__ . '/assets/production/1198.css'), 'A{TEXT-DECORATION:NONE;}B{FONT-WEIGHT:BOLD;}'); + @unlink(__DIR__ . '/assets/production/1198.css'); + } +} + diff --git a/unit-tests/assets/1198.css b/unit-tests/assets/1198.css new file mode 100644 index 00000000000..578a50dce6b --- /dev/null +++ b/unit-tests/assets/1198.css @@ -0,0 +1,7 @@ +a { + text-decoration: none; +} + +b { + font-weight: bold; +}