public function CartIntegrationTest::testAddedToCart in Commerce Core 8.2
Tests that a log is generated when an order is placed.
File
- modules/
log/ tests/ src/ Kernel/ CartIntegrationTest.php, line 83
Class
- CartIntegrationTest
- Tests integration with cart events.
Namespace
Drupal\Tests\commerce_log\KernelCode
public function testAddedToCart() {
$cart = $this->cartProvider
->createCart('default', $this->store, $this->user);
$this->cartManager
->addEntity($cart, $this->variation);
$logs = $this->logStorage
->loadMultipleByEntity($cart);
$this
->assertEquals(1, count($logs));
$log = reset($logs);
$build = $this->logViewBuilder
->view($log);
$this
->render($build);
$this
->assertText("{$this->variation->label()} added to the cart.");
}