This should fix all twig tests. Let's find out!

This commit is contained in:
James Cole
2015-05-02 19:44:12 +02:00
parent efe6f59f79
commit c7ae15a41a
12 changed files with 123 additions and 10 deletions

View File

@@ -69,6 +69,7 @@ class AccountControllerTest extends TestCase
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/accounts/create/asset');
$this->assertResponseOk();
@@ -127,6 +128,7 @@ class AccountControllerTest extends TestCase
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
// get edit page:
$this->call('GET', '/accounts/edit/' . $this->account->id);
@@ -153,7 +155,7 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('getLastActivity')->andReturn(null);
Amount::shouldReceive('format')->andReturn('');
Amount::shouldReceive('getCurrencyCode')->once()->andReturn('A');
Amount::shouldReceive('getCurrencyCode')->andReturn('A');
// put stuff in session:
@@ -172,7 +174,7 @@ class AccountControllerTest extends TestCase
$this->be($this->account->user);
// mock!
Amount::shouldReceive('getCurrencyCode')->once()->andReturn('A');
Amount::shouldReceive('getCurrencyCode')->andReturn('A');
$repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$repository->shouldReceive('getJournals')->andReturn(new LengthAwarePaginator([], 0, 10));

View File

@@ -72,6 +72,7 @@ class BillControllerTest extends TestCase
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/bills/create');
$this->assertViewHas('subTitle', 'Create new');
@@ -111,6 +112,7 @@ class BillControllerTest extends TestCase
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/bills/edit/' . $bill->id);
$this->assertViewHas('subTitle', 'Edit "' . e($bill->name) . '"');
@@ -126,6 +128,7 @@ class BillControllerTest extends TestCase
$collection->push($bill);
Amount::shouldReceive('format')->andReturn('XX');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$repository->shouldReceive('getBills')->once()->andReturn($collection);
@@ -187,6 +190,8 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('XX');
Amount::shouldReceive('getCurrencyCode')->andReturn('XX');
$this->call('GET', '/bills/show/' . $bill->id);
}

View File

@@ -115,6 +115,7 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('getCurrentRepetition')->once();
Amount::shouldReceive('getCurrencySymbol')->andReturn('x');
Amount::shouldReceive('format')->andReturn('x');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/budgets');
$this->assertResponseOk();
@@ -304,6 +305,10 @@ class BudgetControllerTest extends TestCase
$pref = FactoryMuffin::create('FireflyIII\Models\Preference');
Preferences::shouldReceive('get')->withArgs(['budgetIncomeTotal' . $date, 1000])->andReturn($pref);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/budgets/income');
$this->assertResponseOk();

View File

@@ -56,6 +56,7 @@ class JsonControllerTest extends TestCase
$accounts->shouldReceive('getCreditCards')->andReturn($ccs);
$accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Steam::shouldReceive('balance')->andReturn(0);
@@ -83,6 +84,7 @@ class JsonControllerTest extends TestCase
$bills->shouldReceive('createFakeBill')->andReturn($bill);
$accounts->shouldReceive('getCreditCards')->andReturn($ccs);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Steam::shouldReceive('balance')->andReturn(-1);
$this->call('GET', '/json/box/bills-unpaid');
@@ -97,6 +99,7 @@ class JsonControllerTest extends TestCase
$repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface');
$repository->shouldReceive('incomeByPeriod')->andReturn(new Collection);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/json/box/in');
$this->assertResponseOk();
@@ -110,6 +113,7 @@ class JsonControllerTest extends TestCase
$repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface');
$repository->shouldReceive('journalsByExpenseAccount')->andReturn(new Collection);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/json/box/out');
$this->assertResponseOk();

View File

@@ -50,6 +50,8 @@ class PiggyBankControllerTest extends TestCase
$repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$repository->shouldReceive('leftOnAccount')->withAnyArgs()->andReturn(12);
Amount::shouldReceive('format')->andReturn('XXxx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/piggy-banks/add/' . $piggyBank->id);
$this->assertResponseOk();
@@ -179,6 +181,7 @@ class PiggyBankControllerTest extends TestCase
Steam::shouldReceive('balance')->andReturn(20);
$accounts->shouldReceive('leftOnAccount')->andReturn(12);
Amount::shouldReceive('format')->andReturn('123');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/piggy-banks');
@@ -218,6 +221,7 @@ class PiggyBankControllerTest extends TestCase
$piggyBanks->shouldReceive('createEvent')->once();
Amount::shouldReceive('format')->andReturn('something');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe']);
$this->assertResponseStatus(302);
@@ -235,6 +239,7 @@ class PiggyBankControllerTest extends TestCase
$piggyBanks->shouldReceive('createEvent')->once();
Amount::shouldReceive('format')->andReturn('something');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe', 'amount' => '10000']);
$this->assertResponseStatus(302);
@@ -283,6 +288,8 @@ class PiggyBankControllerTest extends TestCase
$this->be($piggyBank->account->user);
Amount::shouldReceive('format')->andReturn('something');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/piggy-banks/remove/' . $piggyBank->id);
$this->assertResponseOk();

View File

@@ -55,6 +55,7 @@ class PreferencesControllerTest extends TestCase
Preferences::shouldReceive('get')->once()->withArgs(['budgetMaximum', 1000])->andReturn($pref);
Preferences::shouldReceive('get')->once()->withArgs(['currencyPreference', 'EUR'])->andReturn($pref);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getAllCurrencies')->andReturn(new Collection);
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);