Example #1
0
 public function testProcess()
 {
     $expectedContent = 'updated content';
     $tmpFile = 'tmp/file.ext';
     $this->fileGenerator->expects($this->once())->method('generateFileTree')->with($this->chain)->will($this->returnValue($tmpFile));
     $this->adapter->expects($this->once())->method('process')->with($tmpFile)->will($this->returnValue($expectedContent));
     $this->object->process($this->chain);
     $this->assertEquals($expectedContent, $this->chain->getContent());
     $this->assertEquals('css', $this->chain->getContentType());
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function process(\Magento\Framework\View\Asset\PreProcessor\Chain $chain)
 {
     $chain->setContentType('less');
     $tmpFile = $this->fileGenerator->generateFileTree($chain);
     $cssContent = $this->adapter->process($tmpFile);
     $cssTrimmedContent = trim($cssContent);
     if (!empty($cssTrimmedContent)) {
         $chain->setContent($cssContent);
     }
     $chain->setContentType('css');
 }