/**
  * @covers \Magento\Braintree\Gateway\Response\PaymentDetailsHandler::handle
  */
 public function testHandle()
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject = ['payment' => $paymentData];
     $response = ['object' => $transaction];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReader->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->paymentHandler->handle($subject, $response);
 }
 /**
  * @covers \Magento\Braintree\Gateway\Response\VaultDetailsHandler::handle
  */
 public function testHandle()
 {
     $this->paymentExtension->expects(self::once())->method('setVaultPaymentToken')->with($this->paymentToken);
     $this->paymentExtension->expects(self::once())->method('getVaultPaymentToken')->willReturn($this->paymentToken);
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject = ['payment' => $paymentData];
     $response = ['object' => $transaction];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReader->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->paymentToken->expects(static::once())->method('setGatewayToken')->with('rh3gd4');
     $this->paymentToken->expects(static::once())->method('setExpiresAt')->with('2022-01-01 00:00:00');
     $this->paymentHandler->handle($subject, $response);
     $this->assertSame($this->paymentToken, $this->payment->getExtensionAttributes()->getVaultPaymentToken());
 }