コード例 #1
0
 public function testIsSatisfiedBy()
 {
     $paymentMethodCode = 'test';
     $this->configMock->expects($this->once())->method('getMethodsInfo')->will($this->returnValue(array($paymentMethodCode => array(\Magento\RecurringPayment\Model\Method\RecurringPaymentSpecification::CONFIG_KEY => 1))));
     $this->recurringPaymentSpecification = $this->objectManagerHelper->getObject('Magento\\RecurringPayment\\Model\\Method\\RecurringPaymentSpecification', array('paymentConfig' => $this->configMock));
     $this->assertTrue($this->recurringPaymentSpecification->isSatisfiedBy($paymentMethodCode));
 }
コード例 #2
0
ファイル: CcTest.php プロジェクト: shabbirvividads/magento2
 /**
  * @dataProvider getCcTypeNameDataProvider
  */
 public function testGetCcTypeName($configCcTypes, $ccType, $expected)
 {
     $this->paymentConfig->expects($this->any())->method('getCcTypes')->will($this->returnValue($configCcTypes));
     $paymentInfo = $this->getMock('Magento\\Payment\\Model\\Info', ['getCcType'], [], '', false);
     $paymentInfo->expects($this->any())->method('getCcType')->will($this->returnValue($ccType));
     $this->model->setData('info', $paymentInfo);
     $this->assertEquals($expected, $this->model->getCcTypeName());
 }
コード例 #3
0
 /**
  * Test isSatisfiedBy method
  *
  * @param array $methodsInfo
  * @param bool $result
  * @dataProvider methodsDataProvider
  */
 public function testIsSatisfiedBy($methodsInfo, $result)
 {
     $method = 'method-name';
     $methodsInfo = [$method => $methodsInfo];
     $this->paymentConfigMock->expects($this->once())->method('getMethodsInfo')->will($this->returnValue($methodsInfo));
     $configSpecification = $this->objectManager->getObject('Magento\\Multishipping\\Model\\Payment\\Method\\Specification\\Enabled', ['paymentConfig' => $this->paymentConfigMock]);
     $this->assertEquals($result, $configSpecification->isSatisfiedBy($method), sprintf('Failed payment method test: "%s"', $method));
 }
コード例 #4
0
ファイル: FormTest.php プロジェクト: rafaelstz/magento2
 /**
  * @covers \Magento\Braintree\Block\Form::getCcAvailableTypes
  * @param string $countryId
  * @param array $availableTypes
  * @param array $expected
  * @dataProvider countryCardTypesDataProvider
  */
 public function testGetCcAvailableTypes($countryId, array $availableTypes, array $expected)
 {
     $this->sessionQuote->expects(static::once())->method('getCountryId')->willReturn($countryId);
     $this->gatewayConfig->expects(static::once())->method('getAvailableCardTypes')->willReturn(self::$configCardTypes);
     $this->gatewayConfig->expects(static::once())->method('getCountryAvailableCardTypes')->with($countryId)->willReturn($availableTypes);
     $result = $this->block->getCcAvailableTypes();
     static::assertEquals($expected, array_values($result));
 }
コード例 #5
0
 /**
  * Test isSatisfiedBy method
  *
  * @param array $methodsInfo
  * @param bool $is3DSecureEnabled
  * @param bool $result
  * @dataProvider methodsDataProvider
  */
 public function testIsSatisfiedBy($methodsInfo, $is3DSecureEnabled, $result)
 {
     $method = 'method-name';
     $methodsInfo = array($method => $methodsInfo);
     $this->paymentConfigMock->expects($this->once())->method('getMethodsInfo')->will($this->returnValue($methodsInfo));
     $this->scopeConfigMock->expects($this->any())->method('isSetFlag')->will($this->returnValue($is3DSecureEnabled));
     $configSpecification = $this->objectManager->getObject('Magento\\Multishipping\\Model\\Payment\\Method\\Specification\\Is3DSecure', array('paymentConfig' => $this->paymentConfigMock, 'scopeConfig' => $this->scopeConfigMock));
     $this->assertEquals($result, $configSpecification->isSatisfiedBy($method), sprintf('Failed payment method test: "%s"', $method));
 }
 public function testUpdateOrderStatusForPaymentMethodsNewState()
 {
     $this->_prepareEventMockWithMethods(['getState', 'getStatus']);
     $this->eventMock->expects($this->once())->method('getState')->will($this->returnValue(\Magento\Sales\Model\Order::STATE_NEW));
     $this->eventMock->expects($this->once())->method('getStatus')->will($this->returnValue(self::ORDER_STATUS));
     $defaultStatus = 'defaultStatus';
     $this->orderConfigMock->expects($this->once())->method('getStateDefaultStatus')->with(\Magento\Sales\Model\Order::STATE_NEW)->will($this->returnValue($defaultStatus));
     $this->paymentConfigMock->expects($this->once())->method('getActiveMethods')->will($this->returnValue($this->_getPreparedActiveMethods()));
     $this->coreResourceConfigMock->expects($this->once())->method('saveConfig')->with('payment/' . self::METHOD_CODE . '/order_status', $defaultStatus, 'default', 0);
     $this->updateOrderStatusForPaymentMethodsObserver->execute($this->observerMock);
 }
コード例 #7
0
 public function testGetCcYear()
 {
     $year = [2015 => 2015, 2016 => 2016];
     $expected = [0 => new \Magento\Framework\Phrase('Year'), 2015 => 2015, 2016 => 2016];
     $this->paymentConfigMock->expects($this->once())->method('getYears')->willReturn($year);
     $this->assertEquals($expected, $this->block->getCcYears());
 }
コード例 #8
0
 /**
  * @param array $data
  * @param array $expected
  * @dataProvider getCcAvailableCardTypesDataProvider
  */
 public function testGetCcAvailableCardTypes($data, $expected)
 {
     $this->braintreeCcConfig->expects($this->any())->method('getConfigData')->willReturn($data['cctypes']);
     $this->braintreeCcConfig->expects($this->any())->method('getCountrySpecificCardTypeConfig')->willReturn($data['cctypesCountrySpecific']);
     $this->braintreeCcConfig->expects($this->any())->method('getApplicableCardTypes')->willReturn($data['applicableCards']);
     $this->paymentConfig->expects($this->any())->method('getCcTypes')->willReturn($data['ccTypes']);
     $result = $this->model->getCcAvailableCardTypes($data['country']);
     $this->assertEquals($expected, $result);
 }
コード例 #9
0
 public function testGetCcYears()
 {
     $data = [1, 2, 3];
     $this->configMock->expects($this->once())->method('getYears')->willReturn($data);
     $this->assertEquals($data, $this->model->getCcYears());
 }