mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Update some tests.
This commit is contained in:
@@ -49,13 +49,6 @@ class VersionCheckEventHandler
|
||||
public function checkForUpdates(RequestedVersionCheckStatus $event): void
|
||||
{
|
||||
Log::debug('Now in checkForUpdates()');
|
||||
// in Sandstorm, cannot check for updates:
|
||||
$sandstorm = 1 === (int)getenv('SANDSTORM');
|
||||
if (true === $sandstorm) {
|
||||
Log::debug('This is Sandstorm instance, done.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// should not check for updates:
|
||||
$permission = app('fireflyconfig')->get('permission_update_check', -1);
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Http\Requests\BillFormRequest;
|
||||
@@ -40,6 +41,7 @@ use League\Fractal\Manager;
|
||||
use League\Fractal\Resource\Item;
|
||||
use League\Fractal\Serializer\DataArraySerializer;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class BillController.
|
||||
@@ -366,8 +368,10 @@ class BillController extends Controller
|
||||
{
|
||||
$billData = $request->getBillData();
|
||||
$billData['active'] = true;
|
||||
$bill = $this->billRepository->store($billData);
|
||||
if (null === $bill) {
|
||||
try {
|
||||
$bill = $this->billRepository->store($billData);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getMessage());
|
||||
$request->session()->flash('error', (string)trans('firefly.bill_store_error'));
|
||||
|
||||
return redirect(route('bills.create'))->withInput();
|
||||
|
||||
@@ -251,7 +251,7 @@ class BudgetController extends Controller
|
||||
foreach ($result as $combinedId => $info) {
|
||||
$parts = explode('-', $combinedId);
|
||||
$assetId = (int)$parts[0];
|
||||
$title = sprintf('%s (%s)', $names[$assetId], $info['currency_name']);
|
||||
$title = sprintf('%s (%s)', $names[$assetId] ?? '(empty)', $info['currency_name']);
|
||||
$chartData[$title]
|
||||
= [
|
||||
'amount' => $info['amount'],
|
||||
@@ -315,7 +315,7 @@ class BudgetController extends Controller
|
||||
foreach ($result as $combinedId => $info) {
|
||||
$parts = explode('-', $combinedId);
|
||||
$categoryId = (int)$parts[0];
|
||||
$title = sprintf('%s (%s)', $names[$categoryId], $info['currency_name']);
|
||||
$title = sprintf('%s (%s)', $names[$categoryId] ?? '(empty)', $info['currency_name']);
|
||||
$chartData[$title] = [
|
||||
'amount' => $info['amount'],
|
||||
'currency_symbol' => $info['currency_symbol'],
|
||||
|
||||
@@ -359,7 +359,14 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
$data['enabled'] = true;
|
||||
$currency = $this->repository->store($data);
|
||||
try {
|
||||
$currency = $this->repository->store($data);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::channel('audit')->info('Could not store (POST) currency without admin rights.', $data);
|
||||
$request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));
|
||||
$currency = null;
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('currencies.create.uri'));
|
||||
|
||||
if (null !== $currency) {
|
||||
@@ -373,10 +380,6 @@ class CurrencyController extends Controller
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
}
|
||||
if (null === $currency) {
|
||||
Log::channel('audit')->info('Could not store (POST) currency without admin rights.', $data);
|
||||
$request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
}
|
||||
|
||||
@@ -95,12 +95,12 @@ class Note extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTextAttribute(string $value): string
|
||||
public function getTextAttribute(?string $value): ?string
|
||||
{
|
||||
return htmlspecialchars_decode($value, ENT_QUOTES);
|
||||
return null === $value ? null : htmlspecialchars_decode($value, ENT_QUOTES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\Currency;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\CurrencyExchangeRate;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
@@ -233,7 +234,7 @@ interface CurrencyRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function store(array $data): TransactionCurrency;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace FireflyIII\Services\Github\Request;
|
||||
|
||||
/**
|
||||
* Interface GithubRequest
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
interface GithubRequest
|
||||
{
|
||||
|
||||
@@ -34,7 +34,9 @@ use SimpleXMLElement;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated
|
||||
*/
|
||||
class UpdateRequest implements GithubRequest
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user