File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 222222 assertDatabaseCount (config ('user-monitoring.action_monitoring.table ' ), 4 );
223223 assertDatabaseHas (config ('user-monitoring.action_monitoring.table ' ), ['page ' => url ('/ ' )]);
224224});
225+
226+ test ('action not stored when the on_restore config is false ' , function () {
227+ $ user = createUser ();
228+ auth ()->login ($ user );
229+
230+ $ product = \Tests \SetUp \Models \ProductSoftDelete::query ()->create ([
231+ 'title ' => 'milwad ' ,
232+ 'description ' => 'WE ARE HELPING TO OPEN-SOURCE WORLD '
233+ ]);
234+
235+ $ product ->delete ();
236+ $ product ->restore ();
237+
238+ // Assertions
239+ expect (ActionMonitoring::query ()->value ('table_name ' ))
240+ ->toBe ('products ' )
241+ ->and (ActionMonitoring::query ()->where ('id ' , 4 )->value ('action_type ' ))
242+ ->toBeNull ()
243+ ->and ($ user ->name )
244+ ->toBe (ActionMonitoring::first ()->user ->name );
245+
246+ // DB Assertions
247+ assertDatabaseCount ('products ' , 1 );
248+ assertDatabaseCount (config ('user-monitoring.action_monitoring.table ' ), 3 );
249+ assertDatabaseHas (config ('user-monitoring.action_monitoring.table ' ), ['page ' => url ('/ ' )]);
250+ });
You can’t perform that action at this time.
0 commit comments