From 9fb28c2ea3130da1989e782caee8d523351bda98 Mon Sep 17 00:00:00 2001 From: GuntherDebrauwer <22586858+GuntherDebrauwer@users.noreply.github.com> Date: Wed, 16 Oct 2019 18:35:28 +0200 Subject: [PATCH] Add feature test to check paged deletion --- tests/Feature/MonitoringTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Feature/MonitoringTest.php b/tests/Feature/MonitoringTest.php index 60f1c570..4b4603cf 100644 --- a/tests/Feature/MonitoringTest.php +++ b/tests/Feature/MonitoringTest.php @@ -64,4 +64,18 @@ public function test_completed_jobs_are_removed_from_database_when_their_tag_is_ dispatch(new StopMonitoringTag('first')); $this->assertEquals(0, $this->monitoredJobs('first')); } + + public function test_all_completed_jobs_are_removed_from_database_when_their_tag_is_no_longer_monitored() + { + dispatch(new MonitorTag('first')); + + for ($i = 0; $i < 80; $i++) { + Queue::push(new Jobs\BasicJob); + } + + $this->work(); + + dispatch(new StopMonitoringTag('first')); + $this->assertEquals(0, $this->monitoredJobs('first')); + } }