Skip to content

Commit f6aac85

Browse files
authored
Merge pull request #1419 from biigle/annotation-report-test-fix
Order-agnostic result assertion
2 parents 29c1387 + 9e69772 commit f6aac85

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

tests/php/Services/Reports/Volumes/ImageAnnotations/AnnotationReportGeneratorTest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,11 @@ public function testAnnotationSessionSeparateLabelTree()
571571

572572
$session->users()->attach($userId);
573573

574-
$a = ImageAnnotationTest::create([
575-
'image_id' => $image->id,
576-
'created_at' => '2016-10-05 09:15:00',
577-
]);
578-
579574
$al1 = ImageAnnotationLabelTest::create([
580-
'annotation_id' => $a->id,
575+
'annotation_id' => ImageAnnotationTest::create([
576+
'image_id' => $image->id,
577+
'created_at' => '2016-10-05 09:15:00',
578+
])->id,
581579
'user_id' => $userId,
582580
]);
583581

@@ -612,9 +610,15 @@ public function testAnnotationSessionSeparateLabelTree()
612610
$generator->setSource($session->volume);
613611
$results = $generator->initQuery()->get();
614612
$this->assertCount(3, $results);
615-
$this->assertEquals($al1->label->label_tree_id, $results[0]->label_tree_id);
616-
$this->assertEquals($al3->label->label_tree_id, $results[1]->label_tree_id);
617-
$this->assertEquals($al4->label->label_tree_id, $results[2]->label_tree_id);
613+
614+
$this->assertEqualsCanonicalizing(
615+
[
616+
$al1->label->label_tree_id,
617+
$al3->label->label_tree_id,
618+
$al4->label->label_tree_id,
619+
],
620+
$results->pluck('label_tree_id')->all()
621+
);
618622
}
619623

620624
public function testAnnotationSessionNewestLabelSeparateLabelTree()

0 commit comments

Comments
 (0)