Skip to content

Commit d115107

Browse files
committed
MAGETWO-64587: getRelativePath issue in \Magento\Catalog\Model\View\Asset\Image
1 parent 73829f4 commit d115107

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

app/code/Magento/Catalog/Test/Unit/Model/View/Asset/ImageTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,30 @@ public function testGetPath($filePath, $miscParams)
9797
);
9898
}
9999

100+
/**
101+
* @param string $filePath
102+
* @param array $miscParams
103+
* @dataProvider getPathDataProvider
104+
*/
105+
public function testGetNotUnixPath($filePath, $miscParams)
106+
{
107+
$imageModel = new Image(
108+
$this->mediaConfig,
109+
$this->imageContext,
110+
$this->encryptor,
111+
$filePath,
112+
$miscParams
113+
);
114+
$absolutePath = 'C:\www\magento2ce\pub\media\catalog\product';
115+
$hashPath = md5(implode('_', $miscParams));
116+
$this->imageContext->expects($this->once())->method('getPath')->willReturn($absolutePath);
117+
$this->encryptor->expects($this->once())->method('hash')->willReturn($hashPath);
118+
$this->assertEquals(
119+
$absolutePath . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $hashPath . $filePath,
120+
$imageModel->getPath()
121+
);
122+
}
123+
100124
/**
101125
* @param string $filePath
102126
* @param array $miscParams

0 commit comments

Comments
 (0)