22
33namespace MongoDB \Laravel \Tests \Scout ;
44
5- use MongoDB \Laravel \Tests \Models \User ;
5+ use MongoDB \Laravel \Tests \Models \SqlUser ;
66use MongoDB \Laravel \Tests \TestCase ;
77
88use function class_exists ;
@@ -34,7 +34,7 @@ protected function defineScoutDatabaseMigrations()
3434 {
3535 $ this ->baseDefineScoutDatabaseMigrations ();
3636
37- $ this ->importScoutIndexFrom (User ::class);
37+ $ this ->importScoutIndexFrom (SqlUser ::class);
3838 }
3939
4040 protected function importScoutIndexFrom ($ model = null )
@@ -50,7 +50,7 @@ protected function importScoutIndexFrom($model = null)
5050
5151 protected function tearDown (): void
5252 {
53- self ::assertSame (0 , artisan ($ this , 'scout:delete-index ' , ['name ' => User ::class]));
53+ self ::assertSame (0 , artisan ($ this , 'scout:delete-index ' , ['name ' => SqlUser ::class]));
5454
5555 parent ::tearDown ();
5656 }
@@ -60,23 +60,19 @@ public function testItCanUseBasicSearch()
6060 $ results = $ this ->itCanUseBasicSearch ();
6161
6262 $ this ->assertSame ([
63- 'Larry Casper ' ,
64- 'Dax Larkin ' ,
65- 'Prof. Larry Prosacco DVM ' ,
66- ' Amos Larson Sr. ' ,
67- ' Dana Larson Sr. ' ,
68- ], $ results ->pluck ('name ' )->all ());
63+ 11 => 'Larry Casper ' ,
64+ 42 => 'Dax Larkin ' ,
65+ 20 => 'Prof. Larry Prosacco DVM ' ,
66+ 43 => ' Dana Larson Sr. ' ,
67+ 44 => ' Amos Larson Sr. ' ,
68+ ], $ results ->pluck ('name ' , ' id ' )->all ());
6969 }
7070
7171 public function testItCanUseBasicSearchWithQueryCallback ()
7272 {
7373 $ results = $ this ->itCanUseBasicSearchWithQueryCallback ();
7474
7575 $ this ->assertSame ([
76- 1 => 'Laravel Framework ' ,
77- 12 => 'Reta Larkin ' ,
78- 40 => 'Otis Larson MD ' ,
79- 41 => 'Gudrun Larkin ' ,
8076 42 => 'Dax Larkin ' ,
8177 43 => 'Dana Larson Sr. ' ,
8278 44 => 'Amos Larson Sr. ' ,
@@ -88,16 +84,11 @@ public function testItCanUseBasicSearchToFetchKeys()
8884 $ results = $ this ->itCanUseBasicSearchToFetchKeys ();
8985
9086 $ this ->assertSame ([
91- 1 ,
9287 11 ,
93- 12 ,
94- 39 ,
95- 40 ,
96- 41 ,
9788 42 ,
89+ 20 ,
9890 43 ,
9991 44 ,
100- 20 ,
10192 ], $ results ->all ());
10293 }
10394
@@ -106,16 +97,11 @@ public function testItCanUseBasicSearchWithQueryCallbackToFetchKeys()
10697 $ results = $ this ->itCanUseBasicSearchWithQueryCallbackToFetchKeys ();
10798
10899 $ this ->assertSame ([
109- 1 ,
110100 11 ,
111- 12 ,
112- 39 ,
113- 40 ,
114- 41 ,
115101 42 ,
102+ 20 ,
116103 43 ,
117104 44 ,
118- 20 ,
119105 ], $ results ->all ());
120106 }
121107
@@ -132,35 +118,26 @@ public function testItCanUsePaginatedSearch()
132118 [$ page1 , $ page2 ] = $ this ->itCanUsePaginatedSearch ();
133119
134120 $ this ->assertSame ([
135- 'Larry Casper ' ,
136- 'Dax Larkin ' ,
137- 'Prof. Larry Prosacco DVM ' ,
138- 'Amos Larson Sr. ' ,
139- 'Dana Larson Sr. ' ,
121+ 11 => 'Larry Casper ' ,
122+ 42 => 'Dax Larkin ' ,
123+ 20 => 'Prof. Larry Prosacco DVM ' ,
140124 ], $ page1 ->pluck ('name ' , 'id ' )->all ());
141125
142126 $ this ->assertSame ([
143- 41 => 'Gudrun Larkin ' ,
144- 42 => 'Dax Larkin ' ,
145127 43 => 'Dana Larson Sr. ' ,
146128 44 => 'Amos Larson Sr. ' ,
147- 20 => 'Prof. Larry Prosacco DVM ' ,
148- ], $ page2 ->pluck ('name ' )->all ());
129+ ], $ page2 ->pluck ('name ' , 'id ' )->all ());
149130 }
150131
151132 public function testItCanUsePaginatedSearchWithQueryCallback ()
152133 {
153134 [$ page1 , $ page2 ] = $ this ->itCanUsePaginatedSearchWithQueryCallback ();
154135
155136 $ this ->assertSame ([
156- 1 => 'Laravel Framework ' ,
157- 12 => 'Reta Larkin ' ,
158- 40 => 'Otis Larson MD ' ,
137+ 42 => 'Dax Larkin ' ,
159138 ], $ page1 ->pluck ('name ' , 'id ' )->all ());
160139
161140 $ this ->assertSame ([
162- 41 => 'Gudrun Larkin ' ,
163- 42 => 'Dax Larkin ' ,
164141 43 => 'Dana Larson Sr. ' ,
165142 44 => 'Amos Larson Sr. ' ,
166143 ], $ page2 ->pluck ('name ' , 'id ' )->all ());
@@ -170,4 +147,9 @@ protected static function scoutDriver(): string
170147 {
171148 return 'mongodb ' ;
172149 }
150+
151+ protected function getUserModel (): string
152+ {
153+ return SqlUser::class;
154+ }
173155}
0 commit comments