/**
  * @param Command\BranchCommand $command
  * @return Logo|null
  * @throws \Diamante\DeskBundle\Model\Branch\Exception\LogoHandlerLogicException
  */
 private function uploadBranchLogoIfExists(Command\BranchCommand $command)
 {
     /** @var UploadedFile $command->logoFile */
     if (!empty($command->logoFile)) {
         $logo = $this->branchLogoHandler->upload($command->logoFile);
         return new Logo($logo->getFilename(), $command->logoFile->getClientOriginalName());
     }
     return null;
 }
 /**
  * @test
  * @expectedException \RuntimeException
  */
 public function thatFileUploadThrowExceptionWhenDirectoryDoesNotExist()
 {
     $this->dirMock = new FileInfoStub(self::NON_EXISTENT_DIR, false, false);
     $this->handler = new BranchLogoHandler($this->dirMock, $this->fileSysMock);
     $this->fileMock = new UploadedFileStub($this->fixturesDir . '/' . self::PNG_FIXTURE_NAME, self::PNG_FIXTURE_NAME, 'image/png');
     $this->assertEquals('image/png', $this->fileMock->getMimeType());
     $this->assertEquals('png', strtolower($this->fileMock->guessExtension()));
     $this->assertEquals(false, $this->dirMock->isDir());
     $this->assertEquals(false, $this->dirMock->isWritable());
     $this->handler->upload($this->fileMock, self::PNG_FIXTURE_NAME);
 }
 /**
  * @param UploadedFile $file
  * @return \Symfony\Component\HttpFoundation\File\File
  */
 private function handleLogoUpload(UploadedFile $file)
 {
     return $this->branchLogoHandler->upload($file);
 }