Skip to content

Commit d2c8b22

Browse files
committed
Regenerate in memory SQLite database for each test
1 parent ea8ef88 commit d2c8b22

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/Scout/ScoutIntegrationTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,9 @@ public function testItCannotIndexInTheSameNamespace()
5454
SearchableInSameNamespace::create(['name' => 'test']);
5555
}
5656

57-
/** This test create the search index for tests performing search */
58-
public function testItCanCreateTheCollection()
57+
public function setUp(): void
5958
{
60-
$this->skipIfSearchIndexManagementIsNotSupported();
61-
62-
$collection = DB::connection('mongodb')->getCollection('prefix_scout_users');
63-
$collection->drop();
59+
parent::setUp();
6460

6561
// Init the SQL database with some objects that will be indexed
6662
// Test data copied from Laravel Scout tests
@@ -103,6 +99,15 @@ public function testItCanCreateTheCollection()
10399
}
104100

105101
self::assertSame(44, ScoutUser::count());
102+
}
103+
104+
/** This test create the search index for tests performing search */
105+
public function testItCanCreateTheCollection()
106+
{
107+
$this->skipIfSearchIndexManagementIsNotSupported();
108+
109+
$collection = DB::connection('mongodb')->getCollection('prefix_scout_users');
110+
$collection->drop();
106111

107112
// Recreate the indexes using the artisan commands
108113
// Ensure they return a success exit code (0)

0 commit comments

Comments
 (0)