public function testBeforeSave()
 {
     $value = 'filename.jpg';
     $tmpMediaPath = 'tmp/image/' . $value;
     $this->imageBackend->setScope('store');
     $this->imageBackend->setScopeId(1);
     $this->imageBackend->setValue([['url' => 'http://magento2.com/pub/media/tmp/image/' . $value, 'file' => $value, 'size' => 234234]]);
     $this->imageConfig->expects($this->exactly(2))->method('getTmpMediaPath')->with($value)->willReturn($tmpMediaPath);
     $this->mediaDirectory->expects($this->once())->method('copyFile')->with($tmpMediaPath, 'image/store/1/' . $value)->willReturn(true);
     $this->mediaDirectory->expects($this->once())->method('delete')->with($tmpMediaPath);
     $this->imageBackend->beforeSave();
     $this->assertEquals('store/1/filename.jpg', $this->imageBackend->getValue());
 }