Skip to content
This repository has been archived by the owner on Jul 9, 2020. It is now read-only.

Commit

Permalink
Add test for annotation session to annotations endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Sep 7, 2016
1 parent d5b5602 commit a991d93
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Dias\Role;
use Carbon\Carbon;

class AnnotationsModuleHttpControllersAnnotationControllerTest extends ApiTestCase {

Expand Down Expand Up @@ -41,4 +42,25 @@ public function testShow() {
$this->get('annotations/'.$annotation->id);
$this->assertRedirectedTo('annotate/'.$annotation->image_id.'?annotation='.$annotation->id);
}

public function testShowAnnotationSession()
{
$annotation = AnnotationTest::create([
'created_at' => Carbon::yesterday(),
]);
$this->project()->addTransectId($annotation->image->transect_id);

AnnotationSessionTest::create([
'transect_id' => $annotation->image->transect_id,
'starts_at' => Carbon::today(),
'ends_at' => Carbon::tomorrow(),
'hide_own_annotations' => true,
'hide_other_users_annotations' => true,
]);

$this->beAdmin();
$this->get("annotations/{$annotation->id}");
$this->assertResponseStatus(403);
}

}

0 comments on commit a991d93

Please sign in to comment.