10
10
use MongoDB \Builder \Search ;
11
11
use MongoDB \Driver \Exception \ServerException ;
12
12
use MongoDB \Laravel \Schema \Builder ;
13
+ use MongoDB \Laravel \Tests \Models \Book ;
13
14
use MongoDB \Laravel \Tests \TestCase ;
15
+ use PHPUnit \Framework \Attributes \Group ;
14
16
15
17
use function array_map ;
16
18
use function mt_getrandmax ;
19
21
use function srand ;
20
22
use function usleep ;
21
23
24
+ #[Group('atlas-search ' )]
22
25
class AtlasSearchTest extends TestCase
23
26
{
24
27
private array $ vectors ;
@@ -84,7 +87,7 @@ protected function setUp(): void
84
87
do {
85
88
$ ready = true ;
86
89
usleep (10_000 );
87
- foreach ($ collection ->listSearchIndexes () as $ index ) {
90
+ foreach ($ moviesCollection ->listSearchIndexes () as $ index ) {
88
91
if ($ index ['status ' ] !== 'READY ' ) {
89
92
$ ready = false ;
90
93
}
@@ -102,7 +105,7 @@ public function testSimpleSearch(): void
102
105
$ movies = Movie::search (
103
106
sort: ['title ' => 1 ],
104
107
operator: Search::text ('title ' , 'dream ' ),
105
- )->get ();
108
+ )->all ();
106
109
// end-search-query
107
110
108
111
$ this ->assertNotNull ($ movies );
@@ -113,10 +116,10 @@ public function testSimpleSearch(): void
113
116
* @runInSeparateProcess
114
117
* @preserveGlobalState disabled
115
118
*/
116
- public function autocompleteSearchTest (): void
119
+ public function testAutocompleteSearch (): void
117
120
{
118
121
// start-auto-query
119
- $ movies = Movie::autocomplete ('title ' , 'jak ' )->get ();
122
+ $ movies = Movie::autocomplete ('title ' , 'jak ' )->all ();
120
123
// end-auto-query
121
124
122
125
$ this ->assertNotNull ($ movies );
@@ -127,7 +130,7 @@ public function autocompleteSearchTest(): void
127
130
* @runInSeparateProcess
128
131
* @preserveGlobalState disabled
129
132
*/
130
- public function vectorSearchTest (): void
133
+ public function testVectorSearch (): void
131
134
{
132
135
$ results = Book::vectorSearch (
133
136
index: 'vector ' ,
0 commit comments