diff --git a/tests/controllers/BudgetControllerTest.php b/tests/controllers/BudgetControllerTest.php index 9a397fc61d..81eea23b41 100644 --- a/tests/controllers/BudgetControllerTest.php +++ b/tests/controllers/BudgetControllerTest.php @@ -141,11 +141,19 @@ class BudgetControllerTest extends TestCase public function testPostUpdateIncome() { + + $budget = FactoryMuffin::create('FireflyIII\Models\Budget'); $this->be($budget->user); $date = Carbon::now()->startOfMonth()->format('FY'); Preferences::shouldReceive('set')->once()->withArgs(['budgetIncomeTotal' . $date, 1001]); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('POST', '/budgets/income', ['_token' => 'replaceme', 'amount' => 1001]); $this->assertResponseStatus(302); $this->assertRedirectedToRoute('budgets.index'); @@ -311,6 +319,12 @@ class BudgetControllerTest extends TestCase Amount::shouldReceive('getCurrencyCode')->andReturn('X'); Amount::shouldReceive('getCurrencySymbol')->andReturn('X'); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/budgets/income'); $this->assertResponseOk(); diff --git a/tests/controllers/GoogleChartControllerTest.php b/tests/controllers/GoogleChartControllerTest.php index ed7bdf2969..8f443357b6 100644 --- a/tests/controllers/GoogleChartControllerTest.php +++ b/tests/controllers/GoogleChartControllerTest.php @@ -317,6 +317,12 @@ class GoogleChartControllerTest extends TestCase $repository->shouldReceive('journalsByExpenseAccount')->andReturn($journals); Preferences::shouldReceive('get')->withArgs(['showSharedReports', false])->once()->andReturn($preference); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/chart/reports/income-expenses/2015'); $this->assertResponseOk(); @@ -340,6 +346,12 @@ class GoogleChartControllerTest extends TestCase $repository->shouldReceive('journalsByExpenseAccount')->andReturn($journals); Preferences::shouldReceive('get')->withArgs(['showSharedReports', false])->once()->andReturn($preference); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/chart/reports/income-expenses-sum/2015'); } diff --git a/tests/controllers/HomeControllerTest.php b/tests/controllers/HomeControllerTest.php index d9491bac8c..10edfb7ed5 100644 --- a/tests/controllers/HomeControllerTest.php +++ b/tests/controllers/HomeControllerTest.php @@ -102,6 +102,12 @@ class HomeControllerTest extends TestCase $repository->shouldReceive('sumOfEverything')->once()->andReturn(1); $repository->shouldReceive('getFrontpageTransactions')->once()->andReturn($journals); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + Amount::shouldReceive('getCurrencyCode')->andReturn('EUR'); Amount::shouldReceive('format')->andReturn('xxx'); diff --git a/tests/controllers/JsonControllerTest.php b/tests/controllers/JsonControllerTest.php index 8d34d94b9f..bb7f1a37c0 100644 --- a/tests/controllers/JsonControllerTest.php +++ b/tests/controllers/JsonControllerTest.php @@ -187,6 +187,12 @@ class JsonControllerTest extends TestCase Preferences::shouldReceive('get')->withArgs(['showSharedReports', false])->andReturn($pref); Preferences::shouldReceive('set')->withArgs(['showSharedReports', true]); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/json/show-shared-reports/set'); $this->assertResponseOk(); } @@ -202,6 +208,12 @@ class JsonControllerTest extends TestCase Preferences::shouldReceive('get')->withArgs(['showSharedReports', false])->andReturn($pref); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/json/show-shared-reports'); $this->assertResponseOk(); diff --git a/tests/controllers/PreferencesControllerTest.php b/tests/controllers/PreferencesControllerTest.php index 2d843d2bed..67dfdfb80d 100644 --- a/tests/controllers/PreferencesControllerTest.php +++ b/tests/controllers/PreferencesControllerTest.php @@ -59,6 +59,12 @@ class PreferencesControllerTest extends TestCase Amount::shouldReceive('getAllCurrencies')->andReturn(new Collection); Amount::shouldReceive('getDefaultCurrency')->andReturn($currency); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/preferences'); $this->assertResponseOk(); } @@ -78,6 +84,12 @@ class PreferencesControllerTest extends TestCase Preferences::shouldReceive('set')->once()->withArgs(['viewRange', '1M']); Preferences::shouldReceive('set')->once()->withArgs(['budgetMaximum', 0]); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('POST', '/preferences', $data); $this->assertResponseStatus(302); diff --git a/tests/controllers/ReportControllerTest.php b/tests/controllers/ReportControllerTest.php index dfe6f6c0a7..6a3261274e 100644 --- a/tests/controllers/ReportControllerTest.php +++ b/tests/controllers/ReportControllerTest.php @@ -65,6 +65,12 @@ class ReportControllerTest extends TestCase $query->shouldReceive('balancedTransactionsSum')->withAnyArgs()->andReturn(100); $helper->shouldReceive('getBudgetsForMonth')->withAnyArgs()->andReturn($budgets); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/reports/budget/2015/1'); $this->assertResponseOk(); @@ -203,6 +209,12 @@ class ReportControllerTest extends TestCase Amount::shouldReceive('getCurrencySymbol')->andReturn('X'); Amount::shouldReceive('format')->andReturn('X'); + // language preference: + $language = FactoryMuffin::create('FireflyIII\Models\Preference'); + $language->data = 'en'; + $language->save(); + Preferences::shouldReceive('get')->withAnyArgs()->andReturn($language); + $this->call('GET', '/reports/2015/1'); $this->assertResponseOk(); }