diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php index 363d599869..8d9cec0f1f 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php @@ -107,8 +107,7 @@ class ShowController extends Controller /** @var User $user */ $user = auth()->user(); $manager = $this->getManager(); - $defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup); - $this->parameters->set('defaultCurrency', $defaultCurrency); + $this->parameters->set('defaultCurrency', $this->defaultCurrency); // update fields with user info. $currency->refreshForUser($user); @@ -135,7 +134,7 @@ class ShowController extends Controller /** @var User $user */ $user = auth()->user(); $manager = $this->getManager(); - $currency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup); + $currency = $this->defaultCurrency; // update fields with user info. $currency->refreshForUser($user); diff --git a/tests/integration/TestCase.php b/tests/integration/TestCase.php index 967b8d68a7..0f73fc5894 100644 --- a/tests/integration/TestCase.php +++ b/tests/integration/TestCase.php @@ -52,9 +52,11 @@ abstract class TestCase extends BaseTestCase protected function createAuthenticatedUser(): User { + $group = UserGroup::create(['title' => 'test@email.com']); return User::create([ 'email' => 'test@email.com', 'password' => 'password', + 'user_group_id' => $group->id, ]); } }