public function OrderIntegrationTest::testOrderAssignedLog in Commerce Core 8.2
Tests that an order assignment log is generated.
File
- modules/
log/ tests/ src/ Kernel/ OrderIntegrationTest.php, line 171
Class
- OrderIntegrationTest
- Tests integration with order events.
Namespace
Drupal\Tests\commerce_log\KernelCode
public function testOrderAssignedLog() {
// Reassignment is currently only done on user login.
$this->order
->setCustomer(User::getAnonymousUser());
$this->order
->setRefreshState(OrderInterface::REFRESH_SKIP);
$this->order
->save();
$new_user = $this
->createUser();
$order_assignment = $this->container
->get('commerce_order.order_assignment');
$order_assignment
->assign($this->order, $new_user);
$logs = $this->logStorage
->loadMultipleByEntity($this->order);
$this
->assertEquals(1, count($logs));
$log = reset($logs);
$build = $this->logViewBuilder
->view($log);
$this
->render($build);
$this
->assertText("The order was assigned to {$new_user->getDisplayName()}.");
}