public function create(FileResource $fileResource) { $fileName = $fileResource->getFileName(); $content = $this->codeGenerator->getOutput($fileResource->getClassSource()); $this->filesystem->dumpFile($fileName, $content); return true; }
public function it_will_create_file($filesystem, $codeGenerator, FileResource $fileResource, ImprovedClassSource $classSource) { $fileResource->getClassSource()->willReturn($classSource); $fileResource->getFileName()->willReturn('filename.php'); $codeGenerator->getOutput($classSource)->willReturn('code'); $filesystem->dumpFile('filename.php', 'code')->shouldBeCalled(); $this->create($fileResource)->shouldReturn(true); }