Skip to content

Commit

Permalink
Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Sep 15, 2013
1 parent ef07b7e commit 0ace81f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
36 changes: 35 additions & 1 deletion unit-tests/AssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{

Expand Down Expand Up @@ -484,4 +500,22 @@ public function testFilterMultiplesSourcesFilterJoin()
$this->assertEquals($assets->outputJs('js'), '<script src="/production/combined-3.js" type="text/javascript"></script>' . PHP_EOL);
}

}
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');
}
}

7 changes: 7 additions & 0 deletions unit-tests/assets/1198.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a {
text-decoration: none;
}

b {
font-weight: bold;
}

0 comments on commit 0ace81f

Please sign in to comment.