Skip to content

Commit 915a64c

Browse files
committed
DOCSP-46269 Fix doc examples
1 parent e4fd2d6 commit 915a64c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/includes/fundamentals/as-avs/AtlasSearchTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
use MongoDB\Builder\Search;
1111
use MongoDB\Driver\Exception\ServerException;
1212
use MongoDB\Laravel\Schema\Builder;
13+
use MongoDB\Laravel\Tests\Models\Book;
1314
use MongoDB\Laravel\Tests\TestCase;
15+
use PHPUnit\Framework\Attributes\Group;
1416

1517
use function array_map;
1618
use function mt_getrandmax;
@@ -19,6 +21,7 @@
1921
use function srand;
2022
use function usleep;
2123

24+
#[Group('atlas-search')]
2225
class AtlasSearchTest extends TestCase
2326
{
2427
private array $vectors;
@@ -84,7 +87,7 @@ protected function setUp(): void
8487
do {
8588
$ready = true;
8689
usleep(10_000);
87-
foreach ($collection->listSearchIndexes() as $index) {
90+
foreach ($moviesCollection->listSearchIndexes() as $index) {
8891
if ($index['status'] !== 'READY') {
8992
$ready = false;
9093
}
@@ -102,7 +105,7 @@ public function testSimpleSearch(): void
102105
$movies = Movie::search(
103106
sort: ['title' => 1],
104107
operator: Search::text('title', 'dream'),
105-
)->get();
108+
)->all();
106109
// end-search-query
107110

108111
$this->assertNotNull($movies);
@@ -113,10 +116,10 @@ public function testSimpleSearch(): void
113116
* @runInSeparateProcess
114117
* @preserveGlobalState disabled
115118
*/
116-
public function autocompleteSearchTest(): void
119+
public function testAutocompleteSearch(): void
117120
{
118121
// start-auto-query
119-
$movies = Movie::autocomplete('title', 'jak')->get();
122+
$movies = Movie::autocomplete('title', 'jak')->all();
120123
// end-auto-query
121124

122125
$this->assertNotNull($movies);
@@ -127,7 +130,7 @@ public function autocompleteSearchTest(): void
127130
* @runInSeparateProcess
128131
* @preserveGlobalState disabled
129132
*/
130-
public function vectorSearchTest(): void
133+
public function testVectorSearch(): void
131134
{
132135
$results = Book::vectorSearch(
133136
index: 'vector',

0 commit comments

Comments
 (0)