From 442cbd1cbe854b416cc0c7b08fc5795c7cee28ba Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Wed, 4 Oct 2023 12:08:31 +0200 Subject: [PATCH] Update tests for Laravel 10 References https://github.com/biigle/core/pull/665 --- .../Api/LaserpointsControllerTest.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/Http/Controllers/Api/LaserpointsControllerTest.php b/tests/Http/Controllers/Api/LaserpointsControllerTest.php index e5c28295..6f1aa639 100644 --- a/tests/Http/Controllers/Api/LaserpointsControllerTest.php +++ b/tests/Http/Controllers/Api/LaserpointsControllerTest.php @@ -13,6 +13,7 @@ use Biigle\Tests\ImageAnnotationTest; use Biigle\Tests\ImageTest; use Biigle\Tests\LabelTest; +use Queue; class LaserpointsControllerTest extends ApiTestCase { @@ -37,13 +38,14 @@ public function testComputeImage() $this->makeManualAnnotations($label, 3); - $this->expectsJobs(ProcessImageDelphiJob::class); $this->postJson("/api/v1/images/{$image->id}/laserpoints/area", [ 'distance' => 50, 'label_id' => $label->id, ]) ->assertStatus(200); + Queue::assertPushed(ProcessImageDelphiJob::class); + // Distance is required. $this->postJson("/api/v1/images/{$image->id}/laserpoints/area", [ 'label_id' => $label->id, @@ -82,12 +84,13 @@ public function testComputeImage() $this->makeManualAnnotations($label, 2, 1); $image = Image::first(); - $this->expectsJobs(ProcessImageManualJob::class); $this->post("/api/v1/images/{$image->id}/laserpoints/area", [ 'distance' => 50, 'label_id' => $label->id, ]) ->assertStatus(200); + + Queue::assertPushed(ProcessImageManualJob::class); } public function testComputeImageRemote() @@ -99,12 +102,12 @@ public function testComputeImageRemote() $this->makeManualAnnotations($label, 3); $this->beEditor(); - $this->expectsJobs(ProcessImageDelphiJob::class); $this->postJson("/api/v1/images/{$image->id}/laserpoints/area", [ 'distance' => 50, 'label_id' => $label->id, ]) ->assertStatus(200); + Queue::assertPushed(ProcessImageDelphiJob::class); } public function testComputeImageTiled() @@ -114,12 +117,12 @@ public function testComputeImageTiled() $this->makeManualAnnotations($label, 3); $this->beEditor(); - $this->doesntExpectJobs(ProcessImageDelphiJob::class); $this->postJson("/api/v1/images/{$image->id}/laserpoints/area", [ 'distance' => 50, 'label_id' => $label->id, ]) ->assertStatus(422); + Queue::assertNotPushed(ProcessImageDelphiJob::class); } public function testComputeVolume() @@ -133,12 +136,12 @@ public function testComputeVolume() $this->beEditor(); $this->makeManualAnnotations($label, 3); - $this->expectsJobs(ProcessVolumeDelphiJob::class); $this->postJson("/api/v1/volumes/{$id}/laserpoints/area", [ 'distance' => 50, 'label_id' => $label->id, ]) ->assertStatus(200); + Queue::assertPushed(ProcessVolumeDelphiJob::class); } public function testComputeVolumeValidation() @@ -203,12 +206,12 @@ public function testComputeVolumeRemote() $this->makeManualAnnotations($label, 3); $this->beEditor(); - $this->expectsJobs(ProcessVolumeDelphiJob::class); $this->postJson("/api/v1/volumes/{$id}/laserpoints/area", [ 'distance' => 50, 'label_id' => $label->id, ]) ->assertStatus(200); + Queue::assertPushed(ProcessVolumeDelphiJob::class); } public function testComputeVolumeTiled() @@ -219,12 +222,12 @@ public function testComputeVolumeTiled() $this->makeManualAnnotations($label, 3); $this->beEditor(); - $this->doesntExpectJobs(ProcessVolumeDelphiJob::class); $this->postJson("/api/v1/volumes/{$id}/laserpoints/area", [ 'distance' => 50, 'label_id' => $label->id, ]) ->assertStatus(422); + Queue::assertNotPushed(ProcessVolumeDelphiJob::class); } public function testComputeVideoVolume()