@@ -125,6 +125,51 @@ public function test_can_search_using_belongs_to_field_with_custom_foreign_key()
125125 ->assertJsonCount (2 , 'data ' );
126126 }
127127
128+ public function test_can_search_strings_with_quotes_and_double_quotes (): void
129+ {
130+ Post::factory ()->create ([
131+ 'title ' => "A Guy Named O'Neal was Standing at 5 o'clock with a 10 \" cookie. " ,
132+ ]);
133+
134+ $ this ->getJson (PostRepository::route (query: ['search ' => 'John ' ]))
135+ ->assertJsonCount (0 , 'data ' );
136+
137+ $ this ->getJson (PostRepository::route (query: ['search ' => 'Guy ' ]))
138+ ->assertJsonCount (1 , 'data ' );
139+
140+ $ this ->getJson (PostRepository::route (query: ['search ' => "5 o'clock " ]))
141+ ->assertJsonCount (1 , 'data ' );
142+
143+ $ this ->getJson (PostRepository::route (query: ['search ' => '10" present ' ]))
144+ ->assertJsonCount (0 , 'data ' );
145+
146+ $ this ->getJson (PostRepository::route (query: ['search ' => '10" cookie ' ]))
147+ ->assertJsonCount (1 , 'data ' );
148+
149+ $ this ->getJson (PostRepository::route (query: ['search ' => '150TPL5 (1 1/2" PVC SCH40 THREADED PLUG ' ]))
150+ ->assertJsonCount (0 , 'data ' );
151+
152+ config ()->set ('restify.search.case_sensitive ' , false );
153+
154+ $ this ->getJson (PostRepository::route (query: ['search ' => 'John ' ]))
155+ ->assertJsonCount (0 , 'data ' );
156+
157+ $ this ->getJson (PostRepository::route (query: ['search ' => 'Guy ' ]))
158+ ->assertJsonCount (1 , 'data ' );
159+
160+ $ this ->getJson (PostRepository::route (query: ['search ' => "5 o'clock " ]))
161+ ->assertJsonCount (1 , 'data ' );
162+
163+ $ this ->getJson (PostRepository::route (query: ['search ' => '10" present ' ]))
164+ ->assertJsonCount (0 , 'data ' );
165+
166+ $ this ->getJson (PostRepository::route (query: ['search ' => '10" cookie ' ]))
167+ ->assertJsonCount (1 , 'data ' );
168+
169+ $ this ->getJson (PostRepository::route (query: ['search ' => '150TPL5 (1 1/2" PVC SCH40 THREADED PLUG ' ]))
170+ ->assertJsonCount (0 , 'data ' );
171+ }
172+
128173 public function test_can_match_closure (): void
129174 {
130175 User::factory (4 )->create ();
0 commit comments