Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jun 4, 2024
1 parent 11c363c commit 0249e47
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/Http/Middleware/CartMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Igniter\Cart\Facades\Cart;
use Igniter\Cart\Http\Middleware\CartMiddleware;
use Igniter\Cart\Models\CartSettings;
use Igniter\Local\Contracts\LocationInterface;
use Igniter\Local\Facades\Location;
use Igniter\User\Facades\Auth;
Expand Down Expand Up @@ -39,7 +40,7 @@
});

it('terminates with abandoned cart and authenticated user', function() {
config(['igniter-cart.abandonedCart' => true]);
CartSettings::set('abandoned_cart', true);

$userMock = Mockery::mock(User::class);
$userMock->shouldReceive('getKey')->andReturn(1);
Expand All @@ -53,7 +54,7 @@
});

it('terminates without abandoned cart', function() {
config(['igniter-cart.abandonedCart' => false]);
CartSettings::set('abandoned_cart', false);
Auth::expects('check')->never();
Cart::expects('store')->never();

Expand All @@ -62,7 +63,7 @@
});

it('terminates with abandoned cart but unauthenticated user', function() {
config(['igniter-cart.abandonedCart' => true]);
CartSettings::set('abandoned_cart', true);
Auth::shouldReceive('check')->andReturn(false);
Cart::expects('content')->never();

Expand All @@ -71,7 +72,7 @@
});

it('terminates with abandoned cart, authenticated user but empty cart', function() {
config(['igniter-cart.abandonedCart' => true]);
CartSettings::set('abandoned_cart', true);
Auth::shouldReceive('check')->andReturn(true);
Cart::shouldReceive('content')->andReturn(collect());
Cart::expects('store')->never();
Expand Down

0 comments on commit 0249e47

Please sign in to comment.