File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -117,4 +117,41 @@ public function it_applies_taxonomy_wheres_using_pluck_count_and_get()
117117 $ this ->assertSame (1 , $ taxonomy ->queryTerms ()->count ());
118118 $ this ->assertSame ($ term ->slug (), $ taxonomy ->queryTerms ()->get ()->pluck ('slug ' )->first ());
119119 }
120+
121+ #[Test]
122+ public function it_does_not_cache_null_taxonomy_lookups ()
123+ {
124+ $ taxonomy = TaxonomyFacade::findByHandle ('future ' );
125+ $ this ->assertNull ($ taxonomy );
126+
127+ // Create taxonomy directly in DB, bypassing TaxonomyRepository::save().
128+ $ modelClass = app ('statamic.eloquent.taxonomies.model ' );
129+ $ modelClass ::create ([
130+ 'handle ' => 'future ' ,
131+ 'title ' => 'Future Taxonomy ' ,
132+ 'sites ' => ['en ' ],
133+ 'settings ' => [],
134+ ]);
135+
136+ $ taxonomy = TaxonomyFacade::findByHandle ('future ' );
137+
138+ $ this ->assertNotNull ($ taxonomy );
139+ $ this ->assertEquals ('future ' , $ taxonomy ->handle ());
140+ }
141+
142+ #[Test]
143+ public function it_queries_terms_with_taxonomy_available ()
144+ {
145+ Taxonomy::make ('tags ' )->title ('Tags ' )->save ();
146+ TermFacade::make ('test-tag ' )->taxonomy ('tags ' )->data (['title ' => 'Test Tag ' ])->save ();
147+
148+ Blink::flush ();
149+
150+ $ terms = TermFacade::query ()->get ();
151+
152+ $ this ->assertCount (1 , $ terms );
153+ $ this ->assertEquals ('test-tag ' , $ terms ->first ()->slug ());
154+ $ this ->assertNotNull ($ terms ->first ()->taxonomy ());
155+ $ this ->assertEquals ('tags ' , $ terms ->first ()->taxonomy ()->handle ());
156+ }
120157}
You can’t perform that action at this time.
0 commit comments