You are here

public function BasicTest::testDoExecutePayment in Payment 8.2

@covers ::doExecutePayment

File

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

Class

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

Namespace

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

Code

public function testDoExecutePayment() {
  $payment_status = $this
    ->createMock(PaymentStatusInterface::class);
  $this->paymentStatusManager
    ->expects($this
    ->once())
    ->method('createInstance')
    ->with($this->pluginDefinition['execute_status_id'])
    ->willReturn($payment_status);
  $payment = $this
    ->createMock(PaymentInterface::class);
  $payment
    ->expects($this
    ->once())
    ->method('save');
  $payment
    ->expects($this
    ->once())
    ->method('setPaymentStatus')
    ->with($payment_status);
  $this->sut
    ->setPayment($payment);
  $method = new \ReflectionMethod($this->sut, 'doExecutePayment');
  $method
    ->setAccessible(TRUE);
  $method
    ->invoke($this->sut, $payment);
}