2
2
3
3
namespace MongoDB \Laravel \Tests \Scout ;
4
4
5
- use MongoDB \Laravel \Tests \Models \User ;
5
+ use MongoDB \Laravel \Tests \Models \SqlUser ;
6
6
use MongoDB \Laravel \Tests \TestCase ;
7
7
8
8
use function class_exists ;
@@ -34,7 +34,7 @@ protected function defineScoutDatabaseMigrations()
34
34
{
35
35
$ this ->baseDefineScoutDatabaseMigrations ();
36
36
37
- $ this ->importScoutIndexFrom (User ::class);
37
+ $ this ->importScoutIndexFrom (SqlUser ::class);
38
38
}
39
39
40
40
protected function importScoutIndexFrom ($ model = null )
@@ -50,7 +50,7 @@ protected function importScoutIndexFrom($model = null)
50
50
51
51
protected function tearDown (): void
52
52
{
53
- self ::assertSame (0 , artisan ($ this , 'scout:delete-index ' , ['name ' => User ::class]));
53
+ self ::assertSame (0 , artisan ($ this , 'scout:delete-index ' , ['name ' => SqlUser ::class]));
54
54
55
55
parent ::tearDown ();
56
56
}
@@ -60,23 +60,19 @@ public function testItCanUseBasicSearch()
60
60
$ results = $ this ->itCanUseBasicSearch ();
61
61
62
62
$ 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 ());
69
69
}
70
70
71
71
public function testItCanUseBasicSearchWithQueryCallback ()
72
72
{
73
73
$ results = $ this ->itCanUseBasicSearchWithQueryCallback ();
74
74
75
75
$ this ->assertSame ([
76
- 1 => 'Laravel Framework ' ,
77
- 12 => 'Reta Larkin ' ,
78
- 40 => 'Otis Larson MD ' ,
79
- 41 => 'Gudrun Larkin ' ,
80
76
42 => 'Dax Larkin ' ,
81
77
43 => 'Dana Larson Sr. ' ,
82
78
44 => 'Amos Larson Sr. ' ,
@@ -88,16 +84,11 @@ public function testItCanUseBasicSearchToFetchKeys()
88
84
$ results = $ this ->itCanUseBasicSearchToFetchKeys ();
89
85
90
86
$ this ->assertSame ([
91
- 1 ,
92
87
11 ,
93
- 12 ,
94
- 39 ,
95
- 40 ,
96
- 41 ,
97
88
42 ,
89
+ 20 ,
98
90
43 ,
99
91
44 ,
100
- 20 ,
101
92
], $ results ->all ());
102
93
}
103
94
@@ -106,16 +97,11 @@ public function testItCanUseBasicSearchWithQueryCallbackToFetchKeys()
106
97
$ results = $ this ->itCanUseBasicSearchWithQueryCallbackToFetchKeys ();
107
98
108
99
$ this ->assertSame ([
109
- 1 ,
110
100
11 ,
111
- 12 ,
112
- 39 ,
113
- 40 ,
114
- 41 ,
115
101
42 ,
102
+ 20 ,
116
103
43 ,
117
104
44 ,
118
- 20 ,
119
105
], $ results ->all ());
120
106
}
121
107
@@ -132,35 +118,26 @@ public function testItCanUsePaginatedSearch()
132
118
[$ page1 , $ page2 ] = $ this ->itCanUsePaginatedSearch ();
133
119
134
120
$ 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 ' ,
140
124
], $ page1 ->pluck ('name ' , 'id ' )->all ());
141
125
142
126
$ this ->assertSame ([
143
- 41 => 'Gudrun Larkin ' ,
144
- 42 => 'Dax Larkin ' ,
145
127
43 => 'Dana Larson Sr. ' ,
146
128
44 => 'Amos Larson Sr. ' ,
147
- 20 => 'Prof. Larry Prosacco DVM ' ,
148
- ], $ page2 ->pluck ('name ' )->all ());
129
+ ], $ page2 ->pluck ('name ' , 'id ' )->all ());
149
130
}
150
131
151
132
public function testItCanUsePaginatedSearchWithQueryCallback ()
152
133
{
153
134
[$ page1 , $ page2 ] = $ this ->itCanUsePaginatedSearchWithQueryCallback ();
154
135
155
136
$ this ->assertSame ([
156
- 1 => 'Laravel Framework ' ,
157
- 12 => 'Reta Larkin ' ,
158
- 40 => 'Otis Larson MD ' ,
137
+ 42 => 'Dax Larkin ' ,
159
138
], $ page1 ->pluck ('name ' , 'id ' )->all ());
160
139
161
140
$ this ->assertSame ([
162
- 41 => 'Gudrun Larkin ' ,
163
- 42 => 'Dax Larkin ' ,
164
141
43 => 'Dana Larson Sr. ' ,
165
142
44 => 'Amos Larson Sr. ' ,
166
143
], $ page2 ->pluck ('name ' , 'id ' )->all ());
@@ -170,4 +147,9 @@ protected static function scoutDriver(): string
170
147
{
171
148
return 'mongodb ' ;
172
149
}
150
+
151
+ protected function getUserModel (): string
152
+ {
153
+ return SqlUser::class;
154
+ }
173
155
}
0 commit comments