|
4 | 4 |
|
5 | 5 | use Facades\Tests\Factories\EntryFactory; |
6 | 6 | use Illuminate\Support\Collection; |
| 7 | +use Mockery; |
7 | 8 | use PHPUnit\Framework\Attributes\DataProvider; |
8 | 9 | use PHPUnit\Framework\Attributes\Test; |
9 | 10 | use Statamic\Contracts\Entries\Collection as CollectionContract; |
@@ -93,6 +94,19 @@ public function it_augments_to_a_single_term_when_max_items_is_one() |
93 | 94 | $this->assertEquals('tags::one', $augmented->id()); |
94 | 95 | } |
95 | 96 |
|
| 97 | + #[Test] |
| 98 | + public function it_augments_to_the_term_of_the_configured_term_when_the_slug_exists_in_multiple_taxonomies() |
| 99 | + { |
| 100 | + Term::make('shared')->taxonomy('tags')->dataForLocale('en', ['title' => 'Shared Tag'])->save(); |
| 101 | + Term::make('shared')->taxonomy('categories')->dataForLocale('en', ['title' => 'Shared Category'])->save(); |
| 102 | + |
| 103 | + $tag = $this->fieldtype(['taxonomies' => 'tags', 'max_items' => 1])->augment('shared'); |
| 104 | + $category = $this->fieldtype(['taxonomies' => 'categories', 'max_items' => 1])->augment('shared'); |
| 105 | + |
| 106 | + $this->assertEquals('tags::shared', $tag->id()); |
| 107 | + $this->assertEquals('categories::shared', $category->id()); |
| 108 | + } |
| 109 | + |
96 | 110 | #[Test] |
97 | 111 | public function it_localizes_the_augmented_items_to_the_parent_entrys_locale() |
98 | 112 | { |
@@ -396,7 +410,7 @@ public function it_falls_back_to_a_collection_where_clause_when_the_query_builde |
396 | 410 | { |
397 | 411 | $parent = EntryFactory::id('parent')->collection('blog')->slug('theparent')->locale('fr')->create(); |
398 | 412 |
|
399 | | - $builder = \Mockery::mock(Builder::class); |
| 413 | + $builder = Mockery::mock(Builder::class); |
400 | 414 | $builder->shouldReceive('whereIn')->with('id', ['tags::one'])->once()->andReturnSelf(); |
401 | 415 | $builder->shouldReceive('where')->with('site', 'fr')->once()->andReturnSelf(); |
402 | 416 | $builder->shouldReceive('where')->with('collection', 'blog')->once()->andReturnSelf(); |
|
0 commit comments