mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Improve test coverage.
This commit is contained in:
@@ -65,7 +65,7 @@ class AccountMetaFactory
|
||||
// if $data has field and $entry is null, create new one:
|
||||
if (null === $entry) {
|
||||
Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ', $field, $value, $account->id, $account->name));
|
||||
$this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
|
||||
return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
|
||||
}
|
||||
|
||||
// if $data has field and $entry is not null, update $entry:
|
||||
@@ -75,12 +75,13 @@ class AccountMetaFactory
|
||||
Log::debug(sprintf('Updated meta-field "%s":"%s" for #%d ("%s") ', $field, $value, $account->id, $account->name));
|
||||
}
|
||||
}
|
||||
if ('' === $value && null !== $entry && isset($data[$field])) {
|
||||
if ('' === $value && null !== $entry) {
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage()));
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::debug(sprintf('Could not delete entry: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return $entry;
|
||||
|
Reference in New Issue
Block a user