/** * @param string $fileName * @return string */ public function generate(string $fileName) : string { if (trim($fileName) === '') { throw PathGenerationException::emptyFileName(); } return $this->documentUploadDir . $this->pathGenerator->generatePathFromName($fileName); }
public function it_should_throw_an_exception_if_filename_is_an_empty_string() { //given $fileName = ''; //then $this->shouldThrow(PathGenerationException::emptyFileName())->during('generate', [$fileName]); }