public function testNoHeader() { $asset = new StringAsset('square = (x) -> x * x'); $asset->load(); $this->filter->setNoHeader(true); $this->filter->filterLoad($asset); $this->assertNotRegExp('/^\\/\\/ Generated by CoffeeScript/i', $asset->getContent()); }
public function testFilterLoad() { if (!isset($_SERVER['COFFEE_BIN']) || !isset($_SERVER['NODE_BIN'])) { $this->markTestSkipped('There is no COFFEE_BIN or NODE_BIN environment variable.'); } $expected = <<<JAVASCRIPT (function() { var square; square = function(x) { return x * x; }; }).call(this); JAVASCRIPT; $asset = new StringAsset('square = (x) -> x * x'); $asset->load(); $filter = new CoffeeScriptFilter($_SERVER['COFFEE_BIN'], $_SERVER['NODE_BIN']); $filter->filterLoad($asset); $this->assertEquals($expected, $asset->getContent()); }