From 8d0057a34fcb462df180a596028547fcc386f08c Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 6 Jun 2024 18:09:06 +1200 Subject: [PATCH] FIX Create a temp locale if there is not a default --- src/Extension/FluentExtension.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Extension/FluentExtension.php b/src/Extension/FluentExtension.php index 06ab9507..8ff7706d 100644 --- a/src/Extension/FluentExtension.php +++ b/src/Extension/FluentExtension.php @@ -1055,6 +1055,12 @@ public function LocaleInformation($locale = null) $localeObj = Locale::getDefault(); } + if (!$locale && !$localeObj) { + // There is no default locale, this can happen when unit testing unrelated modules while fluent is installed + // This is done to purely to prevent a invalid argument exception in RecordLocale::__construct() + $localeObj = Locale::create(['Title' => 'Temp locale']); + } + return RecordLocale::create($this->owner, $localeObj); }