public function CartBlockTest::testCartBlock in Ubercart 8.4
Test cart block functionality.
File
- uc_cart/
tests/ src/ Functional/ CartBlockTest.php, line 37
Class
- CartBlockTest
- Tests the cart block functionality.
Namespace
Drupal\Tests\uc_cart\FunctionalCode
public function testCartBlock() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// Test the empty cart block.
$this
->drupalGet('');
$assert
->responseContains('empty');
$assert
->pageTextContains('There are no products in your shopping cart.');
$assert
->pageTextContains('0 Items');
$assert
->pageTextContains('Total: $0.00');
$assert
->linkNotExists('View cart');
$assert
->linkNotExists('Checkout');
// Test the cart block with an item.
$this
->addToCart($this->product);
$this
->drupalGet('');
$assert
->responseNotContains('empty');
$assert
->pageTextNotContains('There are no products in your shopping cart.');
$assert
->pageTextContains('1 ×');
$assert
->pageTextContains($this->product
->label());
$this
->assertNoUniqueText(uc_currency_format($this->product->price->value));
$assert
->pageTextContains('1 Item');
$assert
->pageTextContains('Total: ' . uc_currency_format($this->product->price->value));
$assert
->linkExists('View cart');
$assert
->linkExists('Checkout');
}