Skip to content

Commit db8d3ba

Browse files
committed
add action not stored when the guest mode is off and user not logged in test
1 parent 504ac7f commit db8d3ba

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/Feature/ActionMonitoringTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Foundation\Testing\RefreshDatabase;
77
use Illuminate\Support\Facades\DB;
88
use Tests\SetUp\Models\Product;
9+
use Tests\SetUp\Models\ProductSoftDelete;
910
use function Pest\Laravel\{assertDatabaseCount, assertDatabaseHas};
1011

1112
/*
@@ -226,7 +227,7 @@
226227
$user = createUser();
227228
auth()->login($user);
228229

229-
$product = \Tests\SetUp\Models\ProductSoftDelete::query()->create([
230+
$product = ProductSoftDelete::query()->create([
230231
'title' => 'milwad',
231232
'description' => 'WE ARE HELPING TO OPEN-SOURCE WORLD'
232233
]);
@@ -252,7 +253,7 @@
252253
$user = createUser();
253254
auth()->login($user);
254255

255-
$product = \Tests\SetUp\Models\ProductSoftDelete::query()->create([
256+
$product = ProductSoftDelete::query()->create([
256257
'title' => 'milwad',
257258
'description' => 'WE ARE HELPING TO OPEN-SOURCE WORLD'
258259
]);
@@ -302,3 +303,16 @@
302303
expect($actionMonitoring->getTypeColor())->toBe($colors[$type]);
303304
}
304305
});
306+
307+
test('action not stored when the guest mode is off and user not logged in', function () {
308+
config()->set('user-monitoring.action_monitoring.guest_mode', false);
309+
310+
$product = Product::query()->create([
311+
'title' => 'milwad',
312+
'description' => 'WE ARE HELPING TO OPEN-SOURCE WORLD'
313+
]);
314+
$product->delete();
315+
316+
// DB Assertions
317+
assertDatabaseCount(config('user-monitoring.action_monitoring.table'), 0);
318+
});

0 commit comments

Comments
 (0)