Skip to content

Commit fc57d9c

Browse files
committed
improve the model replication test spatie#1093
1 parent a361048 commit fc57d9c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/LogsActivityTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,13 @@ public function getActivitylogOptions(): LogOptions
105105

106106
$this->assertCount(2, $activityItems);
107107

108-
$this->assertTrue($activityItems->every(fn (Activity $item) => $item->event === 'created' &&
108+
$this->assertTrue($activityItems->every(fn (Activity $item): bool => $item->event === 'created' &&
109109
$item->description === 'created' &&
110-
get_class($this->article) === $item->subject_type));
110+
get_class($this->article) === $item->subject_type &&
111+
in_array($item->subject_id, [$article->id, $replicatedArticle->id])));
111112

112-
$this->assertEquals($replicatedArticle->id, $this->getLastActivity()->subject_id);
113+
$this->assertEquals($article->id, $activityItems->first()->subject_id);
114+
$this->assertEquals($replicatedArticle->id, $activityItems->last()->subject_id);
113115
});
114116

115117
it('will log the deletion of a model without softdeletes', function () {

0 commit comments

Comments
 (0)