public function testAfterLoad() { $value = 'filename.jpg'; $this->fileBackend->setValue($value); $this->fileBackend->setFieldConfig(['upload_dir' => ['value' => 'value', 'config' => 'system/filesystem/media'], 'base_url' => ['type' => 'media', 'value' => 'design/file']]); $this->mediaDirectory->expects($this->once())->method('isExist')->with('value/' . $value)->willReturn(true); $this->urlBuilder->expects($this->once())->method('getBaseUrl')->with(['_type' => UrlInterface::URL_TYPE_MEDIA])->willReturn('http://magento2.com/pub/media/'); $this->mediaDirectory->expects($this->once())->method('getRelativePath')->with('value')->willReturn('value'); $this->mediaDirectory->expects($this->once())->method('stat')->with('value/' . $value)->willReturn(['size' => 234234]); $this->fileBackend->afterLoad(); $this->assertEquals([['url' => 'http://magento2.com/pub/media/design/file/' . $value, 'file' => $value, 'size' => 234234, 'exists' => true]], $this->fileBackend->getValue()); }