You are here

public function CartSettingsTest::testAddToCartMessage in Ubercart 8.4

Tests add-to-cart message.

File

uc_cart/tests/src/Functional/CartSettingsTest.php, line 36

Class

CartSettingsTest
Tests the cart settings page.

Namespace

Drupal\Tests\uc_cart\Functional

Code

public function testAddToCartMessage() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->addToCart($this->product);
  $assert
    ->pageTextContains($this->product
    ->getTitle() . ' added to your shopping cart.');
  $this
    ->drupalGet('cart');
  $this
    ->submitForm([], 'Remove');
  $this
    ->drupalGet('admin/store/config/cart');
  $this
    ->submitForm([
    'uc_cart_add_item_msg' => FALSE,
  ], 'Save configuration');
  $this
    ->addToCart($this->product);
  $assert
    ->pageTextNotContains($this->product
    ->getTitle() . ' added to your shopping cart.');
}