You are here

public function OrderIntegrationTest::testNoProfile in Commerce Core 8.2

Tests the handling of orders without a billing profile.

File

modules/tax/tests/src/Kernel/OrderIntegrationTest.php, line 85

Class

OrderIntegrationTest
Tests integration with orders.

Namespace

Drupal\Tests\commerce_tax\Kernel

Code

public function testNoProfile() {
  $order_item = OrderItem::create([
    'type' => 'test',
    'quantity' => '1',
    'unit_price' => new Price('12.00', 'USD'),
  ]);
  $order_item
    ->save();
  $this->order
    ->addItem($order_item);
  $this->order
    ->save();

  // Confirm that the store address was used.
  $adjustments = $this->order
    ->collectAdjustments();
  $adjustment = reset($adjustments);
  $this
    ->assertCount(1, $adjustments);
  $this
    ->assertEquals(new Price('2.00', 'USD'), $adjustment
    ->getAmount());
  $this
    ->assertEquals('us_vat|default|standard', $adjustment
    ->getSourceId());
}