You are here

protected function RecurringOrderManagerTest::assertOrder in Commerce Recurring Framework 8

Asserts that the recurring order fields have the expected values.

Parameters

\Drupal\commerce_order\Entity\OrderInterface $order: The recurring order.

\Drupal\commerce_recurring\Entity\SubscriptionInterface $subscription: The subscription.

5 calls to RecurringOrderManagerTest::assertOrder()
RecurringOrderManagerTest::testRenewOrder in tests/src/Kernel/RecurringOrderManagerTest.php
@covers ::renewOrder
RecurringOrderManagerTest::testStartRecurringPostpaid in tests/src/Kernel/RecurringOrderManagerTest.php
@covers ::startRecurring @covers ::collectSubscriptions
RecurringOrderManagerTest::testStartRecurringPrepaid in tests/src/Kernel/RecurringOrderManagerTest.php
@covers ::startRecurring @covers ::collectSubscriptions
RecurringOrderManagerTest::testStartTrialPostpaid in tests/src/Kernel/RecurringOrderManagerTest.php
@covers ::startTrial @covers ::collectSubscriptions
RecurringOrderManagerTest::testStartTrialPrepaid in tests/src/Kernel/RecurringOrderManagerTest.php
@covers ::startTrial @covers ::collectSubscriptions

File

tests/src/Kernel/RecurringOrderManagerTest.php, line 441

Class

RecurringOrderManagerTest
@coversDefaultClass \Drupal\commerce_recurring\RecurringOrderManager @group commerce_recurring

Namespace

Drupal\Tests\commerce_recurring\Kernel

Code

protected function assertOrder(OrderInterface $order, SubscriptionInterface $subscription) {
  $this
    ->assertEquals('recurring', $order
    ->bundle());
  $this
    ->assertEquals('draft', $order
    ->getState()
    ->getId());
  $this
    ->assertEquals($subscription
    ->getStoreId(), $order
    ->getStoreId());
  $this
    ->assertEquals($subscription
    ->getCustomerId(), $order
    ->getCustomerId());
  $this
    ->assertEquals($subscription
    ->getBillingSchedule()
    ->id(), $order
    ->get('billing_schedule')->target_id);
  $payment_method = $subscription
    ->getPaymentMethod();
  $this
    ->assertEquals($payment_method
    ->id(), $order
    ->get('payment_method')->target_id);
  $this
    ->assertEquals($payment_method
    ->getPaymentGatewayId(), $order
    ->get('payment_gateway')->target_id);
  $this
    ->assertEquals($payment_method
    ->getBillingProfile(), $order
    ->getBillingProfile());
}