mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some code cleanup. Fixes the tests.
This commit is contained in:
parent
53c80aaef8
commit
eb5e55a272
@ -9,9 +9,9 @@
|
||||
|
||||
namespace FireflyIII\Bootstrap;
|
||||
|
||||
use Illuminate\Log\Writer;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Foundation\Bootstrap\ConfigureLogging as IlluminateConfigureLogging;
|
||||
use Illuminate\Log\Writer;
|
||||
|
||||
/**
|
||||
* Class ConfigureLogging
|
||||
@ -26,7 +26,7 @@ class ConfigureLogging extends IlluminateConfigureLogging
|
||||
*/
|
||||
protected function configureSingleHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useFiles($app->storagePath().'/logs/firefly-iii.log');
|
||||
$log->useFiles($app->storagePath() . '/logs/firefly-iii.log');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -36,7 +36,7 @@ class ConfigureLogging extends IlluminateConfigureLogging
|
||||
protected function configureDailyHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useDailyFiles(
|
||||
$app->storagePath().'/logs/firefly-iii.log',
|
||||
$app->storagePath() . '/logs/firefly-iii.log',
|
||||
$app->make('config')->get('app.log_max_files', 5)
|
||||
);
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||
$this->exportDisk->put($file, $this->explanationString);
|
||||
Log::debug('Also put explanation file "' . $file . '" in the zip.');
|
||||
$this->getFiles()->push($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
||||
foreach ($files as $entry) {
|
||||
$this->processOldUpload($entry);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface
|
||||
|
||||
}
|
||||
$writer->insertAll($rows);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ class Processor
|
||||
$attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]);
|
||||
$attachmentCollector->run();
|
||||
$this->files = $this->files->merge($attachmentCollector->getFiles());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -100,6 +101,7 @@ class Processor
|
||||
$this->settings['endDate']->format('Y-m-d')
|
||||
. ').'
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -112,6 +114,7 @@ class Processor
|
||||
$uploadCollector->run();
|
||||
|
||||
$this->files = $this->files->merge($uploadCollector->getFiles());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -127,6 +130,7 @@ class Processor
|
||||
$count++;
|
||||
}
|
||||
Log::debug('Converted ' . $count . ' journals to "Entry" objects.');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -137,6 +141,7 @@ class Processor
|
||||
{
|
||||
$this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]);
|
||||
$this->files->push($this->configurationMaker->make());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -173,6 +178,7 @@ class Processor
|
||||
$disk->delete($file);
|
||||
}
|
||||
Log::debug('Done!');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -188,6 +194,7 @@ class Processor
|
||||
$exporter->run();
|
||||
$this->files->push($exporter->getFileName());
|
||||
Log::debug('Added "' . $exporter->getFileName() . '" to the list of files to include in the zip.');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,7 @@ class SendRegistrationMail
|
||||
} catch (Swift_TransportException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ class UserConfirmation
|
||||
$user = $event->user;
|
||||
$ipAddress = $event->ipAddress;
|
||||
$this->doConfirm($user, $ipAddress);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -62,6 +63,7 @@ class UserConfirmation
|
||||
$user = $event->user;
|
||||
$ipAddress = $event->ipAddress;
|
||||
$this->doConfirm($user, $ipAddress);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ class Data
|
||||
|
||||
/**
|
||||
* FIXME may return null
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCsvFileLocation(): string
|
||||
@ -92,6 +93,7 @@ class Data
|
||||
|
||||
/**
|
||||
* FIXME may return null
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDateFormat(): string
|
||||
@ -111,6 +113,7 @@ class Data
|
||||
|
||||
/**
|
||||
* FIXME may return null
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter(): string
|
||||
|
@ -95,8 +95,8 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
{
|
||||
$line = new BalanceLine;
|
||||
$line->setBudget($budget);
|
||||
$line->setStartDate($budget->startdate); // returned by getBudgetsAndLimitsInRange
|
||||
$line->setEndDate($budget->enddate); // returned by getBudgetsAndLimitsInRange
|
||||
$line->setStartDate($budget->startdate); // returned by getBudgetsAndLimitsInRange()
|
||||
$line->setEndDate($budget->enddate); // returned by getBudgetsAndLimitsInRange()
|
||||
|
||||
// loop accounts:
|
||||
foreach ($accounts as $account) {
|
||||
|
@ -149,7 +149,6 @@ class BudgetController extends Controller
|
||||
$budgeted = '0';
|
||||
$range = Preferences::get('viewRange', '1M')->data;
|
||||
$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);
|
||||
/** @var Carbon $date */
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', new Carbon);
|
||||
/** @var Carbon $end */
|
||||
|
@ -7,7 +7,6 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Response;
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ class PreferencesController extends Controller
|
||||
|
||||
// save page size:
|
||||
$transactionPageSize = intval(Input::get('transactionPageSize'));
|
||||
if($transactionPageSize > 0 && $transactionPageSize < 1337) {
|
||||
if ($transactionPageSize > 0 && $transactionPageSize < 1337) {
|
||||
Preferences::set('transactionPageSize', $transactionPageSize);
|
||||
} else {
|
||||
Preferences::set('transactionPageSize', 50);
|
||||
|
@ -36,7 +36,8 @@ class Kernel extends HttpKernel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $bootstrappers = [
|
||||
protected $bootstrappers
|
||||
= [
|
||||
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
||||
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||
'FireflyIII\Bootstrap\ConfigureLogging',
|
||||
|
@ -38,7 +38,7 @@ class TransactionJournalMeta extends Model
|
||||
{
|
||||
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
protected $fillable = ['transaction_journal_id', 'name', 'data','hash'];
|
||||
protected $fillable = ['transaction_journal_id', 'name', 'data', 'hash'];
|
||||
protected $table = 'journal_meta';
|
||||
|
||||
/**
|
||||
|
@ -3,9 +3,10 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use Config;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Log;
|
||||
use Config;
|
||||
|
||||
/**
|
||||
* Class AppServiceProvider
|
||||
*
|
||||
|
@ -125,6 +125,7 @@ interface AccountRepositoryInterface
|
||||
* @param Account $account
|
||||
* @param int $page
|
||||
* @param int $pageSize
|
||||
*
|
||||
* @return LengthAwarePaginator
|
||||
*/
|
||||
public function getJournals(Account $account, int $page, int $pageSize = 50): LengthAwarePaginator;
|
||||
|
@ -327,6 +327,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
|
||||
/**
|
||||
* Get all journals that were recorded on this bill between these dates.
|
||||
*
|
||||
* @param Bill $bill
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
|
@ -119,6 +119,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
$rule->order = ($rule->order + 1);
|
||||
$rule->save();
|
||||
$this->resetRulesInGroupOrder($rule->ruleGroup);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -141,6 +142,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
$rule->order = ($rule->order - 1);
|
||||
$rule->save();
|
||||
$this->resetRulesInGroupOrder($rule->ruleGroup);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -342,6 +344,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
|
||||
$this->storeAction($rule, $actionValues);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@ -349,6 +352,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function storeTriggers(Rule $rule, array $data): bool
|
||||
@ -378,6 +382,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
$this->storeTrigger($rule, $triggerValues);
|
||||
$order++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
$ruleGroup->order = ($ruleGroup->order + 1);
|
||||
$ruleGroup->save();
|
||||
$this->resetRuleGroupOrder();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -155,6 +156,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
$ruleGroup->order = ($ruleGroup->order - 1);
|
||||
$ruleGroup->save();
|
||||
$this->resetRuleGroupOrder();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ namespace FireflyIII\Repositories\Tag;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
|
@ -4,7 +4,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Repositories\Tag;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Support\Collection;
|
||||
|
@ -114,6 +114,7 @@ class Preferences
|
||||
$pref = new Preference;
|
||||
$pref->name = $name;
|
||||
$pref->data = $value;
|
||||
|
||||
return $pref;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ return [
|
||||
'1M' => 'monthly',
|
||||
'3M' => 'quarterly',
|
||||
'6M' => 'half-year',
|
||||
'1Y' => 'yearly',
|
||||
'custom' => 'monthly',
|
||||
],
|
||||
'subTitlesByIdentifier' =>
|
||||
|
@ -74,19 +74,4 @@ class ChartBudgetControllerTest extends TestCase
|
||||
$this->assertResponseStatus(200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\Chart\BudgetController::year
|
||||
*/
|
||||
public function testYear()
|
||||
{
|
||||
$repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$repository->shouldReceive('getBudgetsAndExpensesPerMonth')->once()->andReturn([]);
|
||||
$repository->shouldReceive('getWithoutBudgetSum')->times(12)->andReturn('0');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('GET', '/chart/budget/year/default/20150101/20151231/1');
|
||||
$this->assertResponseStatus(200);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user