/**
  * @covers ::executePaymentAccessCurrency
  *
  * @dataProvider providerTestExecutePaymentAccessCurrency
  */
 public function testExecutePaymentAccessCurrency($expected, $supported_currencies, $payment_currency_code, $payment_amount)
 {
     $payment = $this->getMockPayment();
     $payment->expects($this->atLeastOnce())->method('getAmount')->willReturn($payment_amount);
     $payment->expects($this->atLeastOnce())->method('getCurrencyCode')->willReturn($payment_currency_code);
     $this->sut->setPayment($payment);
     $this->sut->expects($this->atLeastOnce())->method('getSupportedCurrencies')->willReturn($supported_currencies);
     $account = $this->getMock(AccountInterface::class);
     $method = new \ReflectionMethod($this->sut, 'executePaymentAccessCurrency');
     $method->setAccessible(TRUE);
     $this->assertSame($expected, $method->invoke($this->sut, $account)->isAllowed());
 }
Esempio n. 2
0
 /**
  * Constructs a new instance.
  *
  * @param mixed[] $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param mixed[] $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
  *   The module handler.
  * @param \Drupal\payment\EventDispatcherInterface $event_dispatcher
  *   The event dispatcher.
  * @param \Drupal\Core\Utility\Token $token
  *   The token API.
  * @param \Drupal\payment\Plugin\Payment\Status\PaymentStatusManagerInterface
  *   The payment status manager.
  */
 public function __construct(array $configuration, $plugin_id, array $plugin_definition, ModuleHandlerInterface $module_handler, EventDispatcherInterface $event_dispatcher, Token $token, PaymentStatusManagerInterface $payment_status_manager)
 {
     $configuration += $this->defaultConfiguration();
     parent::__construct($configuration, $plugin_id, $plugin_definition, $module_handler, $event_dispatcher, $token, $payment_status_manager);
 }