8 use \Magento\Theme\Model\Favicon\Favicon;
47 protected function setUp()
49 $storeManager = $this->getMockBuilder(\
Magento\Store\Model\StoreManagerInterface::class)->getMock();
50 $this->store = $this->getMockBuilder(
51 \
Magento\Store\Model\Store::class
52 )->disableOriginalConstructor()->getMock();
55 ->willReturn($this->store);
57 $this->scopeManager = $this->getMockBuilder(
60 $this->fileStorageDatabase = $this->getMockBuilder(\
Magento\MediaStorage\Helper\
File\Storage\Database::class)
61 ->disableOriginalConstructor()
64 ->disableOriginalConstructor()
66 $this->mediaDir = $this->getMockBuilder(
70 ->method(
'getDirectoryRead')
72 ->willReturn($this->mediaDir);
78 $this->fileStorageDatabase,
88 $this->assertFalse($this->object->getFaviconFile());
96 $scopeConfigValue =
'path';
97 $urlToMediaDir =
'http://magento.url/pub/media/';
98 $expectedFile = ImageFavicon::UPLOAD_DIR .
'/' . $scopeConfigValue;
99 $expectedUrl = $urlToMediaDir . $expectedFile;
101 $this->scopeManager->expects($this->once())
104 ->willReturn($scopeConfigValue);
105 $this->store->expects($this->once())
106 ->method(
'getBaseUrl')
108 ->willReturn($urlToMediaDir);
109 $this->fileStorageDatabase->expects($this->once())
110 ->method(
'checkDbUsage')
112 $this->fileStorageDatabase->expects($this->once())
113 ->method(
'saveFileToFilesystem')
115 $this->mediaDir->expects($this->at(0))
117 ->with($expectedFile)
119 $this->mediaDir->expects($this->at(1))
121 ->with($expectedFile)
124 $results = $this->
object->getFaviconFile();
137 $this->assertEquals(
'Magento_Theme::favicon.ico', $this->object->getDefaultFavicon());
testGetFaviconFileNegative()