fix failing tests

This commit is contained in:
Steffen Mahler 2020-07-06 08:56:04 +02:00
parent 3defbeb03e
commit 56ea5c0a52
2 changed files with 6 additions and 8 deletions

View File

@ -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;
}
/**

View File

@ -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]);
}
}