mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 12:45:30 +00:00
Code cleanup.
This commit is contained in:
@@ -35,16 +35,6 @@ use League\Fractal\Serializer\JsonApiSerializer;
|
||||
*/
|
||||
class AboutController extends Controller
|
||||
{
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
@@ -103,7 +103,7 @@ class AccountController extends Controller
|
||||
|
||||
// types to get, page size:
|
||||
$types = $this->mapTypes($this->parameters->get('type'));
|
||||
$pageSize = intval(Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data);
|
||||
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of accounts. Count it and split it.
|
||||
$collection = $this->repository->getAccountsByType($types);
|
||||
@@ -154,7 +154,7 @@ class AccountController extends Controller
|
||||
// if currency ID is 0, find the currency by the code:
|
||||
if (0 === $data['currency_id']) {
|
||||
$currency = $this->currencyRepository->findByCodeNull($data['currency_code']);
|
||||
$data['currency_id'] = is_null($currency) ? 0 : $currency->id;
|
||||
$data['currency_id'] = null === $currency ? 0 : $currency->id;
|
||||
}
|
||||
$account = $this->repository->store($data);
|
||||
$manager = new Manager();
|
||||
@@ -180,7 +180,7 @@ class AccountController extends Controller
|
||||
// if currency ID is 0, find the currency by the code:
|
||||
if (0 === $data['currency_id']) {
|
||||
$currency = $this->currencyRepository->findByCodeNull($data['currency_code']);
|
||||
$data['currency_id'] = is_null($currency) ? 0 : $currency->id;
|
||||
$data['currency_id'] = null === $currency ? 0 : $currency->id;
|
||||
}
|
||||
// set correct type:
|
||||
$data['type'] = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
|
@@ -85,7 +85,7 @@ class BillController extends Controller
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$pageSize = intval(Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data);
|
||||
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$paginator = $this->repository->getPaginator($pageSize);
|
||||
/** @var Collection $bills */
|
||||
$bills = $paginator->getCollection();
|
||||
|
@@ -107,7 +107,7 @@ class Controller extends BaseController
|
||||
foreach ($dates as $field) {
|
||||
$date = request()->get($field);
|
||||
$obj = null;
|
||||
if (!is_null($date)) {
|
||||
if (null !== $date) {
|
||||
try {
|
||||
$obj = new Carbon($date);
|
||||
} catch (InvalidDateException $e) {
|
||||
|
@@ -91,7 +91,7 @@ class TransactionController extends Controller
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$pageSize = intval(Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data);
|
||||
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// read type from URI
|
||||
$type = $request->get('type') ?? 'default';
|
||||
@@ -115,7 +115,7 @@ class TransactionController extends Controller
|
||||
$collector->removeFilter(InternalTransferFilter::class);
|
||||
}
|
||||
|
||||
if (!is_null($this->parameters->get('start')) && !is_null($this->parameters->get('end'))) {
|
||||
if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
|
||||
$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
|
||||
}
|
||||
$collector->setLimit($pageSize)->setPage($this->parameters->get('page'));
|
||||
|
@@ -92,7 +92,7 @@ class UserController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
// user preferences
|
||||
$pageSize = intval(Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data);
|
||||
$pageSize = (int)Preferences::getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// make manager
|
||||
$manager = new Manager();
|
||||
|
@@ -108,8 +108,8 @@ class BillRequest extends Request
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
$data = $validator->getData();
|
||||
$min = floatval($data['amount_min'] ?? 0);
|
||||
$max = floatval($data['amount_max'] ?? 0);
|
||||
$min = (float)($data['amount_min'] ?? 0);
|
||||
$max = (float)($data['amount_max'] ?? 0);
|
||||
if ($min > $max) {
|
||||
$validator->errors()->add('amount_min', trans('validation.amount_min_over_max'));
|
||||
}
|
||||
|
@@ -76,14 +76,14 @@ class User extends Authenticatable
|
||||
* @param string $value
|
||||
*
|
||||
* @return User
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): User
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$userId = intval($value);
|
||||
$userId = (int)$value;
|
||||
$user = self::find($userId);
|
||||
if (!is_null($user)) {
|
||||
if (null !== $user) {
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ class User extends Authenticatable
|
||||
{
|
||||
$bytes = random_bytes(16);
|
||||
|
||||
return strval(bin2hex($bytes));
|
||||
return (string)bin2hex($bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -239,8 +239,8 @@ $factory->define(
|
||||
FireflyIII\Models\Transaction::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
|
||||
'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
|
||||
'transaction_amount' => (string)$faker->randomFloat(2, -100, 100),
|
||||
'destination_amount' => (string)$faker->randomFloat(2, -100, 100),
|
||||
'opposing_account_id' => $faker->numberBetween(1, 10),
|
||||
'source_account_id' => $faker->numberBetween(1, 10),
|
||||
'opposing_account_name' => $faker->words(3, true),
|
||||
@@ -249,7 +249,7 @@ $factory->define(
|
||||
'destination_account_id' => $faker->numberBetween(1, 10),
|
||||
'date' => new Carbon,
|
||||
'destination_account_name' => $faker->words(3, true),
|
||||
'amount' => strval($faker->randomFloat(2, -100, 100)),
|
||||
'amount' => (string)$faker->randomFloat(2, -100, 100),
|
||||
'budget_id' => 0,
|
||||
'category' => $faker->words(3, true),
|
||||
'transaction_journal_id' => $faker->numberBetween(1, 10),
|
||||
|
@@ -14,7 +14,7 @@ class ConfigSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$entry = Configuration::where('name', 'db_version')->first();
|
||||
if (is_null($entry)) {
|
||||
if (null === $entry) {
|
||||
Log::warning('No database version entry is present. Database is assumed to be OLD (version 1).');
|
||||
// FF old or no version present. Put at 1:
|
||||
Configuration::create(
|
||||
@@ -24,8 +24,8 @@ class ConfigSeeder extends Seeder
|
||||
]
|
||||
);
|
||||
}
|
||||
if (!is_null($entry)) {
|
||||
$version = intval(config('firefly.db_version'));
|
||||
if (null !== $entry) {
|
||||
$version = (int)config('firefly.db_version');
|
||||
$entry->data = $version;
|
||||
$entry->save();
|
||||
|
||||
|
@@ -54,6 +54,7 @@ require __DIR__ . '/../vendor/autoload.php';
|
||||
|
|
||||
*/
|
||||
|
||||
/** @noinspection UsingInclusionOnceReturnValueInspection */
|
||||
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|
1
public/js/ff/index.js
vendored
1
public/js/ff/index.js
vendored
@@ -127,6 +127,5 @@ function getBalanceBox() {
|
||||
$('#box-balance-list').html(current + '<span title="' + string + '">' + string + '</span>' + '<br>');
|
||||
count++;
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
4
public/js/ff/transactions/single/create.js
vendored
4
public/js/ff/transactions/single/create.js
vendored
@@ -83,8 +83,6 @@ function selectsDifferentSource() {
|
||||
$('.currency-option[data-id="' + sourceCurrency + '"]').click();
|
||||
$('[data-toggle="dropdown"]').parent().removeClass('open');
|
||||
$('select[name="source_account_id"]').focus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,8 +105,6 @@ function selectsDifferentDestination() {
|
||||
$('.currency-option[data-id="' + destinationCurrency + '"]').click();
|
||||
$('[data-toggle="dropdown"]').parent().removeClass('open');
|
||||
$('select[name="destination_account_id"]').focus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -784,6 +784,7 @@ return [
|
||||
'opt_group_sharedAsset' => 'Shared asset accounts',
|
||||
'opt_group_ccAsset' => 'Credit cards',
|
||||
'notes' => 'Notes',
|
||||
'unknown_journal_error' => 'Could not store the transaction. Please check the log files.',
|
||||
|
||||
// new user:
|
||||
'welcome' => 'Welcome to Firefly III!',
|
||||
@@ -1136,6 +1137,7 @@ return [
|
||||
'import_index_title' => 'Import data into Firefly III',
|
||||
'import_index_sub_title' => 'Index',
|
||||
'import_general_index_intro' => 'Welcome to Firefly III\'s import routine. There are a few ways of importing data into Firefly III, displayed here as buttons.',
|
||||
'upload_error' => 'The file you have uploaded could not be processed. Possibly it is of an invalid file type or encoding. The log files will have more information.',
|
||||
|
||||
// sandstorm.io errors and messages:
|
||||
'sandstorm_not_available' => 'This function is not available when you are using Firefly III within a Sandstorm.io environment.',
|
||||
|
@@ -81,11 +81,11 @@ Breadcrumbs::register(
|
||||
|
||||
$breadcrumbs->parent('accounts.index', $what);
|
||||
$breadcrumbs->push($account->name, route('accounts.show', [$account->id]));
|
||||
if (!is_null($start) && !is_null($end)) {
|
||||
if (null !== $start && null !== $end) {
|
||||
$title = trans(
|
||||
'firefly.between_dates_breadcrumb',
|
||||
['start' => $start ? $start->formatLocalized(strval(trans('config.month_and_day'))) : '',
|
||||
'end' => $end ? $end->formatLocalized(strval(trans('config.month_and_day'))) : '',]
|
||||
['start' => $start ? $start->formatLocalized((string)trans('config.month_and_day')) : '',
|
||||
'end' => $end ? $end->formatLocalized((string)trans('config.month_and_day')) : '',]
|
||||
);
|
||||
$breadcrumbs->push($title, route('accounts.show', $account));
|
||||
}
|
||||
@@ -357,8 +357,8 @@ Breadcrumbs::register(
|
||||
if ('all' !== $moment && '(nothing)' !== $moment) {
|
||||
$title = trans(
|
||||
'firefly.between_dates_breadcrumb',
|
||||
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
|
||||
'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]
|
||||
['start' => $start->formatLocalized((string)trans('config.month_and_day')),
|
||||
'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
|
||||
);
|
||||
$breadcrumbs->push($title, route('budgets.no-budget', [$moment]));
|
||||
}
|
||||
@@ -382,8 +382,8 @@ Breadcrumbs::register(
|
||||
|
||||
$title = trans(
|
||||
'firefly.between_dates_breadcrumb',
|
||||
['start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))),
|
||||
'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),]
|
||||
['start' => $budgetLimit->start_date->formatLocalized((string)trans('config.month_and_day')),
|
||||
'end' => $budgetLimit->end_date->formatLocalized((string)trans('config.month_and_day')),]
|
||||
);
|
||||
|
||||
$breadcrumbs->push(
|
||||
@@ -438,8 +438,8 @@ Breadcrumbs::register(
|
||||
if ('all' !== $moment && '(nothing)' !== $moment) {
|
||||
$title = trans(
|
||||
'firefly.between_dates_breadcrumb',
|
||||
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
|
||||
'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]
|
||||
['start' => $start->formatLocalized((string)trans('config.month_and_day')),
|
||||
'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
|
||||
);
|
||||
$breadcrumbs->push($title, route('categories.show', [$category->id, $moment]));
|
||||
}
|
||||
@@ -460,8 +460,8 @@ Breadcrumbs::register(
|
||||
if ('all' !== $moment && '(nothing)' !== $moment) {
|
||||
$title = trans(
|
||||
'firefly.between_dates_breadcrumb',
|
||||
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
|
||||
'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]
|
||||
['start' => $start->formatLocalized((string)trans('config.month_and_day')),
|
||||
'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
|
||||
);
|
||||
$breadcrumbs->push($title, route('categories.no-category', [$moment]));
|
||||
}
|
||||
@@ -878,8 +878,8 @@ Breadcrumbs::register(
|
||||
if ('all' !== $moment && '(nothing)' !== $moment) {
|
||||
$title = trans(
|
||||
'firefly.between_dates_breadcrumb',
|
||||
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
|
||||
'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]
|
||||
['start' => $start->formatLocalized((string)trans('config.month_and_day')),
|
||||
'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
|
||||
);
|
||||
$breadcrumbs->push($title, route('tags.show', [$tag->id, $moment]));
|
||||
}
|
||||
|
@@ -2395,7 +2395,7 @@ class TransactionControllerTest extends TestCase
|
||||
'description' => 'Some transaction #' . random_int(1, 1000),
|
||||
'date' => '2018-01-01',
|
||||
'type' => 'withdrawal',
|
||||
'tags' => join(',', $tags),
|
||||
'tags' => implode(',', $tags),
|
||||
'transactions' => [
|
||||
[
|
||||
'amount' => '10',
|
||||
|
@@ -370,7 +370,7 @@ class ProfileControllerTest extends TestCase
|
||||
{
|
||||
$token = '';
|
||||
$currentToken = Preference::where('user_id', $this->user()->id)->where('name', 'access_token')->first();
|
||||
if (!is_null($currentToken)) {
|
||||
if (null !== $currentToken) {
|
||||
$token = $currentToken->data;
|
||||
}
|
||||
$this->be($this->user());
|
||||
|
@@ -97,7 +97,7 @@ class BulkControllerTest extends TestCase
|
||||
// default transactions
|
||||
$collection = $this->user()->transactionJournals()->take(4)->get();
|
||||
$allIds = $collection->pluck('id')->toArray();
|
||||
$route = route('transactions.bulk.edit', join(',', $allIds));
|
||||
$route = route('transactions.bulk.edit', implode(',', $allIds));
|
||||
$this->be($this->user());
|
||||
$response = $this->get($route);
|
||||
$response->assertStatus(200);
|
||||
@@ -133,7 +133,7 @@ class BulkControllerTest extends TestCase
|
||||
// default transactions
|
||||
$collection = $this->user()->transactionJournals()->take(4)->get();
|
||||
$allIds = $collection->pluck('id')->toArray();
|
||||
$route = route('transactions.bulk.edit', join(',', $allIds));
|
||||
$route = route('transactions.bulk.edit', implode(',', $allIds));
|
||||
$this->be($this->user());
|
||||
$response = $this->get($route);
|
||||
$response->assertStatus(200);
|
||||
|
@@ -162,7 +162,7 @@ class MassControllerTest extends TestCase
|
||||
// default transactions
|
||||
$collection = $this->user()->transactionJournals()->take(4)->get();
|
||||
$allIds = $collection->pluck('id')->toArray();
|
||||
$route = route('transactions.mass.edit', join(',', $allIds));
|
||||
$route = route('transactions.mass.edit', implode(',', $allIds));
|
||||
$this->be($this->user());
|
||||
$response = $this->get($route);
|
||||
$response->assertStatus(200);
|
||||
@@ -204,7 +204,7 @@ class MassControllerTest extends TestCase
|
||||
$allIds = $collection->pluck('id')->toArray();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('transactions.mass.edit', join(',', $allIds)));
|
||||
$response = $this->get(route('transactions.mass.edit', implode(',', $allIds)));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('Edit a number of transactions');
|
||||
$response->assertSessionHas('error', 'You have selected no valid transactions to edit.');
|
||||
|
@@ -99,9 +99,7 @@ abstract class TestCase extends BaseTestCase
|
||||
*/
|
||||
public function demoUser(): User
|
||||
{
|
||||
$user = User::find(4);
|
||||
|
||||
return $user;
|
||||
return User::find(4);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,9 +107,7 @@ abstract class TestCase extends BaseTestCase
|
||||
*/
|
||||
public function emptyUser(): User
|
||||
{
|
||||
$user = User::find(2);
|
||||
|
||||
return $user;
|
||||
return User::find(2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,9 +115,7 @@ abstract class TestCase extends BaseTestCase
|
||||
*/
|
||||
public function user(): User
|
||||
{
|
||||
$user = User::find(1);
|
||||
|
||||
return $user;
|
||||
return User::find(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,10 +139,8 @@ abstract class TestCase extends BaseTestCase
|
||||
*/
|
||||
protected function overload(string $class)
|
||||
{
|
||||
$externalMock = Mockery::mock('overload:' . $class);
|
||||
|
||||
//$this->app->instance($class, $externalMock);
|
||||
return $externalMock;
|
||||
return Mockery::mock('overload:' . $class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -212,7 +212,7 @@ class AccountFactoryTest extends TestCase
|
||||
|
||||
// find opening balance:
|
||||
$this->assertEquals(1, $account->transactions()->count());
|
||||
$this->assertEquals(100, floatval($account->transactions()->first()->amount));
|
||||
$this->assertEquals(100, (float)$account->transactions()->first()->amount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,7 +361,7 @@ class AccountFactoryTest extends TestCase
|
||||
|
||||
// find opening balance:
|
||||
$this->assertEquals(1, $account->transactions()->count());
|
||||
$this->assertEquals(-100, floatval($account->transactions()->first()->amount));
|
||||
$this->assertEquals(-100, (float)$account->transactions()->first()->amount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -45,7 +45,7 @@ class AttachmentHelperTest extends TestCase
|
||||
{
|
||||
$attachment = Attachment::first();
|
||||
$helper = new AttachmentHelper;
|
||||
$path = $path = sprintf('%s%sat-%d.data', storage_path('upload'), DIRECTORY_SEPARATOR, intval($attachment->id));
|
||||
$path = $path = sprintf('%s%sat-%d.data', storage_path('upload'), DIRECTORY_SEPARATOR, (int)$attachment->id);
|
||||
$this->assertEquals($helper->getAttachmentLocation($attachment), $path);
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ class AssetAccountIbansTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
53 => 'Else',
|
||||
17 => 'IBAN (Something)',
|
||||
];
|
||||
|
@@ -57,7 +57,7 @@ class AssetAccountsTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
19 => 'Else',
|
||||
23 => 'Something (IBAN)',
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class BillsTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
9 => 'Else [match]',
|
||||
5 => 'Something [hi,bye]',
|
||||
];
|
||||
|
@@ -55,7 +55,7 @@ class BudgetsTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
4 => 'Else',
|
||||
8 => 'Something',
|
||||
|
||||
|
@@ -55,7 +55,7 @@ class CategoriesTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
17 => 'Else',
|
||||
9 => 'Something',
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class OpposingAccountIbansTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
17 => 'Else',
|
||||
21 => 'IBAN (Something)',
|
||||
];
|
||||
|
@@ -59,7 +59,7 @@ class OpposingAccountsTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
9 => 'Else',
|
||||
13 => 'Something (IBAN)',
|
||||
];
|
||||
|
@@ -55,7 +55,7 @@ class TagsTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
14 => 'Else',
|
||||
12 => 'Something',
|
||||
];
|
||||
|
@@ -57,7 +57,7 @@ class TransactionCurrenciesTest extends TestCase
|
||||
$this->assertCount(3, $mapping);
|
||||
// assert this is what the result looks like:
|
||||
$result = [
|
||||
0 => strval(trans('import.map_do_not_map')),
|
||||
0 => (string)trans('import.map_do_not_map'),
|
||||
11 => 'Else (DEF)',
|
||||
9 => 'Something (ABC)',
|
||||
|
||||
|
@@ -27,7 +27,7 @@ use FireflyIII\Import\Object\ImportAccount;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
@@ -77,7 +77,7 @@ class AuthenticateTest extends TestCase
|
||||
$this->be($user);
|
||||
$response = $this->get('/_test/authenticate');
|
||||
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
|
||||
$response->assertSessionHas('logoutMessage', strval(trans('firefly.block_account_logout')));
|
||||
$response->assertSessionHas('logoutMessage', (string)trans('firefly.block_account_logout'));
|
||||
$response->assertRedirect(route('login'));
|
||||
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class AuthenticateTest extends TestCase
|
||||
$this->be($user);
|
||||
$response = $this->get('/_test/authenticate');
|
||||
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
|
||||
$response->assertSessionHas('logoutMessage', strval(trans('firefly.email_changed_logout')));
|
||||
$response->assertSessionHas('logoutMessage', (string)trans('firefly.email_changed_logout'));
|
||||
$response->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
|
@@ -1241,7 +1241,7 @@ class BinderTest extends TestCase
|
||||
}
|
||||
);
|
||||
|
||||
$names = join(',', $tags->pluck('tag')->toArray());
|
||||
$names = implode(',', $tags->pluck('tag')->toArray());
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
|
@@ -65,7 +65,7 @@ class IsSandstormUserTest extends TestCase
|
||||
$response = $this->get('/_test/is-sandstorm');
|
||||
|
||||
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
|
||||
$response->assertSessionHas('warning', strval(trans('firefly.sandstorm_not_available')));
|
||||
$response->assertSessionHas('warning', (string)trans('firefly.sandstorm_not_available'));
|
||||
$response->assertRedirect(route('index'));
|
||||
putenv('SANDSTORM=0');
|
||||
}
|
||||
|
@@ -128,7 +128,7 @@ class TransactionUpdateServiceTest extends TestCase
|
||||
'foreign_amount' => null,
|
||||
'budget_id' => null,
|
||||
'budget_name' => null,
|
||||
'destination_id' => intval($source->account_id),
|
||||
'destination_id' => (int)$source->account_id,
|
||||
'destination_name' => null,
|
||||
'category_id' => null,
|
||||
'category_name' => null,
|
||||
@@ -167,7 +167,7 @@ class TransactionUpdateServiceTest extends TestCase
|
||||
'foreign_amount' => '12.34',
|
||||
'budget_id' => null,
|
||||
'budget_name' => null,
|
||||
'destination_id' => intval($source->account_id),
|
||||
'destination_id' => (int)$source->account_id,
|
||||
'destination_name' => null,
|
||||
'category_id' => null,
|
||||
'category_name' => null,
|
||||
@@ -210,7 +210,7 @@ class TransactionUpdateServiceTest extends TestCase
|
||||
'foreign_amount' => null,
|
||||
'budget_id' => null,
|
||||
'budget_name' => null,
|
||||
'source_id' => intval($source->account_id),
|
||||
'source_id' => (int)$source->account_id,
|
||||
'source_name' => null,
|
||||
'category_id' => null,
|
||||
'category_name' => null,
|
||||
|
@@ -44,7 +44,7 @@ class AppendNotesTest extends TestCase
|
||||
$note = $journal->notes()->first();
|
||||
$start = 'Default note text';
|
||||
$toAppend = 'This is appended';
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note();
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class AppendNotesTest extends TestCase
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::find(4);
|
||||
$note = $journal->notes()->first();
|
||||
if (!is_null($note)) {
|
||||
if (null !== $note) {
|
||||
$note->forceDelete();
|
||||
}
|
||||
$toAppend = 'This is appended';
|
||||
|
@@ -42,7 +42,7 @@ class ClearNotesTest extends TestCase
|
||||
// give journal a note:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$note = $journal->notes()->first();
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note;
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ class PrependNotesTest extends TestCase
|
||||
$note = $journal->notes()->first();
|
||||
$start = 'Default note text';
|
||||
$toPrepend = 'This is prepended';
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note();
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class PrependNotesTest extends TestCase
|
||||
// give journal some notes.
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$note = $journal->notes()->first();
|
||||
if (!is_null($note)) {
|
||||
if (null !== $note) {
|
||||
$note->forceDelete();
|
||||
}
|
||||
$toPrepend = 'This is appended';
|
||||
|
@@ -41,7 +41,7 @@ class RemoveAllTagsTest extends TestCase
|
||||
{
|
||||
// find journal with at least one tag
|
||||
$journalIds = DB::table('tag_transaction_journal')->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||
$journalId = intval($journalIds[0]);
|
||||
$journalId = (int)$journalIds[0];
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = TransactionJournal::find($journalId);
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class RemoveTagTest extends TestCase
|
||||
|
||||
// find journal with at least one tag
|
||||
$journalIds = DB::table('tag_transaction_journal')->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
||||
$journalId = intval($journalIds[0]);
|
||||
$journalId = (int)$journalIds[0];
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = TransactionJournal::find($journalId);
|
||||
$originalCount = $journal->tags()->count();
|
||||
|
@@ -42,7 +42,7 @@ class SetNotesTest extends TestCase
|
||||
// give journal a note:
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$note = $journal->notes()->first();
|
||||
if (is_null($note)) {
|
||||
if (null === $note) {
|
||||
$note = new Note;
|
||||
$note->noteable()->associate($journal);
|
||||
}
|
||||
|
@@ -36,8 +36,11 @@ class FromAccountStartsTest extends TestCase
|
||||
*/
|
||||
public function testTriggered()
|
||||
{
|
||||
$transaction = null;
|
||||
do {
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
} while (null === $transaction);
|
||||
$account = $transaction->account;
|
||||
|
||||
$trigger = FromAccountStarts::makeFromStrings(substr($account->name, 0, -3), false);
|
||||
@@ -50,8 +53,12 @@ class FromAccountStartsTest extends TestCase
|
||||
*/
|
||||
public function testTriggeredLonger()
|
||||
{
|
||||
$transaction = null;
|
||||
do {
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
} while (null === $transaction);
|
||||
|
||||
$account = $transaction->account;
|
||||
|
||||
$trigger = FromAccountStarts::makeFromStrings('bla-bla-bla' . $account->name, false);
|
||||
|
@@ -74,7 +74,7 @@ class ToAccountEndsTest extends TestCase
|
||||
{
|
||||
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
|
||||
|
||||
$trigger = ToAccountEnds::makeFromStrings(strval(random_int(1, 234)), false);
|
||||
$trigger = ToAccountEnds::makeFromStrings((string)random_int(1, 234), false);
|
||||
$result = $trigger->triggered($journal);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user