public function testCodeCliCompileMore() { // less file with @include param $this->assertEquals(trim(PreprocFactory::getPreprocessor(self::getFactoryOptions(array('resources' => new FileObject(self::getTestFilePath('less/app.less'), 'r+'))))->process()), trim(file_get_contents(self::getTestFilePath('test-app.less.css')))); // less file with minify option $this->assertEquals(trim(PreprocFactory::getPreprocessor(self::getFactoryOptions(array('resources' => new FileObject(self::getTestFilePath('less/app.less'), 'r+'), 'options' => array('lesscOptions' => '--clean-css'))))->process()), trim(file_get_contents(self::getTestFilePath('test-app.less.min.css')))); // lessc incorrect path $catch = false; try { $this->assertEquals(trim(PreprocFactory::getPreprocessor(self::getFactoryOptions(array('resources' => self::getTestFilePath('test.syntax.error.%s'), 'options' => array('lesscPath' => 'fjdksgjkldsjglds'))))->process()), ''); } catch (\Exception $e) { $this->assertInstanceOf('\\Athem\\Exception\\ShellExec', $e); $this->assertEquals($e->getMessage(), 'lessc compiler (fjdksgjkldsjglds) not found. ' . 'Please run \'npm install\' within library folder or \'npm -g install lessc\' under root.'); $catch = true; } $this->assertTrue($catch); }
public function getPreprocInstance($options) { return \Athem\Code\PreprocFactory::getPreprocessor($options); }