From 8c737f054fe54076556870ae6a5b4745b554a063 Mon Sep 17 00:00:00 2001 From: Rok Sprogar <30501923+roksprogar@users.noreply.github.com> Date: Fri, 22 Apr 2022 00:28:32 +0200 Subject: [PATCH] add the beforeRefreshingDatabase function (#42073) --- .../Foundation/Testing/RefreshDatabase.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Illuminate/Foundation/Testing/RefreshDatabase.php b/src/Illuminate/Foundation/Testing/RefreshDatabase.php index 8663bdc85d7c..b486cbb0ac91 100644 --- a/src/Illuminate/Foundation/Testing/RefreshDatabase.php +++ b/src/Illuminate/Foundation/Testing/RefreshDatabase.php @@ -16,6 +16,8 @@ trait RefreshDatabase */ public function refreshDatabase() { + $this->beforeRefreshingDatabase(); + $this->usingInMemoryDatabase() ? $this->refreshInMemoryDatabase() : $this->refreshTestDatabase(); @@ -126,6 +128,16 @@ protected function connectionsToTransact() ? $this->connectionsToTransact : [null]; } + /** + * Perform any work that should take place before the database has started refreshing. + * + * @return void + */ + protected function beforeRefreshingDatabase() + { + // ... + } + /** * Perform any work that should take place once the database has finished refreshing. *