You are here

public function BasicTest::testDoRefundPaymentAccess in Payment 8.2

@covers ::doRefundPaymentAccess

@dataProvider providerDoRefundPaymentAccess

File

tests/src/Unit/Plugin/Payment/Method/BasicTest.php, line 258

Class

BasicTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Method\Basic

Namespace

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

Code

public function testDoRefundPaymentAccess($expected, $refund, $current_status_id, $refund_status_id) {
  $this->pluginDefinition['refund'] = $refund;
  $this->pluginDefinition['refund_status_id'] = $refund_status_id;
  $this->sut = new Basic([], '', $this->pluginDefinition, $this->moduleHandler, $this->eventDispatcher, $this->token, $this->paymentStatusManager);
  $payment_status = $this
    ->createMock(PaymentStatusInterface::class);
  $payment_status
    ->expects($this
    ->any())
    ->method('getPluginId')
    ->willReturn($current_status_id);
  $payment = $this
    ->createMock(PaymentInterface::class);
  $payment
    ->expects($this
    ->any())
    ->method('getPaymentStatus')
    ->willReturn($payment_status);
  $this->sut
    ->setPayment($payment);
  $account = $this
    ->createMock(AccountInterface::class);
  $method = new \ReflectionMethod($this->sut, 'doRefundPaymentAccess');
  $method
    ->setAccessible(TRUE);
  $this
    ->assertSame($expected, $method
    ->invoke($this->sut, $account));
}