/** * as FileContainer can't exists without (in|out)put need to check that: * (in|out)put paths assigned successfully * (in|out)content is null * type should not be null and be detected using @see FileContainer::detectInputTypeByInputPath * * @param string $inputPath * @param string $outputPath * @param string $expectedType */ private function invokeConstructor($inputPath, $outputPath, $expectedType) { $file = new FileContainer($inputPath, $outputPath); $this->assertEquals($inputPath, $file->getInputPath()); $this->assertEquals($outputPath, $file->getOutputPath()); $this->assertNull($file->getOutputContent()); $this->assertNull($file->getInputContent()); $this->assertNotNull($file->getType()); $this->assertEquals($expectedType, $file->getType()); }
/** * @param FileContainer $file * * @throws FileException */ protected function fetchInputContextIntoFile(FileContainer $file) { if (!file_exists($file->getInputPath())) { throw new FileException("file: {$file->getInputPath()} doesn't exists"); } $file->setInputContent(file_get_contents($file->getInputPath())); }
/** * @see Processor::processFile * @test * * @expectedException \EM\CssCompiler\Exception\CompilerException */ public function processFileExpectedException() { $file = new FileContainer(static::getSharedFixturesDirectory() . '/compass', ''); $file->setInputContent(file_get_contents($file->getInputPath())); $file->setType(FileContainer::TYPE_UNKNOWN); (new Processor($this->io))->processFile($file); }