/** * @param Generator $modelGenerator * @param $fileName * @throws GeneratorException */ private function saveClassToFile($modelGenerator, $fileName) { $outputOnly = $this->input->getOption('output-only'); if ($fileName && !$outputOnly) { $this->output->writeln("Saving class to file: '{$fileName}'"); $modelGenerator->saveToFile($fileName); } }
/** * @test */ public function shouldSaveToFile() { //given $generator = new Generator('products'); $fileName = '/tmp/example.php'; //when $generator->saveToFile($fileName); //then $this->assertFileExists($fileName); unlink($fileName); }