File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
src/Illuminate/Foundation/Testing Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ trait DatabaseTruncation
24
24
*/
25
25
protected function truncateDatabaseTables (): void
26
26
{
27
+ $ this ->beforeTruncatingDatabase ();
28
+
27
29
// Migrate and seed the database on first run...
28
30
if (! RefreshDatabaseState::$ migrated ) {
29
31
$ this ->artisan ('migrate:fresh ' , $ this ->migrateFreshUsing ());
@@ -45,6 +47,8 @@ protected function truncateDatabaseTables(): void
45
47
// Use the default seeder class...
46
48
$ this ->artisan ('db:seed ' );
47
49
}
50
+
51
+ $ this ->afterTruncatingDatabase ();
48
52
}
49
53
50
54
/**
@@ -144,4 +148,24 @@ protected function exceptTables(?string $connectionName): array
144
148
145
149
return [$ this ->app ['config ' ]->get ('database.migrations ' )];
146
150
}
151
+
152
+ /**
153
+ * Perform any work that should take place before the database has started truncating.
154
+ *
155
+ * @return void
156
+ */
157
+ protected function beforeTruncatingDatabase (): void
158
+ {
159
+ //
160
+ }
161
+
162
+ /**
163
+ * Perform any work that should take place once the database has finished truncating.
164
+ *
165
+ * @return void
166
+ */
167
+ protected function afterTruncatingDatabase (): void
168
+ {
169
+ //
170
+ }
147
171
}
You can’t perform that action at this time.
0 commit comments