app->make(DiscountRepository::class); $discountChecker = $this->app->make(DiscountEligibilityChecker::class); $order = Order::create(['user_id' => $this->user->id , 'count' => 1, 'items_total' => 50, 'total' => 50,]); $discounts = $repository->findActive(); $filtered = $discounts->filter(function ($item) use ($order,$discountChecker) { return $discountChecker->isEligible($order, $item); }); $this->assertEquals(0,$filtered->count()); } }