コード例 #1
0
ファイル: CcType.php プロジェクト: koliaGI/magento2
 /**
  * All possible credit card types
  *
  * @return array
  */
 public function getCcTypes()
 {
     if (!$this->ccTypes) {
         $this->ccTypes = $this->ccTypeSource->toOptionArray();
     }
     return $this->ccTypes;
 }
コード例 #2
0
ファイル: CcTypeTest.php プロジェクト: koliaGI/magento2
 /**
  * @covers \Magento\BraintreeTwo\Helper\CcType::getCcTypes
  */
 public function testGetCcTypes()
 {
     $this->ccTypeSource->expects(static::once())->method('toOptionArray')->willReturn(['label' => 'VISA', 'value' => 'VI']);
     $this->helper->getCcTypes();
     $this->ccTypeSource->expects(static::never())->method('toOptionArray');
     $this->helper->getCcTypes();
 }
コード例 #3
0
 /**
  * Get card types available for Braintree
  * @return array
  */
 private function getConfiguredCardTypes()
 {
     $types = $this->ccType->getCcTypeLabelMap();
     $configCardTypes = array_fill_keys($this->gatewayConfig->getAvailableCardTypes(), '');
     return array_intersect_key($types, $configCardTypes);
 }
コード例 #4
0
 /**
  * Create mock for credit card type
  */
 private function initCcTypeMock()
 {
     $this->ccType = $this->getMockBuilder(CcType::class)->disableOriginalConstructor()->setMethods(['getCcTypeLabelMap'])->getMock();
     $this->ccType->expects(static::once())->method('getCcTypeLabelMap')->willReturn(self::$baseCardTypes);
 }