예제 #1
0
 /**
  * @covers \Magento\Braintree\Block\Form::isVaultEnabled
  */
 public function testIsVaultEnabled()
 {
     $storeId = 1;
     $store = $this->getMockForAbstractClass(StoreInterface::class);
     $this->storeManager->expects(static::once())->method('getStore')->willReturn($store);
     $store->expects(static::once())->method('getId')->willReturn($storeId);
     $vaultPayment = $this->getMockForAbstractClass(VaultPaymentInterface::class);
     $this->paymentDataHelper->expects(static::once())->method('getMethodInstance')->with(ConfigProvider::CC_VAULT_CODE)->willReturn($vaultPayment);
     $vaultPayment->expects(static::once())->method('isActive')->with($storeId)->willReturn(true);
     static::assertTrue($this->block->isVaultEnabled());
 }
예제 #2
0
 public function testGetCcAvailableTypesWithCheckout()
 {
     $this->appStateMock->expects($this->once())->method('getAreaCode')->willReturn('');
     $addressMock = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote\\Address')->disableOriginalConstructor()->setMethods(['getCountryId'])->getMock();
     $addressMock->expects($this->once())->method('getCountryId')->willReturn('US');
     $quoteMock = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote')->disableOriginalConstructor()->setMethods(['getBillingAddress'])->getMock();
     $quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($addressMock);
     $this->checkoutSessionMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
     $this->configMock->expects($this->once())->method('getApplicableCardTypes')->with('US')->willReturn(['VI', 'DI', 'MC', 'AE', 'JCB']);
     $this->paymentConfigMock->expects($this->once())->method('getCcTypes')->willReturn(['VI' => 'VI', 'DI' => 'DI', 'MC' => 'MC', 'AE' => 'AE', 'JCB' => 'JCB']);
     $result = $this->form->getCcAvailableTypes();
     $this->assertSame($result, ['VI' => 'VI', 'DI' => 'DI', 'MC' => 'MC', 'AE' => 'AE', 'JCB' => 'JCB']);
 }
예제 #3
0
 public function testIsVaultEnabled()
 {
     $this->vaultService->expects(static::once())->method('isActiveForPayment')->with(ConfigProvider::CODE)->willReturn(true);
     static::assertTrue($this->block->isVaultEnabled());
 }