mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Improve test coverage.
This commit is contained in:
@@ -40,7 +40,7 @@ class FireflyConfig
|
||||
public function delete(string $name): void
|
||||
{
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning(sprintf('%s("%s") should NOT be called in the TEST environment!', __METHOD__, $name));
|
||||
}
|
||||
$fullName = 'ff-config-' . $name;
|
||||
if (Cache::has($fullName)) {
|
||||
@@ -63,7 +63,7 @@ class FireflyConfig
|
||||
public function get(string $name, $default = null): ?Configuration
|
||||
{
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning(sprintf('%s("%s") should NOT be called in the TEST environment!', __METHOD__, $name));
|
||||
}
|
||||
$fullName = 'ff-config-' . $name;
|
||||
if (Cache::has($fullName)) {
|
||||
|
||||
@@ -45,7 +45,8 @@ trait BasicDataSupport
|
||||
*/
|
||||
foreach ($data as $entryId => $set) {
|
||||
$sum = '0';
|
||||
foreach ($set['entries'] as $amount) {
|
||||
$entries = $set['entries'] ?? [];
|
||||
foreach ($entries as $amount) {
|
||||
$sum = bcadd($amount, $sum);
|
||||
}
|
||||
$data[$entryId]['sum'] = $sum;
|
||||
|
||||
@@ -99,7 +99,7 @@ class Preferences
|
||||
public function get(string $name, $default = null): ?Preference
|
||||
{
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning(sprintf('%s("%s") should NOT be called in the TEST environment!', __METHOD__, $name));
|
||||
}
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
@@ -149,7 +149,7 @@ class Preferences
|
||||
public function getForUser(User $user, string $name, $default = null): ?Preference
|
||||
{
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning(sprintf('%s("%s") should NOT be called in the TEST environment!', __METHOD__, $name));
|
||||
}
|
||||
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||
if (Cache::has($fullName)) {
|
||||
|
||||
@@ -208,10 +208,6 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'accountGetMetaField',
|
||||
static function (Account $account, string $field): string {
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning('Twig General::getMetaField should NOT be called in the TEST environment!');
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$result = $repository->getMetaValue($account, $field);
|
||||
|
||||
@@ -148,9 +148,6 @@ class TransactionGroupTwig extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'journalHasMeta',
|
||||
static function (int $journalId, string $metaField) {
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning('Twig TransactionGroup::journalHasMeta should NOT be called in the TEST environment!');
|
||||
}
|
||||
$count = DB::table('journal_meta')
|
||||
->where('name', $metaField)
|
||||
->where('transaction_journal_id', $journalId)
|
||||
|
||||
Reference in New Issue
Block a user