public function CartIntegrationTest::testRemovedFromCartNoPurchasableEntity in Commerce Core 8.2
Tests that a log generated when a non-purchasable entity removed.
File
- modules/
log/ tests/ src/ Kernel/ CartIntegrationTest.php, line 139
Class
- CartIntegrationTest
- Tests integration with cart events.
Namespace
Drupal\Tests\commerce_log\KernelCode
public function testRemovedFromCartNoPurchasableEntity() {
$cart = $this->cartProvider
->createCart('default', $this->store, $this->user);
$order_item = OrderItem::create([
'title' => 'Membership subscription',
'type' => 'test',
'quantity' => 1,
'unit_price' => [
'number' => '10.00',
'currency_code' => 'USD',
],
]);
$order_item
->save();
$order_item = $this->cartManager
->addOrderItem($cart, $order_item);
$this->cartManager
->removeOrderItem($cart, $order_item);
$logs = $this->logStorage
->loadMultipleByEntity($cart);
$this
->assertEquals(1, count($logs));
$log = end($logs);
$build = $this->logViewBuilder
->view($log);
$this
->render($build);
$this
->assertText("{$order_item->label()} removed from the cart.");
}