/** * @see FileContainer::detectInputTypeByInputPath * @test */ public function detectInputTypeByInputPath() { $inputPaths = ['input.css' => FileContainer::TYPE_UNKNOWN, 'input' => FileContainer::TYPE_UNKNOWN, 'input.sass' => FileContainer::TYPE_UNKNOWN, 'input.compass' => FileContainer::TYPE_UNKNOWN, 'input.scss' => FileContainer::TYPE_SCSS, 'input.less' => FileContainer::TYPE_LESS]; foreach ($inputPaths as $inputPath => $expectedType) { $file = new FileContainer($inputPath, ''); $this->assertEquals($expectedType, $file->getType()); } }
/** * @param FileContainer $file * * @return FileContainer * @throws CompilerException */ public function processFile(FileContainer $file) { switch ($file->getType()) { case FileContainer::TYPE_SCSS: return $this->compileSCSS($file); case FileContainer::TYPE_LESS: return $this->compileLESS($file); } throw new CompilerException('unknown compiler'); }