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;
|
namespace FireflyIII\Bootstrap;
|
||||||
|
|
||||||
use Illuminate\Log\Writer;
|
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Foundation\Bootstrap\ConfigureLogging as IlluminateConfigureLogging;
|
use Illuminate\Foundation\Bootstrap\ConfigureLogging as IlluminateConfigureLogging;
|
||||||
|
use Illuminate\Log\Writer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ConfigureLogging
|
* Class ConfigureLogging
|
||||||
|
@ -70,6 +70,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
$this->exportDisk->put($file, $this->explanationString);
|
$this->exportDisk->put($file, $this->explanationString);
|
||||||
Log::debug('Also put explanation file "' . $file . '" in the zip.');
|
Log::debug('Also put explanation file "' . $file . '" in the zip.');
|
||||||
$this->getFiles()->push($file);
|
$this->getFiles()->push($file);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
foreach ($files as $entry) {
|
foreach ($files as $entry) {
|
||||||
$this->processOldUpload($entry);
|
$this->processOldUpload($entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
$writer->insertAll($rows);
|
$writer->insertAll($rows);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ class Processor
|
|||||||
$attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]);
|
$attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]);
|
||||||
$attachmentCollector->run();
|
$attachmentCollector->run();
|
||||||
$this->files = $this->files->merge($attachmentCollector->getFiles());
|
$this->files = $this->files->merge($attachmentCollector->getFiles());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +101,7 @@ class Processor
|
|||||||
$this->settings['endDate']->format('Y-m-d')
|
$this->settings['endDate']->format('Y-m-d')
|
||||||
. ').'
|
. ').'
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +114,7 @@ class Processor
|
|||||||
$uploadCollector->run();
|
$uploadCollector->run();
|
||||||
|
|
||||||
$this->files = $this->files->merge($uploadCollector->getFiles());
|
$this->files = $this->files->merge($uploadCollector->getFiles());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +130,7 @@ class Processor
|
|||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
Log::debug('Converted ' . $count . ' journals to "Entry" objects.');
|
Log::debug('Converted ' . $count . ' journals to "Entry" objects.');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +141,7 @@ class Processor
|
|||||||
{
|
{
|
||||||
$this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]);
|
$this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]);
|
||||||
$this->files->push($this->configurationMaker->make());
|
$this->files->push($this->configurationMaker->make());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +178,7 @@ class Processor
|
|||||||
$disk->delete($file);
|
$disk->delete($file);
|
||||||
}
|
}
|
||||||
Log::debug('Done!');
|
Log::debug('Done!');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +194,7 @@ class Processor
|
|||||||
$exporter->run();
|
$exporter->run();
|
||||||
$this->files->push($exporter->getFileName());
|
$this->files->push($exporter->getFileName());
|
||||||
Log::debug('Added "' . $exporter->getFileName() . '" to the list of files to include in the zip.');
|
Log::debug('Added "' . $exporter->getFileName() . '" to the list of files to include in the zip.');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class SendRegistrationMail
|
|||||||
} catch (Swift_TransportException $e) {
|
} catch (Swift_TransportException $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ class UserConfirmation
|
|||||||
$user = $event->user;
|
$user = $event->user;
|
||||||
$ipAddress = $event->ipAddress;
|
$ipAddress = $event->ipAddress;
|
||||||
$this->doConfirm($user, $ipAddress);
|
$this->doConfirm($user, $ipAddress);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ class UserConfirmation
|
|||||||
$user = $event->user;
|
$user = $event->user;
|
||||||
$ipAddress = $event->ipAddress;
|
$ipAddress = $event->ipAddress;
|
||||||
$this->doConfirm($user, $ipAddress);
|
$this->doConfirm($user, $ipAddress);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ class Data
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME may return null
|
* FIXME may return null
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCsvFileLocation(): string
|
public function getCsvFileLocation(): string
|
||||||
@ -92,6 +93,7 @@ class Data
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME may return null
|
* FIXME may return null
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDateFormat(): string
|
public function getDateFormat(): string
|
||||||
@ -111,6 +113,7 @@ class Data
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME may return null
|
* FIXME may return null
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDelimiter(): string
|
public function getDelimiter(): string
|
||||||
|
@ -95,8 +95,8 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
|||||||
{
|
{
|
||||||
$line = new BalanceLine;
|
$line = new BalanceLine;
|
||||||
$line->setBudget($budget);
|
$line->setBudget($budget);
|
||||||
$line->setStartDate($budget->startdate); // returned by getBudgetsAndLimitsInRange
|
$line->setStartDate($budget->startdate); // returned by getBudgetsAndLimitsInRange()
|
||||||
$line->setEndDate($budget->enddate); // returned by getBudgetsAndLimitsInRange
|
$line->setEndDate($budget->enddate); // returned by getBudgetsAndLimitsInRange()
|
||||||
|
|
||||||
// loop accounts:
|
// loop accounts:
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
|
@ -149,7 +149,6 @@ class BudgetController extends Controller
|
|||||||
$budgeted = '0';
|
$budgeted = '0';
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);
|
$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);
|
||||||
/** @var Carbon $date */
|
|
||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
$start = session('start', new Carbon);
|
$start = session('start', new Carbon);
|
||||||
/** @var Carbon $end */
|
/** @var Carbon $end */
|
||||||
|
@ -7,7 +7,6 @@ use FireflyIII\Http\Controllers\Controller;
|
|||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ class Kernel extends HttpKernel
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $bootstrappers = [
|
protected $bootstrappers
|
||||||
|
= [
|
||||||
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
||||||
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||||
'FireflyIII\Bootstrap\ConfigureLogging',
|
'FireflyIII\Bootstrap\ConfigureLogging',
|
||||||
|
@ -3,9 +3,10 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Providers;
|
namespace FireflyIII\Providers;
|
||||||
|
|
||||||
|
use Config;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Log;
|
use Log;
|
||||||
use Config;
|
|
||||||
/**
|
/**
|
||||||
* Class AppServiceProvider
|
* Class AppServiceProvider
|
||||||
*
|
*
|
||||||
|
@ -125,6 +125,7 @@ interface AccountRepositoryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param int $page
|
* @param int $page
|
||||||
* @param int $pageSize
|
* @param int $pageSize
|
||||||
|
*
|
||||||
* @return LengthAwarePaginator
|
* @return LengthAwarePaginator
|
||||||
*/
|
*/
|
||||||
public function getJournals(Account $account, int $page, int $pageSize = 50): 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.
|
* Get all journals that were recorded on this bill between these dates.
|
||||||
|
*
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
|
@ -119,6 +119,7 @@ class RuleRepository implements RuleRepositoryInterface
|
|||||||
$rule->order = ($rule->order + 1);
|
$rule->order = ($rule->order + 1);
|
||||||
$rule->save();
|
$rule->save();
|
||||||
$this->resetRulesInGroupOrder($rule->ruleGroup);
|
$this->resetRulesInGroupOrder($rule->ruleGroup);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +142,7 @@ class RuleRepository implements RuleRepositoryInterface
|
|||||||
$rule->order = ($rule->order - 1);
|
$rule->order = ($rule->order - 1);
|
||||||
$rule->save();
|
$rule->save();
|
||||||
$this->resetRulesInGroupOrder($rule->ruleGroup);
|
$this->resetRulesInGroupOrder($rule->ruleGroup);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +344,7 @@ class RuleRepository implements RuleRepositoryInterface
|
|||||||
|
|
||||||
$this->storeAction($rule, $actionValues);
|
$this->storeAction($rule, $actionValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -349,6 +352,7 @@ class RuleRepository implements RuleRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param Rule $rule
|
* @param Rule $rule
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function storeTriggers(Rule $rule, array $data): bool
|
private function storeTriggers(Rule $rule, array $data): bool
|
||||||
@ -378,6 +382,7 @@ class RuleRepository implements RuleRepositoryInterface
|
|||||||
$this->storeTrigger($rule, $triggerValues);
|
$this->storeTrigger($rule, $triggerValues);
|
||||||
$order++;
|
$order++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
$ruleGroup->order = ($ruleGroup->order + 1);
|
$ruleGroup->order = ($ruleGroup->order + 1);
|
||||||
$ruleGroup->save();
|
$ruleGroup->save();
|
||||||
$this->resetRuleGroupOrder();
|
$this->resetRuleGroupOrder();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +156,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
$ruleGroup->order = ($ruleGroup->order - 1);
|
$ruleGroup->order = ($ruleGroup->order - 1);
|
||||||
$ruleGroup->save();
|
$ruleGroup->save();
|
||||||
$this->resetRuleGroupOrder();
|
$this->resetRuleGroupOrder();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ namespace FireflyIII\Repositories\Tag;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
use FireflyIII\Models\Tag;
|
use FireflyIII\Models\Tag;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
|
@ -4,7 +4,6 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Repositories\Tag;
|
namespace FireflyIII\Repositories\Tag;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
use FireflyIII\Models\Tag;
|
use FireflyIII\Models\Tag;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
@ -114,6 +114,7 @@ class Preferences
|
|||||||
$pref = new Preference;
|
$pref = new Preference;
|
||||||
$pref->name = $name;
|
$pref->name = $name;
|
||||||
$pref->data = $value;
|
$pref->data = $value;
|
||||||
|
|
||||||
return $pref;
|
return $pref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ return [
|
|||||||
'1M' => 'monthly',
|
'1M' => 'monthly',
|
||||||
'3M' => 'quarterly',
|
'3M' => 'quarterly',
|
||||||
'6M' => 'half-year',
|
'6M' => 'half-year',
|
||||||
|
'1Y' => 'yearly',
|
||||||
'custom' => 'monthly',
|
'custom' => 'monthly',
|
||||||
],
|
],
|
||||||
'subTitlesByIdentifier' =>
|
'subTitlesByIdentifier' =>
|
||||||
|
@ -74,19 +74,4 @@ class ChartBudgetControllerTest extends TestCase
|
|||||||
$this->assertResponseStatus(200);
|
$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