public function WishlistProviderTest::testCreateAnonymousWishlist in Commerce Wishlist 8.3
Tests wishlist creation for an anonymous user.
@covers ::createWishlist
File
- tests/
src/ Kernel/ WishlistProviderTest.php, line 66
Class
- WishlistProviderTest
- Tests the wishlist provider.
Namespace
Drupal\Tests\commerce_wishlist\KernelCode
public function testCreateAnonymousWishlist() {
$wishlist_type = 'default';
$wishlist = $this->wishlistProvider
->createWishlist($wishlist_type, $this->anonymousUser);
$this
->assertInstanceOf(WishlistInterface::class, $wishlist);
// Trying to recreate the same wishlist should throw an exception.
$this
->expectException(DuplicateWishlistException::class);
$this->wishlistProvider
->createWishlist($wishlist_type, $this->anonymousUser);
}