mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Finalise account tests
This commit is contained in:
@@ -87,7 +87,7 @@ class AmountFormat extends Twig_Extension
|
||||
static function (AccountModel $account, string $amount, bool $coloured = null): string {
|
||||
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning('AmountFormat::formatAmountByAccount should NOT be called in the TEST environment!');
|
||||
}
|
||||
|
||||
$coloured = $coloured ?? true;
|
||||
|
@@ -153,10 +153,6 @@ class General extends Twig_Extension
|
||||
/** @var Carbon $date */
|
||||
$date = session('end', Carbon::now()->endOfMonth());
|
||||
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
}
|
||||
|
||||
return app('steam')->balance($account, $date);
|
||||
}
|
||||
);
|
||||
@@ -213,7 +209,7 @@ class General extends Twig_Extension
|
||||
'accountGetMetaField',
|
||||
static function (Account $account, string $field): string {
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning('Twig General::getMetaField should NOT be called in the TEST environment!');
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
@@ -238,9 +234,6 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'hasRole',
|
||||
static function (string $role): bool {
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
}
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
if ($repository->hasRole(auth()->user(), $role)) {
|
||||
return true;
|
||||
@@ -258,7 +251,7 @@ class General extends Twig_Extension
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'markdown',
|
||||
function (string $text): string {
|
||||
static function (string $text): string {
|
||||
$converter = new CommonMarkConverter;
|
||||
|
||||
return $converter->convertToHtml($text);
|
||||
@@ -275,7 +268,7 @@ class General extends Twig_Extension
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'mimeIcon',
|
||||
function (string $string): string {
|
||||
static function (string $string): string {
|
||||
switch ($string) {
|
||||
default:
|
||||
return 'fa-file-o';
|
||||
@@ -354,7 +347,7 @@ class General extends Twig_Extension
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'phpdate',
|
||||
function (string $str): string {
|
||||
static function (string $str): string {
|
||||
return date($str);
|
||||
}
|
||||
);
|
||||
|
@@ -96,7 +96,7 @@ class TransactionGroupTwig extends Twig_Extension
|
||||
'journalGetMetaDate',
|
||||
static function (int $journalId, string $metaField) {
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning('Twig TransactionGroup::journalGetMetaDate should NOT be called in the TEST environment!');
|
||||
}
|
||||
$entry = DB::table('journal_meta')
|
||||
->where('name', $metaField)
|
||||
@@ -121,7 +121,7 @@ class TransactionGroupTwig extends Twig_Extension
|
||||
'journalGetMetaField',
|
||||
static function (int $journalId, string $metaField) {
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning('Twig TransactionGroup::journalGetMetaField should NOT be called in the TEST environment!');
|
||||
}
|
||||
$entry = DB::table('journal_meta')
|
||||
->where('name', $metaField)
|
||||
@@ -146,7 +146,7 @@ class TransactionGroupTwig extends Twig_Extension
|
||||
'journalHasMeta',
|
||||
static function (int $journalId, string $metaField) {
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
Log::warning('Twig TransactionGroup::journalHasMeta should NOT be called in the TEST environment!');
|
||||
}
|
||||
$count = DB::table('journal_meta')
|
||||
->where('name', $metaField)
|
||||
|
Reference in New Issue
Block a user