mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[Cart] Cover remaining scenarios
This commit is contained in:
parent
86a0e91300
commit
834bdc1eae
2 changed files with 5 additions and 6 deletions
|
|
@ -10,17 +10,17 @@ Feature: Viewing a total quantity of the cart
|
|||
And the store has a product "Sylius T-Shirt"
|
||||
And the store has a product "Symfony T-Shirt"
|
||||
|
||||
@no-api @todo-ui
|
||||
@no-api @ui @javascript
|
||||
Scenario: Viewing a total quantity for 1 product with quantity equals 1
|
||||
When I add product "PHP T-Shirt" to the cart
|
||||
Then I should see cart total quantity is 1
|
||||
|
||||
@no-api @todo-ui
|
||||
@no-api @ui @javascript
|
||||
Scenario: Viewing a total quantity for 1 product with quantity equals 2
|
||||
When I add 2 products "PHP T-Shirt" to the cart
|
||||
Then I should see cart total quantity is 2
|
||||
|
||||
@no-api @todo-ui
|
||||
@no-api @ui @javascript
|
||||
Scenario: Viewing a total quantity for 3 products with various quantities
|
||||
When I add 2 products "PHP T-Shirt" to the cart
|
||||
And I add 3 products "Sylius T-Shirt" to the cart
|
||||
|
|
|
|||
|
|
@ -19,10 +19,9 @@ final class CartWidgetElement extends Element implements CartWidgetElementInterf
|
|||
{
|
||||
public function getCartTotalQuantity(): int
|
||||
{
|
||||
$cartTotal = $this->getElement('cart_button')->getText();
|
||||
preg_match('/.+,\s(\d+)\s(items|item)/', $cartTotal, $parts);
|
||||
$quantity = $this->getElement('cart_button')->getText();
|
||||
|
||||
return (int) ($parts[1] ?? 0);
|
||||
return (int) ($quantity ?? 0);
|
||||
}
|
||||
|
||||
protected function getDefinedElements(): array
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue