You are here

public function PaymentMethodBaseTest::providerTestExecutePaymentAccessCurrency in Payment 8.2

Provides data to self::testExecutePaymentAccessCurrency().

File

tests/src/Unit/Plugin/Payment/Method/PaymentMethodBaseTest.php, line 426

Class

PaymentMethodBaseTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Method\PaymentMethodBase

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\Method

Code

public function providerTestExecutePaymentAccessCurrency() {
  return [
    // All currencies are allowed.
    [
      TRUE,
      TRUE,
      $this
        ->randomMachineName(),
      mt_rand(),
    ],
    // The payment currency is allowed. No amount limitations.
    [
      TRUE,
      [
        new SupportedCurrency('ABC'),
      ],
      'ABC',
      mt_rand(),
    ],
    // The payment currency is allowed with amount limitations.
    [
      TRUE,
      [
        new SupportedCurrency('ABC', 1, 3),
      ],
      'ABC',
      2,
    ],
    // The payment currency is not allowed.
    [
      FALSE,
      [
        new SupportedCurrency('ABC'),
      ],
      'XXX',
      mt_rand(),
    ],
    // The payment currency is not allowed because of amount limitations.
    [
      FALSE,
      [
        new SupportedCurrency('ABC', 2),
      ],
      'ABC',
      1,
    ],
    [
      FALSE,
      [
        new SupportedCurrency('ABC', NULL, 1),
      ],
      'ABC',
      2,
    ],
  ];
}