Skip to content

Commit

Permalink
Update tests for Laravel 10
Browse files Browse the repository at this point in the history
References biigle/core#665
  • Loading branch information
mzur committed Oct 4, 2023
1 parent 66bdaca commit 442cbd1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/Http/Controllers/Api/LaserpointsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Biigle\Tests\ImageAnnotationTest;
use Biigle\Tests\ImageTest;
use Biigle\Tests\LabelTest;
use Queue;

class LaserpointsControllerTest extends ApiTestCase
{
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 442cbd1

Please sign in to comment.