1111use MongoDB \Driver \Exception \ServerException ;
1212use MongoDB \Laravel \Schema \Builder ;
1313use MongoDB \Laravel \Tests \TestCase ;
14+ use PHPUnit \Framework \Attributes \Group ;
1415
1516use function array_map ;
1617use function mt_getrandmax ;
1920use function srand ;
2021use function usleep ;
2122
23+ #[Group('atlas-search ' )]
2224class AtlasSearchTest extends TestCase
2325{
2426 private array $ vectors ;
@@ -84,7 +86,7 @@ protected function setUp(): void
8486 do {
8587 $ ready = true ;
8688 usleep (10_000 );
87- foreach ($ collection ->listSearchIndexes () as $ index ) {
89+ foreach ($ moviesCollection ->listSearchIndexes () as $ index ) {
8890 if ($ index ['status ' ] !== 'READY ' ) {
8991 $ ready = false ;
9092 }
@@ -102,7 +104,7 @@ public function testSimpleSearch(): void
102104 $ movies = Movie::search (
103105 sort: ['title ' => 1 ],
104106 operator: Search::text ('title ' , 'dream ' ),
105- )->get ();
107+ )->all ();
106108 // end-search-query
107109
108110 $ this ->assertNotNull ($ movies );
@@ -113,10 +115,10 @@ public function testSimpleSearch(): void
113115 * @runInSeparateProcess
114116 * @preserveGlobalState disabled
115117 */
116- public function autocompleteSearchTest (): void
118+ public function testAutocompleteSearch (): void
117119 {
118120 // start-auto-query
119- $ movies = Movie::autocomplete ('title ' , 'jak ' )->get ();
121+ $ movies = Movie::autocomplete ('title ' , 'jak ' )->all ();
120122 // end-auto-query
121123
122124 $ this ->assertNotNull ($ movies );
@@ -127,9 +129,9 @@ public function autocompleteSearchTest(): void
127129 * @runInSeparateProcess
128130 * @preserveGlobalState disabled
129131 */
130- public function vectorSearchTest (): void
132+ public function testVectorSearch (): void
131133 {
132- $ results = Book ::vectorSearch (
134+ $ results = Movie ::vectorSearch (
133135 index: 'vector ' ,
134136 path: 'vector4 ' ,
135137 queryVector: $ this ->vectors [0 ],
@@ -141,7 +143,7 @@ public function vectorSearchTest(): void
141143 );
142144
143145 $ this ->assertNotNull ($ results );
144- $ this ->assertSame ('C ' , $ results ->first ()->title );
146+ $ this ->assertSame ('D ' , $ results ->first ()->title );
145147 }
146148
147149 /** Generates random vectors using fixed seed to make tests deterministic */
0 commit comments