Skip to content

Commit

Permalink
fix test for mariadb
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Apr 29, 2022
1 parent 2507fb7 commit 39d068b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/Units/Domain/EagerLoadingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Bavix\Wallet\Test\Units\Domain;

use Bavix\Wallet\Interfaces\ProductInterface;
use Bavix\Wallet\Objects\Cart;
use Bavix\Wallet\Test\Infra\Factories\BuyerFactory;
use Bavix\Wallet\Test\Infra\Factories\ItemFactory;
Expand Down Expand Up @@ -95,7 +96,7 @@ public function testEagerLoaderPay(): void
$buyer = BuyerFactory::new()->create();
/** @var Item[] $products */
$products = ItemFactory::times(50)->create([
'quantity' => 10,
'quantity' => 5,
'price' => 1,
]);
$productIds = [];
Expand All @@ -104,15 +105,16 @@ public function testEagerLoaderPay(): void
self::assertSame(0, $product->balanceInt);
}

/** @var ProductInterface[] $products */
$products = Item::query()->whereKey($productIds)->get()->all();

$cart = app(Cart::class);
foreach ($products as $product) {
$cart = $cart->withItem($product, 10);
$cart = $cart->withItem($product, 5);
}

$transfers = $buyer->forcePayCart($cart);
self::assertSame((int) -$cart->getTotal($buyer), $buyer->balanceInt);
self::assertCount(500, $transfers);
self::assertCount(250, $transfers);
}
}

0 comments on commit 39d068b

Please sign in to comment.