File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 194194 assertDatabaseCount (config ('user-monitoring.action_monitoring.table ' ), 3 );
195195 assertDatabaseHas (config ('user-monitoring.action_monitoring.table ' ), ['page ' => url ('/ ' )]);
196196});
197+
198+ test ('restore a model in acting monitoring ' , function () {
199+ config ()->set ('user-monitoring.action_monitoring.on_restore ' , true );
200+
201+ $ user = createUser ();
202+ auth ()->login ($ user );
203+
204+ $ product = \Tests \SetUp \Models \ProductSoftDelete::query ()->create ([
205+ 'title ' => 'milwad ' ,
206+ 'description ' => 'WE ARE HELPING TO OPEN-SOURCE WORLD '
207+ ]);
208+
209+ $ product ->delete ();
210+ $ product ->restore ();
211+
212+ // Assertions
213+ expect (ActionMonitoring::query ()->value ('table_name ' ))
214+ ->toBe ('products ' )
215+ ->and (ActionMonitoring::query ()->where ('id ' , 4 )->value ('action_type ' ))
216+ ->toBe (ActionType::ACTION_RESTORED )
217+ ->and ($ user ->name )
218+ ->toBe (ActionMonitoring::first ()->user ->name );
219+
220+ // DB Assertions
221+ assertDatabaseCount ('products ' , 1 );
222+ assertDatabaseCount (config ('user-monitoring.action_monitoring.table ' ), 4 );
223+ assertDatabaseHas (config ('user-monitoring.action_monitoring.table ' ), ['page ' => url ('/ ' )]);
224+ });
You can’t perform that action at this time.
0 commit comments