32 $this->configMock = $this->createMock(\
Magento\
Payment\Model\Config::class);
33 $this->repositoryMock = $this->createMock(\
Magento\Framework\View\Asset\Repository::class);
34 $this->requestMock = $this->createMock(\
Magento\Framework\
App\RequestInterface::class);
35 $this->urlMock = $this->createMock(\
Magento\Framework\UrlInterface::class);
36 $this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
38 $this->model = new \Magento\Payment\Model\CcConfig(
40 $this->repositoryMock,
50 $this->configMock->expects($this->once())
51 ->method(
'getCcTypes')
54 $this->assertEquals(
$data, $this->model->getCcAvailableTypes());
60 $this->configMock->expects($this->once())
64 $this->assertEquals(
$data, $this->model->getCcMonths());
70 $this->configMock->expects($this->once())
74 $this->assertEquals(
$data, $this->model->getCcYears());
79 $this->assertEquals(
true, $this->model->hasVerification());
85 $fileId =
'Magento_Checkout::cvv.png';
86 $fileUrl =
'file url';
88 $this->requestMock->expects($this->once())
92 $this->repositoryMock->expects($this->once())
93 ->method(
'getUrlWithParams')
95 ->willReturn($fileUrl);
97 $this->assertEquals($fileUrl, $this->model->getCvvImageUrl());
103 $paramsSecure = [
'a' =>
'b',
'_secure' =>
false];
105 $fileUrl =
'exception url';
107 $this->requestMock->expects($this->once())
113 $this->repositoryMock->expects($this->once())
114 ->method(
'getUrlWithParams')
115 ->with($fileId, $paramsSecure)
116 ->willThrowException($exception);
118 $this->loggerMock->expects($this->once())
122 $this->urlMock->expects($this->once())
124 ->with(
'', [
'_direct' =>
'core/index/notFound'])
125 ->willReturn($fileUrl);
127 $this->assertEquals($fileUrl, $this->model->getViewFileUrl($fileId,
$params));
getViewFileUrlWithException()
testGetCcAvailableTypes()
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]