Example #1
0
 public function testGetStoredCards()
 {
     $card = new \stdClass();
     $card->cardType = 'VI';
     $this->vaultMock->expects($this->once())->method('currentCustomerStoredCards')->willReturn([$card]);
     $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->dataHelperMock->expects($this->once())->method('getCcTypeCodeByName')->with('VI')->willReturn('VI');
     $result = $this->form->getStoredCards();
     $this->assertSame($result, [$card]);
 }