From 21999cac21e80fb29c67c8afb4ca30071852208c Mon Sep 17 00:00:00 2001 From: Jonas De Smet Date: Fri, 20 Nov 2020 01:29:01 +0100 Subject: [PATCH] fix test + added one for new status check --- .../DashboardStatsControllerTest.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/Controller/DashboardStatsControllerTest.php b/tests/Controller/DashboardStatsControllerTest.php index fc10ccd8..4bf64b15 100644 --- a/tests/Controller/DashboardStatsControllerTest.php +++ b/tests/Controller/DashboardStatsControllerTest.php @@ -74,7 +74,7 @@ public function test_paused_status_is_reflected_if_all_master_supervisors_are_pa $masters = Mockery::mock(MasterSupervisorRepository::class); $masters->shouldReceive('all')->andReturn([ (object) [ - 'status' => 'running', + 'status' => 'paused', ], (object) [ 'status' => 'paused', @@ -89,4 +89,25 @@ public function test_paused_status_is_reflected_if_all_master_supervisors_are_pa 'status' => 'paused', ]); } + + public function test_paused_status_isnt_reflected_if_not_all_master_supervisors_are_paused() + { + $masters = Mockery::mock(MasterSupervisorRepository::class); + $masters->shouldReceive('all')->andReturn([ + (object) [ + 'status' => 'running', + ], + (object) [ + 'status' => 'paused', + ], + ]); + $this->app->instance(MasterSupervisorRepository::class, $masters); + + $response = $this->actingAs(new Fakes\User) + ->get('/horizon/api/stats'); + + $response->assertJson([ + 'status' => 'running', + ]); + } }