fix failing tests
This commit is contained in:
parent
3defbeb03e
commit
56ea5c0a52
|
|
@ -637,8 +637,6 @@ class Cart
|
|||
*/
|
||||
public function validateItems(): bool
|
||||
{
|
||||
$result = false;
|
||||
|
||||
if (! $cart = $this->getCart()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -647,9 +645,9 @@ class Cart
|
|||
$this->cartRepository->delete($cart->id);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
$isDirty = false;
|
||||
foreach ($cart->items as $item) {
|
||||
$validationResult = $item->product->getTypeInstance()->validateCartItem($item);
|
||||
|
||||
|
|
@ -667,10 +665,10 @@ class Cart
|
|||
'base_total' => $price * $item->quantity,
|
||||
], $item->id);
|
||||
|
||||
$result |= $validationResult->isCartDirty();
|
||||
$isDirty |= $validationResult->isCartDirty();
|
||||
}
|
||||
|
||||
return $result;
|
||||
return !$isDirty;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class TaxCest
|
|||
|
||||
public function _before(UnitTester $I)
|
||||
{
|
||||
$country = strtoupper(Config::get('app.default_country')) ?? 'DE';
|
||||
$country = strtoupper(Config::get('app.default_country') ?? 'DE');
|
||||
|
||||
$tax1 = $I->have(TaxRate::class, [
|
||||
'country' => $country,
|
||||
|
|
@ -104,9 +104,9 @@ class TaxCest
|
|||
[$this->scenario['cart'], false]
|
||||
);
|
||||
|
||||
foreach ($result as $taxRate => $taxAmount) {
|
||||
foreach ($this->scenario['expectedTaxRates'] as $taxRate => $taxAmount) {
|
||||
$I->assertTrue(array_key_exists($taxRate, $result));
|
||||
$I->assertEquals($this->scenario['expectedTaxRates'][$taxRate], $taxAmount);
|
||||
$I->assertEquals($taxAmount, $result[$taxRate]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue