This should fix the tests on the translations branch.

This commit is contained in:
James Cole
2015-05-14 18:15:31 +02:00
parent a82b829da9
commit d3897eece7
6 changed files with 68 additions and 0 deletions

View File

@@ -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();

View File

@@ -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');
}

View File

@@ -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');

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();
}