You are here

protected function WishlistManagerTest::setUp in Commerce Wishlist 8.3

Overrides WishlistKernelTestBase::setUp

File

tests/src/Kernel/WishlistManagerTest.php, line 73

Class

WishlistManagerTest
Tests the wishlist manager.

Namespace

Drupal\Tests\commerce_wishlist\Kernel

Code

protected function setUp() : void {
  parent::setUp();

  // Turn off title generation to allow explicit values to be used.
  $variation_type = ProductVariationType::load('default');
  $variation_type
    ->setGenerateTitle(FALSE);
  $variation_type
    ->save();
  $wishlist_type = WishlistType::create([
    'id' => 'test',
    'label' => 'Test',
  ]);
  $wishlist_type
    ->save();
  $this->anonymousUser = $this
    ->createUser([
    'uid' => 0,
    'name' => '',
    'status' => 0,
  ]);
  $this->authenticatedUser = $this
    ->createUser();
  $this->productVariationFirst = ProductVariation::create([
    'type' => 'default',
    'sku' => 'product_1',
    'title' => 'Product 1',
    'status' => 1,
  ]);
  $this->productVariationFirst
    ->save();
  $this->productVariationSecond = ProductVariation::create([
    'type' => 'default',
    'sku' => 'product_2',
    'title' => 'Product 2',
    'status' => 1,
  ]);
  $this->productVariationSecond
    ->save();
  $this->entityTypeManager = $this->container
    ->get('entity_type.manager');
  $this->wishlistManager = $this->container
    ->get('commerce_wishlist.wishlist_manager');
}