Skip to content

Commit 2b5c9f8

Browse files
committed
add action is stored when config conditions are true test
1 parent 671533d commit 2b5c9f8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Feature/ActionMonitoringTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use Binafy\LaravelUserMonitoring\Utills\ActionType;
55
use Binafy\LaravelUserMonitoring\Utills\UserUtils;
66
use Illuminate\Foundation\Testing\RefreshDatabase;
7+
use Illuminate\Http\Request;
78
use Illuminate\Support\Facades\DB;
89
use Tests\SetUp\Models\Product;
910
use Tests\SetUp\Models\ProductSoftDelete;
@@ -361,3 +362,19 @@
361362
// DB Assertions
362363
assertDatabaseCount(config('user-monitoring.action_monitoring.table'), 2);
363364
});
365+
366+
test('action is stored when config conditions are true', function () {
367+
config()->set('user-monitoring.action_monitoring.conditions', [
368+
function (Request $request) {
369+
return true;
370+
},
371+
]);
372+
373+
Product::query()->create([
374+
'title' => 'milwad',
375+
'description' => 'WE ARE HELPING TO OPEN-SOURCE WORLD'
376+
]);
377+
378+
// DB Assertions
379+
assertDatabaseCount(config('user-monitoring.action_monitoring.table'), 1);
380+
});

0 commit comments

Comments
 (0)