You are here

public function WishlistProviderTest::testCreateAuthenticatedWishlist in Commerce Wishlist 8.3

Tests creating a wishlist for an authenticated user.

@covers ::createWishlist

File

tests/src/Kernel/WishlistProviderTest.php, line 104

Class

WishlistProviderTest
Tests the wishlist provider.

Namespace

Drupal\Tests\commerce_wishlist\Kernel

Code

public function testCreateAuthenticatedWishlist() {
  $wishlist = $this->wishlistProvider
    ->createWishlist('default', $this->authenticatedUser);
  $this
    ->assertInstanceOf(WishlistInterface::class, $wishlist);

  // Trying to recreate the same wishlist should throw an exception.
  $this
    ->expectException(DuplicateWishlistException::class);
  $this->wishlistProvider
    ->createWishlist('default', $this->authenticatedUser);
}