public function testRelatedCategoriesUrlTitleScope() { $urlTitle = 'entry-1'; $entry = Title::urlTitle($urlTitle)->get()->first(); $expected = []; foreach ($entry->categories as $category) { $expected[] = $category->cat_id; } $this->assertThat(Title::relatedCategoriesUrlTitle($urlTitle)->get(), new CollectionNestedCollectionPropertyHasOneValueConstraint($expected, 'categories', 'cat_id')); }