/**
  * @test
  */
 public function thatFileUploads()
 {
     $this->fileInfo = $this->getFileInfoInstance(self::DUMMY_REAL_PATH, true, true);
     $this->localFileStorageService = $this->getLocalFileStorageServiceInstance($this->fileInfo);
     $this->fs->expects($this->once())->method('dumpFile')->with($this->equalTo($this->fileInfo->getPathname() . DIRECTORY_SEPARATOR . self::DUMMY_FILENAME), $this->equalTo(self::DUMMY_CONTENT));
     $fileRealPath = $this->localFileStorageService->upload(self::DUMMY_FILENAME, self::DUMMY_CONTENT);
     $this->assertEquals($this->fileInfo->getPathname() . DIRECTORY_SEPARATOR . self::DUMMY_FILENAME, $fileRealPath);
 }
 /**
  * @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);
 }