44
55namespace MongoDB \Laravel \Tests ;
66
7+ use Illuminate \Database \Eloquent \Model ;
78use Illuminate \Foundation \Application ;
89use MongoDB \Driver \Exception \ServerException ;
910use MongoDB \Laravel \MongoDBServiceProvider ;
1011use MongoDB \Laravel \Schema \Builder ;
12+ use MongoDB \Laravel \Scout \MongoDBScoutServiceProvider ;
1113use MongoDB \Laravel \Scout \ScoutServiceProvider ;
1214use MongoDB \Laravel \Tests \Models \User ;
1315use MongoDB \Laravel \Validation \ValidationServiceProvider ;
1416use Orchestra \Testbench \TestCase as OrchestraTestCase ;
1517
1618class TestCase extends OrchestraTestCase
1719{
18- /** @var class-string */
19- protected static string $ userModel = User::class;
20-
2120 /**
2221 * Get package providers.
2322 *
@@ -28,8 +27,8 @@ protected function getPackageProviders($app): array
2827 return [
2928 MongoDBServiceProvider::class,
3029 ValidationServiceProvider::class,
31- \Laravel \Scout \ScoutServiceProvider::class,
3230 ScoutServiceProvider::class,
31+ MongoDBScoutServiceProvider::class,
3332 ];
3433 }
3534
@@ -53,7 +52,7 @@ protected function getEnvironmentSetUp($app): void
5352 $ app ['config ' ]->set ('database.connections.mongodb2 ' , $ config ['connections ' ]['mongodb ' ]);
5453
5554 $ app ['config ' ]->set ('auth.model ' , User::class);
56- $ app ['config ' ]->set ('auth.providers.users.model ' , self :: $ userModel );
55+ $ app ['config ' ]->set ('auth.providers.users.model ' , static :: getUserModel () );
5756 $ app ['config ' ]->set ('cache.driver ' , 'array ' );
5857
5958 $ app ['config ' ]->set ('cache.stores.mongodb ' , [
@@ -88,4 +87,10 @@ public function skipIfSearchIndexManagementIsNotSupported(): void
8887 throw $ e ;
8988 }
9089 }
90+
91+ /** @return class-string<Model> */
92+ protected static function getUserModel (): string
93+ {
94+ return User::class;
95+ }
9196}
0 commit comments