You are here

public function PaymentUnitTest::testGetPaymentStatus in Payment 8.2

Tests setPaymentStatus() and getPaymentStatus().

File

tests/src/Kernel/PaymentUnitTest.php, line 145

Class

PaymentUnitTest
\Drupal\payment\Entity\Payment unit test.

Namespace

Drupal\Tests\payment\Kernel

Code

public function testGetPaymentStatus() {
  $payment_status_a = $this->statusManager
    ->createInstance('payment_pending');
  $payment_status_b = $this->statusManager
    ->createInstance('payment_failed');
  $this
    ->assertEqual(spl_object_hash($this->payment
    ->setPaymentStatus($payment_status_a)), spl_object_hash($this->payment));
  $this
    ->assertEqual(spl_object_hash($this->payment
    ->getPaymentStatus()), spl_object_hash($payment_status_a));

  // Make sure we always get the last status.
  $this->payment
    ->setPaymentStatus($payment_status_b);
  $this
    ->assertEqual(spl_object_hash($this->payment
    ->getPaymentStatus()), spl_object_hash($payment_status_b));
}