Permalink
Browse files

Added test for PackerFilter

  • Loading branch information...
Maximilian Walter authored and maximilian-walter committed Jan 20, 2012
1 parent d776cb4 commit 0de70c0396690f8251263182b70456a872008081
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ * This file is part of the Assetic package, an OpenSky project.
+ *
+ * (c) 2010-2011 OpenSky Project Inc
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Assetic\Test\Filter;
+
+use Assetic\Asset\FileAsset;
+use Assetic\Filter\PackerFilter;
+
+class PackerFilterTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('JavaScriptPacker')) {
+ $this->markTestSkipped('JavaScriptPacker is not installed.');
+ }
+ }
+
+ public function testPacker()
+ {
+ $asset = new FileAsset(__DIR__.'/fixtures/packer/example.js');
+ $asset->load();
+
+ $filter = new PackerFilter();
+ $filter->filterDump($asset);
+
+ $this->assertEquals("var exampleFunction=function(arg1,arg2){alert('exampleFunction called!')}", $asset->getContent());
+ }
+}
@@ -0,0 +1,7 @@
+/**
+ * Example function
+ */
+var exampleFunction = function(arg1, arg2) {
+ // Some comment...
+ alert('exampleFunction called!');
+}
View
@@ -40,3 +40,7 @@
if (isset($_SERVER['PACKAGER'])) {
require_once $_SERVER['PACKAGER'];
}
+
+if (isset($_SERVER['PACKER'])) {
+ require_once $_SERVER['PACKER'];
+}

0 comments on commit 0de70c0

Please sign in to comment.