File tree Expand file tree Collapse file tree 6 files changed +35
-7
lines changed Expand file tree Collapse file tree 6 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 2323 laravel : 11
2424 - php : 8.4
2525 laravel : 12
26+ - php : 8.5
27+ laravel : 12
2628 - php : 8.2
2729 laravel : 9
2830 - php : 8.1
Original file line number Diff line number Diff line change 2929 "typesense/typesense-php" : " ^4.9.3" ,
3030 "meilisearch/meilisearch-php" : " ^1.0" ,
3131 "mockery/mockery" : " ^1.0" ,
32- "orchestra/testbench" : " ^7.31|^8.11 |^9.0 |^10.0 " ,
32+ "orchestra/testbench" : " ^7.31|^8.36 |^9.15 |^10.8 " ,
3333 "php-http/guzzle7-adapter" : " ^1.0" ,
34- "phpstan/phpstan" : " ^1.10" ,
35- "phpunit/phpunit" : " ^9.3|^10.4|^11.5"
34+ "phpstan/phpstan" : " ^1.10"
3635 },
3736 "conflict" : {
3837 "algolia/algoliasearch-client-php" : " <3.2.0|>=5.0.0"
Original file line number Diff line number Diff line change 22
33namespace Laravel \Scout \Tests \Integration ;
44
5+ use Orchestra \Sidekick \Env ;
56use Orchestra \Testbench \Attributes \RequiresEnv ;
67use Workbench \App \Models \SearchableUser ;
78
@@ -215,6 +216,17 @@ public function test_it_can_use_raw_cursor_search_with_after_raw_search_callback
215216 $ this ->assertArrayHasKey ('processingTimeMS ' , $ rawResults );
216217 }
217218
219+ /** {@inheritdoc} */
220+ #[\Override]
221+ protected static function flushIndexesFromScout (): void
222+ {
223+ if (! Env::has ('ALGOLIA_APP_ID ' )) {
224+ return ;
225+ }
226+
227+ parent ::flushIndexesFromScout ();
228+ }
229+
218230 protected static function scoutDriver (): string
219231 {
220232 return 'algolia ' ;
Original file line number Diff line number Diff line change @@ -26,12 +26,20 @@ protected function importScoutIndexFrom($model = null)
2626 * Clean up the testing environment before the next test case.
2727 */
2828 public static function tearDownAfterClass (): void
29+ {
30+ static ::flushIndexesFromScout ();
31+
32+ parent ::tearDownAfterClass ();
33+ }
34+
35+ /**
36+ * Cleanup indexes from scout before starting new test.
37+ */
38+ protected static function flushIndexesFromScout (): void
2939 {
3040 remote ('scout:delete-all-indexes ' , [
3141 'SCOUT_DRIVER ' => static ::scoutDriver (),
3242 ])->mustRun ();
33-
34- parent ::tearDownAfterClass ();
3543 }
3644
3745 abstract protected static function scoutDriver (): string ;
Original file line number Diff line number Diff line change 1212use Meilisearch \Client ;
1313use Meilisearch \Endpoints \Indexes ;
1414use Mockery as m ;
15+ use Orchestra \Testbench \Concerns \InteractsWithMockery ;
1516use PHPUnit \Framework \TestCase ;
1617use stdClass ;
1718
1819class MeilisearchEngineTest extends TestCase
1920{
21+ use InteractsWithMockery;
22+
2023 protected function setUp (): void
2124 {
2225 Config::shouldReceive ('get ' )->with ('scout.after_commit ' , m::any ())->andReturn (false );
@@ -26,7 +29,8 @@ protected function setUp(): void
2629 protected function tearDown (): void
2730 {
2831 Container::getInstance ()->flush ();
29- m::close ();
32+
33+ $ this ->tearDownTheTestEnvironmentUsingMockery ();
3034 }
3135
3236 public function test_map_ids_returns_empty_collection_if_no_hits ()
Original file line number Diff line number Diff line change 55use Illuminate \Database \Eloquent \Builder ;
66use Laravel \Scout \SearchableScope ;
77use Mockery as m ;
8+ use Orchestra \Testbench \Concerns \InteractsWithMockery ;
89use PHPUnit \Framework \TestCase ;
910
1011class SearchableScopeTest extends TestCase
1112{
13+ use InteractsWithMockery;
14+
1215 protected function tearDown (): void
1316 {
14- m:: close ();
17+ $ this -> tearDownTheTestEnvironmentUsingMockery ();
1518 }
1619
1720 public function test_chunks_by_id ()
You can’t perform that action at this time.
0 commit comments