You are here

public function WishlistUserTest::testRedirects in Commerce Wishlist 8.3

Tests the redirection to canonical/user_form pages.

File

tests/src/FunctionalJavascript/WishlistUserTest.php, line 114

Class

WishlistUserTest
Tests the wishlist user pages.

Namespace

Drupal\Tests\commerce_wishlist\FunctionalJavascript

Code

public function testRedirects() {
  $wishlist_item = $this
    ->createEntity('commerce_wishlist_item', [
    'type' => 'commerce_product_variation',
    'purchasable_entity' => $this->variation1,
    'quantity' => 1,
  ]);
  $this->wishlist
    ->addItem($wishlist_item);
  $this->wishlist
    ->save();
  $user_form_url = $this->wishlist
    ->toUrl('user-form')
    ->setAbsolute();
  $this
    ->drupalGet(Url::fromRoute('commerce_wishlist.page'));
  $this
    ->assertEquals($user_form_url
    ->toString(), $this
    ->getSession()
    ->getCurrentUrl());
  $this
    ->drupalGet(Url::fromRoute('commerce_wishlist.user_page', [
    'user' => $this->adminUser
      ->id(),
  ]));
  $this
    ->assertEquals($user_form_url
    ->toString(), $this
    ->getSession()
    ->getCurrentUrl());
}