Skip to content

Commit 3029638

Browse files
committed
update test
1 parent c950b22 commit 3029638

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/Data/Taxonomies/TermQueryBuilderTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,21 +687,26 @@ public function it_ensures_taxonomy_column_is_selected_when_columns_are_specifie
687687
$terms = Term::query()->get(['slug', 'data']);
688688
$this->assertCount(2, $terms);
689689
$this->assertEquals(['a', 'b'], $terms->map->slug()->all());
690+
// Verify terms can be properly instantiated (requires taxonomy column)
691+
$this->assertEquals('tags', $terms->first()->taxonomy()->handle());
690692

691-
// When empty array is passed, should not add taxonomy column
693+
// When empty array is passed, should get default behavior (all columns)
692694
$terms = Term::query()->get([]);
693695
$this->assertCount(2, $terms);
694696
$this->assertEquals(['a', 'b'], $terms->map->slug()->all());
697+
$this->assertEquals('tags', $terms->first()->taxonomy()->handle());
695698

696699
// When * is requested, taxonomy is included automatically
697700
$terms = Term::query()->get(['*']);
698701
$this->assertCount(2, $terms);
699702
$this->assertEquals(['a', 'b'], $terms->map->slug()->all());
703+
$this->assertEquals('tags', $terms->first()->taxonomy()->handle());
700704

701705
// When taxonomy is already included, should not be duplicated
702706
$terms = Term::query()->get(['slug', 'taxonomy', 'data']);
703707
$this->assertCount(2, $terms);
704708
$this->assertEquals(['a', 'b'], $terms->map->slug()->all());
709+
$this->assertEquals('tags', $terms->first()->taxonomy()->handle());
705710
}
706711

707712
#[Test]
@@ -716,20 +721,25 @@ public function it_ensures_taxonomy_column_is_selected_when_paginating_with_colu
716721
$paginated = Term::query()->paginate(2, ['slug', 'data']);
717722
$this->assertCount(2, $paginated);
718723
$this->assertEquals(['a', 'b'], $paginated->getCollection()->map->slug()->all());
724+
// Verify terms can be properly instantiated (requires taxonomy column)
725+
$this->assertEquals('tags', $paginated->first()->taxonomy()->handle());
719726

720-
// When empty array is passed to paginate, should not add taxonomy column
727+
// When empty array is passed to paginate, should get default behavior (all columns)
721728
$paginated = Term::query()->paginate(2, []);
722729
$this->assertCount(2, $paginated);
723730
$this->assertEquals(['a', 'b'], $paginated->getCollection()->map->slug()->all());
731+
$this->assertEquals('tags', $paginated->first()->taxonomy()->handle());
724732

725733
// When * is requested in paginate, taxonomy is included automatically
726734
$paginated = Term::query()->paginate(2, ['*']);
727735
$this->assertCount(2, $paginated);
728736
$this->assertEquals(['a', 'b'], $paginated->getCollection()->map->slug()->all());
737+
$this->assertEquals('tags', $paginated->first()->taxonomy()->handle());
729738

730739
// When taxonomy is already included in paginate, should not be duplicated
731740
$paginated = Term::query()->paginate(2, ['slug', 'taxonomy', 'data']);
732741
$this->assertCount(2, $paginated);
733742
$this->assertEquals(['a', 'b'], $paginated->getCollection()->map->slug()->all());
743+
$this->assertEquals('tags', $paginated->first()->taxonomy()->handle());
734744
}
735745
}

0 commit comments

Comments
 (0)