public function CheckoutIntegrationTest::testCheckoutCompletion in Commerce Core 8.2
Tests that a log is generated when an order is placed.
File
- modules/
log/ tests/ src/ Kernel/ CheckoutIntegrationTest.php, line 55
Class
- CheckoutIntegrationTest
- Tests integration with checkout events.
Namespace
Drupal\Tests\commerce_log\KernelCode
public function testCheckoutCompletion() {
$order = Order::create([
'type' => 'default',
'store_id' => $this->store
->id(),
'state' => 'completed',
]);
$order
->save();
$this->container
->get('event_dispatcher')
->dispatch(CheckoutEvents::COMPLETION, new OrderEvent($order));
$logs = $this->logStorage
->loadMultipleByEntity($order);
$this
->assertEquals(1, count($logs));
$log = end($logs);
$build = $this->logViewBuilder
->view($log);
$this
->render($build);
$this
->assertText("Customer completed checkout for this order.");
}