From 6f43378ef4eb50db5e85d91b7ec5eff0d27edcdb Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 22 Jan 2025 11:47:10 -0500 Subject: [PATCH] Add test for non-arrays which worked before this pr --- tests/Search/CombTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Search/CombTest.php b/tests/Search/CombTest.php index 13a73d620b..897dea3fe2 100644 --- a/tests/Search/CombTest.php +++ b/tests/Search/CombTest.php @@ -255,6 +255,20 @@ public function it_can_search_for_umlauts() #[Test] public function it_filters_out_results_with_disallowed_words() + { + $comb = new Comb([ + ['title' => 'Pizza', 'ingredients' => 'Tomato, Cheese, Bread'], + ['title' => 'Tomato Soup', 'ingredients' => 'Tomato, Water, Salt'], + ['title' => 'Chicken & Sweetcorn Soup', 'ingredients' => 'Chicken, Sweetcorn, Water'], + ]); + + $results = $comb->lookUp('soup -tomato'); + + $this->assertEquals(['Chicken & Sweetcorn Soup'], collect($results['data'] ?? [])->pluck('data.title')->all()); + } + + #[Test] + public function it_filters_out_results_with_disallowed_words_where_results_are_arrays() { $comb = new Comb([ ['title' => 'Pizza', 'ingredients' => ['Tomato', 'Cheese', 'Bread']],