/**
  * @test
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Upload directory is not writable, doesn't exist or no space left on the disk.
  */
 public function thatThrowsExceptionIfDestinationDirectoryIsNotWritable()
 {
     $this->fileInfo = $this->getFileInfoInstance(self::DUMMY_REAL_PATH, true, false);
     $this->localFileStorageService = $this->getLocalFileStorageServiceInstance($this->fileInfo);
     $this->assertEquals(true, $this->fileInfo->isDir());
     $this->assertEquals(false, $this->fileInfo->isWritable());
     $this->localFileStorageService->upload(self::DUMMY_FILENAME, self::DUMMY_CONTENT);
 }
 /**
  * @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);
 }