diff --git a/src/Support/Demo/Actions/DeleteAllSharedLinksAction.php b/src/Support/Demo/Actions/DeleteAllSharedLinksAction.php index 389b516f..964087ad 100644 --- a/src/Support/Demo/Actions/DeleteAllSharedLinksAction.php +++ b/src/Support/Demo/Actions/DeleteAllSharedLinksAction.php @@ -1,12 +1,20 @@ delete(); + // Get howdy account + $user = User::where('email', 'howdy@hi5ve.digital') + ->first(); + + // Delete howdy shared links + DB::table('shares') + ->where('user_id', $user->id) + ->delete(); } } diff --git a/tests/Support/Demo/DemoTest.php b/tests/Support/Demo/DemoTest.php new file mode 100644 index 00000000..963b8329 --- /dev/null +++ b/tests/Support/Demo/DemoTest.php @@ -0,0 +1,41 @@ +hasSettings() + ->create(); + + $howdy = User::factory() + ->hasSettings() + ->create([ + 'email' => 'howdy@hi5ve.digital', + ]); + + Share::factory() + ->create(['user_id' => $user->id]); + + Share::factory() + ->create(['user_id' => $howdy->id]); + + resolve(DeleteAllSharedLinksAction::class)(); + + $this->assertDatabaseHas('shares', [ + 'user_id' => $user->id, + ])->assertDatabaseMissing('shares', [ + 'user_id' => $howdy->id, + ]); + } +} \ No newline at end of file