public function RecurringOrderManagerTest::testCloseOrder in Commerce Recurring Framework 8
@covers ::closeOrder
File
- tests/
src/ Kernel/ RecurringOrderManagerTest.php, line 315
Class
- RecurringOrderManagerTest
- @coversDefaultClass \Drupal\commerce_recurring\RecurringOrderManager @group commerce_recurring
Namespace
Drupal\Tests\commerce_recurring\KernelCode
public function testCloseOrder() {
$order = $this->recurringOrderManager
->startRecurring($this->activeSubscription);
$this->recurringOrderManager
->closeOrder($order);
$this
->assertEquals('completed', $order
->getState()
->getId());
// Re-enable after #3011667 is fixed.
// $this->assertTrue($order->isPaid());
/** @var \Drupal\commerce_payment\PaymentStorageInterface $payment_storage */
$payment_storage = $this->container
->get('entity_type.manager')
->getStorage('commerce_payment');
$payments = $payment_storage
->loadMultipleByOrder($order);
$this
->assertCount(1, $payments);
/** @var \Drupal\commerce_payment\Entity\PaymentInterface $payment */
$payment = reset($payments);
$this
->assertEquals('completed', $payment
->getState()
->getId());
$this
->assertEquals($this->paymentGateway
->id(), $payment
->getPaymentGatewayId());
$this
->assertEquals($this->paymentMethod
->id(), $payment
->getPaymentMethodId());
$this
->assertEquals($order
->id(), $payment
->getOrderId());
$this
->assertEquals($order
->getTotalPrice(), $payment
->getAmount());
}