public function PaymentUnitTest::testGetPaymentStatuses in Payment 8.2
Tests setPaymentStatuses() and getPaymentStatuses().
File
- tests/
src/ Kernel/ PaymentUnitTest.php, line 158
Class
- PaymentUnitTest
- \Drupal\payment\Entity\Payment unit test.
Namespace
Drupal\Tests\payment\KernelCode
public function testGetPaymentStatuses() {
$statuses = array(
$this->statusManager
->createInstance('payment_pending'),
$this->statusManager
->createInstance('payment_failed'),
);
$this
->assertEqual(spl_object_hash($this->payment
->setPaymentStatuses($statuses)), spl_object_hash($this->payment));
$retrieved_statuses = $this->payment
->getPaymentStatuses();
$this
->assertEqual(spl_object_hash(reset($retrieved_statuses)), spl_object_hash(reset($statuses)));
$this
->assertEqual(spl_object_hash(end($retrieved_statuses)), spl_object_hash(end($statuses)));
// Make sure we always get the last status.
$this
->assertEqual(spl_object_hash($this->payment
->getPaymentStatus()), spl_object_hash(end($statuses)));
}