You are here

public function CartBlockTest::testHiddenCartBlock in Ubercart 8.4

Test hide cart when empty functionality.

File

uc_cart/tests/src/Functional/CartBlockTest.php, line 69

Class

CartBlockTest
Tests the cart block functionality.

Namespace

Drupal\Tests\uc_cart\Functional

Code

public function testHiddenCartBlock() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();
  $this->block
    ->getPlugin()
    ->setConfigurationValue('hide_empty', TRUE);
  $this->block
    ->save();

  // Test the empty cart block.
  $this
    ->drupalGet('');
  $assert
    ->pageTextNotContains($this->block
    ->label());

  // Test the cart block with an item.
  $this
    ->addToCart($this->product);
  $this
    ->drupalGet('');
  $assert
    ->pageTextContains($this->block
    ->label());
}