protected function WishlistAssignmentTest::setUp in Commerce Wishlist 8.3
Overrides WishlistKernelTestBase::setUp
File
- tests/
src/ Kernel/ WishlistAssignmentTest.php, line 66
Class
- WishlistAssignmentTest
- Tests the wishlist assignment.
Namespace
Drupal\Tests\commerce_wishlist\KernelCode
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_1',
'label' => 'Test 1',
]);
$wishlist_type
->save();
$another_wishlist_type = WishlistType::create([
'id' => 'test_2',
'label' => 'Test 2',
]);
$another_wishlist_type
->save();
$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->anonymousUser = $this
->createUser([
'uid' => 0,
'name' => '',
'status' => 0,
]);
$this->authenticatedUser = $this
->createUser();
$this->entityTypeManager = $this->container
->get('entity_type.manager');
$this->wishlistAssignment = $this->container
->get('commerce_wishlist.wishlist_assignment');
$this
->config('commerce_wishlist.settings')
->set('allow_multiple', 1)
->save();
}