You are here

protected function CartManagerTestTrait::installCommerceCart in Commerce Core 8.2

Installs commerce cart.

File

modules/cart/tests/src/Traits/CartManagerTestTrait.php, line 14

Class

CartManagerTestTrait

Namespace

Drupal\Tests\commerce_cart\Traits

Code

protected function installCommerceCart() {
  $this
    ->enableModules([
    'commerce_cart',
  ]);
  $this
    ->installConfig('commerce_cart');
  $entity_type = \Drupal::entityDefinitionUpdateManager()
    ->getEntityType('commerce_order');
  $cart_field_definition = commerce_cart_entity_base_field_info($entity_type)['cart'];
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('cart', 'commerce_order', 'commerce_cart', $cart_field_definition);
  $this->cartProvider = $this->container
    ->get('commerce_cart.cart_provider');
  $this->cartManager = $this->container
    ->get('commerce_cart.cart_manager');
}