diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php index 1e00357743..93a48a0633 100644 --- a/app/Helpers/Report/ReportQuery.php +++ b/app/Helpers/Report/ReportQuery.php @@ -254,7 +254,6 @@ class ReportQuery implements ReportQueryInterface $data->each( function (Model $object) { -// $object->description = intval($object->encrypted); $object->name = intval($object->account_encrypted) == 1 ? Crypt::decrypt($object->name) : $object->name; } ); diff --git a/app/Http/Controllers/GoogleChartController.php b/app/Http/Controllers/GoogleChartController.php index 37566986b9..b24dd68ae6 100644 --- a/app/Http/Controllers/GoogleChartController.php +++ b/app/Http/Controllers/GoogleChartController.php @@ -2,8 +2,6 @@ use Carbon\Carbon; use Crypt; -use DB; -use Exception; use FireflyIII\Helpers\Report\ReportQueryInterface; use FireflyIII\Models\Account; use FireflyIII\Models\Bill; @@ -480,11 +478,7 @@ class GoogleChartController extends Controller */ public function yearInExp($year, GChart $chart, ReportQueryInterface $query) { - try { - $start = new Carbon('01-01-' . $year); - } catch (Exception $e) { - return view('error')->with('message', 'Invalid year.'); - } + $start = new Carbon('01-01-' . $year); $chart->addColumn('Month', 'date'); $chart->addColumn('Income', 'number'); $chart->addColumn('Expenses', 'number'); @@ -532,11 +526,7 @@ class GoogleChartController extends Controller */ public function yearInExpSum($year, GChart $chart, ReportQueryInterface $query) { - try { - $start = new Carbon('01-01-' . $year); - } catch (Exception $e) { - return view('error')->with('message', 'Invalid year.'); - } + $start = new Carbon('01-01-' . $year); $chart->addColumn('Summary', 'string'); $chart->addColumn('Income', 'number'); $chart->addColumn('Expenses', 'number'); diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php index 5c03c30456..f8041286f7 100644 --- a/app/Http/Controllers/HelpController.php +++ b/app/Http/Controllers/HelpController.php @@ -5,7 +5,7 @@ use ErrorException; use League\CommonMark\CommonMarkConverter; use Response; use Route; - +use Log; /** * Class HelpController * @@ -27,7 +27,7 @@ class HelpController extends Controller ]; if (!Route::has($route)) { - \Log::error('No such route: ' . $route); + Log::error('No such route: ' . $route); return Response::json($content); } @@ -75,7 +75,7 @@ class HelpController extends Controller try { $content['text'] = file_get_contents($uri); } catch (ErrorException $e) { - \Log::error(trim($e->getMessage())); + Log::error(trim($e->getMessage())); } if (strlen(trim($content['text'])) == 0) { $content['text'] = '
There is no help for this route.
'; diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index 322e34c97a..fb69b046d9 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -239,6 +239,11 @@ class JsonController extends Controller return Response::json(['value' => $pref->data]); } + /** + * @param $what + * + * @return \Symfony\Component\HttpFoundation\Response + */ public function transactionJournals($what) { $descriptions = []; diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 50807a32b9..46e837d9e9 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -509,7 +509,6 @@ class AccountRepository implements AccountRepositoryInterface protected function updateMetadata(Account $account, array $data) { $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType']; - $updated = false; foreach ($validFields as $field) { $entry = $account->accountMeta()->where('name', $field)->first(); diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index bffdc88c94..d7991b6098 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -81,4 +81,4 @@ class CurrencyRepository implements CurrencyRepositoryInterface return $currency; } -} \ No newline at end of file +} diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index cfb72467ba..2514d08aba 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -49,4 +49,4 @@ interface CurrencyRepositoryInterface */ public function update(TransactionCurrency $currency, array $data); -} \ No newline at end of file +} diff --git a/database/migrations/2014_12_13_190730_changes_for_v321.php b/database/migrations/2014_12_13_190730_changes_for_v321.php index b381e774ab..5a0524d322 100644 --- a/database/migrations/2014_12_13_190730_changes_for_v321.php +++ b/database/migrations/2014_12_13_190730_changes_for_v321.php @@ -426,7 +426,6 @@ class ChangesForV321 extends Migration public function moveComponentIdToBudgetId() { - //Log::debug('Now in moveComponentIdToBudgetId()'); BudgetLimit::get()->each( function (BudgetLimit $bl) { Log::debug('Now at budgetLimit #' . $bl->id . ' with component_id: ' . $bl->component_id); @@ -447,7 +446,6 @@ class ChangesForV321 extends Migration } } ); - //Log::debug('Done with moveComponentIdToBudgetId()'); } diff --git a/resources/views/form/help.blade.php b/resources/views/form/help.blade.php index ce06cb2e49..9b6375c241 100644 --- a/resources/views/form/help.blade.php +++ b/resources/views/form/help.blade.php @@ -1,3 +1,3 @@ @if(isset($options['helpText'])){{$options['helpText']}}
-@endif \ No newline at end of file +@endif diff --git a/tests/controllers/GoogleChartControllerTest.php b/tests/controllers/GoogleChartControllerTest.php index 612b2d71f5..23ce5ccc8e 100644 --- a/tests/controllers/GoogleChartControllerTest.php +++ b/tests/controllers/GoogleChartControllerTest.php @@ -292,12 +292,47 @@ class GoogleChartControllerTest extends TestCase public function testYearInExp() { - $this->markTestIncomplete(); + $user = FactoryMuffin::create('FireflyIII\User'); + $preference = FactoryMuffin::create('FireflyIII\Models\Preference'); + $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); + $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); + $journals = new Collection([$journal1, $journal2]); + $this->be($user); + + + // mock! + $repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface'); + + // expect! + $repository->shouldReceive('incomeByPeriod')->andReturn($journals); + $repository->shouldReceive('journalsByExpenseAccount')->andReturn($journals); + Preferences::shouldReceive('get')->withArgs(['showSharedReports',false])->once()->andReturn($preference); + + + $this->call('GET', '/chart/reports/income-expenses/2015'); + $this->assertResponseOk(); } public function testYearInExpSum() { - $this->markTestIncomplete(); + $user = FactoryMuffin::create('FireflyIII\User'); + $preference = FactoryMuffin::create('FireflyIII\Models\Preference'); + $journal1 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); + $journal2 = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); + $journals = new Collection([$journal1, $journal2]); + $this->be($user); + + + // mock! + $repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface'); + + // expect! + $repository->shouldReceive('incomeByPeriod')->andReturn($journals); + $repository->shouldReceive('journalsByExpenseAccount')->andReturn($journals); + Preferences::shouldReceive('get')->withArgs(['showSharedReports',false])->once()->andReturn($preference); + + + $this->call('GET', '/chart/reports/income-expenses-sum/2015'); } } \ No newline at end of file