You are here

public function OrderItemMatcherTest::testNoPurchasedEntity in Commerce Core 8.2

Tests that order items without purchased entities are not matched.

File

modules/cart/tests/src/Kernel/OrderItemMatcherTest.php, line 154

Class

OrderItemMatcherTest
Tests the order item matcher.

Namespace

Drupal\Tests\commerce_cart\Kernel

Code

public function testNoPurchasedEntity() {
  $order_item = OrderItem::create([
    'type' => 'default',
    'quantity' => 2,
    'unit_price' => new Price('12.00', 'USD'),
  ]);
  $order_item
    ->save();
  $order_item2 = OrderItem::create([
    'type' => 'default',
    'quantity' => 3,
    'unit_price' => new Price('1.00', 'USD'),
  ]);
  $order_item2
    ->save();
  $match = $this->orderItemMatcher
    ->match($order_item, [
    $order_item2,
  ]);
  $this
    ->assertEmpty($match);
}