27 $this->ccConfigMock = $this->createMock(\
Magento\
Payment\Model\CcConfig::class);
28 $this->assetSourceMock = $this->createMock(\
Magento\Framework\View\Asset\Source::class);
29 $this->model = new \Magento\Payment\Model\CcConfigProvider(
31 $this->assetSourceMock
37 $imagesDirectoryPath =
__DIR__ .
'/../../../view/base/web/images/cc/';
43 'url' =>
'http://cc.card/vi.png',
44 'width' =>
getimagesize($imagesDirectoryPath .
'vi.png')[0],
45 'height' =>
getimagesize($imagesDirectoryPath .
'vi.png')[1]
48 'url' =>
'http://cc.card/ae.png',
49 'width' =>
getimagesize($imagesDirectoryPath .
'ae.png')[0],
50 'height' =>
getimagesize($imagesDirectoryPath .
'ae.png')[1]
57 $ccAvailableTypesMock = [
59 'fileId' =>
'Magento_Payment::images/cc/vi.png',
60 'path' => $imagesDirectoryPath .
'vi.png',
61 'url' =>
'http://cc.card/vi.png' 64 'fileId' =>
'Magento_Payment::images/cc/ae.png',
65 'path' => $imagesDirectoryPath .
'ae.png',
66 'url' =>
'http://cc.card/ae.png' 69 $assetMock = $this->createMock(\
Magento\Framework\View\Asset\File::class);
71 $this->ccConfigMock->expects($this->once())->method(
'getCcAvailableTypes')->willReturn($ccAvailableTypesMock);
73 $this->ccConfigMock->expects($this->atLeastOnce())
74 ->method(
'createAsset')
76 [$ccAvailableTypesMock[
'vi'][
'fileId']],
77 [$ccAvailableTypesMock[
'ae'][
'fileId']]
78 )->willReturn($assetMock);
79 $this->assetSourceMock->expects($this->atLeastOnce())
80 ->method(
'findSource')
82 ->willReturnOnConsecutiveCalls(
83 $ccAvailableTypesMock[
'vi'][
'path'],
84 $ccAvailableTypesMock[
'ae'][
'path']
86 $assetMock->expects($this->atLeastOnce())
87 ->method(
'getSourceFile')
88 ->willReturnOnConsecutiveCalls(
89 $ccAvailableTypesMock[
'vi'][
'path'],
90 $ccAvailableTypesMock[
'ae'][
'path']
92 $assetMock->expects($this->atLeastOnce())
94 ->willReturnOnConsecutiveCalls(
95 $ccAvailableTypesMock[
'vi'][
'url'],
96 $ccAvailableTypesMock[
'ae'][
'url']
99 $this->assertEquals($expectedResult, $this->model->getConfig());
defined('TESTS_BP')||define('TESTS_BP' __DIR__