Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests for Laravel 10 #64

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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