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
2424 */
2525 protected function truncateDatabaseTables (): void
2626 {
27+ $ this ->beforeTruncatingDatabase ();
28+
2729 // Migrate and seed the database on first run...
2830 if (! RefreshDatabaseState::$ migrated ) {
2931 $ this ->artisan ('migrate:fresh ' , $ this ->migrateFreshUsing ());
@@ -45,6 +47,8 @@ protected function truncateDatabaseTables(): void
4547 // Use the default seeder class...
4648 $ this ->artisan ('db:seed ' );
4749 }
50+
51+ $ this ->afterTruncatingDatabase ();
4852 }
4953
5054 /**
@@ -144,4 +148,24 @@ protected function exceptTables(?string $connectionName): array
144148
145149 return [$ this ->app ['config ' ]->get ('database.migrations ' )];
146150 }
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+ }
147171}
You can’t perform that action at this time.
0 commit comments