Fixed some tests.

This commit is contained in:
James Cole
2015-06-28 08:24:12 +02:00
parent 4673170531
commit e4e2921f3e
30 changed files with 49 additions and 153 deletions

View File

@@ -81,6 +81,7 @@ class AccountControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
$lastActivity->data = microtime();
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
@@ -152,6 +153,7 @@ class AccountControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
// get edit page:
$this->call('GET', '/accounts/edit/' . $this->account->id);
@@ -182,6 +184,7 @@ class AccountControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('');
Amount::shouldReceive('getCurrencyCode')->andReturn('A');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
// put stuff in session:
@@ -204,6 +207,7 @@ class AccountControllerTest extends TestCase
// mock!
Amount::shouldReceive('getCurrencyCode')->andReturn('A');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$repository->shouldReceive('getJournals')->andReturn(new LengthAwarePaginator([], 0, 10));

View File

@@ -52,6 +52,7 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/bills/create');
$this->assertViewHas('subTitle', 'Create new bill');
@@ -101,6 +102,7 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/bills/edit/' . $bill->id);
$this->assertViewHas('subTitle', 'Edit bill "' . e($bill->name) . '"');
@@ -120,6 +122,7 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('XX');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$repository->shouldReceive('getBills')->once()->andReturn($collection);
@@ -190,6 +193,7 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('XX');
Amount::shouldReceive('formatJournal')->andReturn('XX');
Amount::shouldReceive('getCurrencyCode')->andReturn('XX');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/bills/show/' . $bill->id);

View File

@@ -156,6 +156,7 @@ class BudgetControllerTest extends TestCase
Amount::shouldReceive('getCurrencySymbol')->andReturn('x');
Amount::shouldReceive('format')->andReturn('x');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
$this->call('GET', '/budgets');
@@ -221,6 +222,7 @@ class BudgetControllerTest extends TestCase
$paginator = new LengthAwarePaginator(new Collection, 0, 20, 1);
Amount::shouldReceive('getCurrencyCode')->andReturn('x');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('format')->andReturn('x');
$repository->shouldReceive('getJournals')->andReturn($paginator);
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
@@ -247,6 +249,7 @@ class BudgetControllerTest extends TestCase
$this->be($otherBudget->user);
Amount::shouldReceive('getCurrencyCode')->andReturn('x');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('format')->andReturn('x');
$repository->shouldReceive('getJournals')->andReturn(new Collection);
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
@@ -271,6 +274,7 @@ class BudgetControllerTest extends TestCase
$paginator = new LengthAwarePaginator(new Collection, 0, 20, 1);
Amount::shouldReceive('getCurrencyCode')->andReturn('x');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('format')->andReturn('x');
$repository->shouldReceive('getJournals')->andReturn($paginator);
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
@@ -412,6 +416,7 @@ class BudgetControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
$lastActivity->data = microtime();
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);

View File

@@ -107,6 +107,7 @@ class CategoryControllerTest extends TestCase
$collection->push($category);
Amount::shouldReceive('getCurrencyCode')->andReturn('xx');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('getCategories')->andReturn($collection);
@@ -129,6 +130,7 @@ class CategoryControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('xx');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
@@ -159,6 +161,7 @@ class CategoryControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('xx');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('formatJournal')->andReturn('xx');
$this->call('GET', '/categories/show/' . $category->id);

View File

@@ -119,6 +119,7 @@ class HomeControllerTest extends TestCase
Amount::shouldReceive('getCurrencyCode')->andReturn('EUR');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('format')->andReturn('xxx');
Amount::shouldReceive('formatJournal')->with($journal)->andReturn('xxx');

View File

@@ -61,6 +61,7 @@ class JsonControllerTest extends TestCase
$accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Steam::shouldReceive('balance')->andReturn(0);
@@ -92,6 +93,7 @@ class JsonControllerTest extends TestCase
$accounts->shouldReceive('getCreditCards')->andReturn($ccs);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Steam::shouldReceive('balance')->andReturn(-1);
$this->call('GET', '/json/box/bills-unpaid');
@@ -110,6 +112,7 @@ class JsonControllerTest extends TestCase
$repository->shouldReceive('incomeInPeriodCorrected')->andReturn(new Collection);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/json/box/in');
$this->assertResponseOk();
@@ -127,6 +130,7 @@ class JsonControllerTest extends TestCase
$repository->shouldReceive('expenseInPeriodCorrected')->andReturn(new Collection);
Amount::shouldReceive('format')->andReturn('xx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/json/box/out');
$this->assertResponseOk();

View File

@@ -47,6 +47,8 @@ class NewUserControllerTest extends TestCase
$lastActivity = FactoryMuffin::create('FireflyIII\Models\Preference');
$lastActivity->data = microtime();
Preferences::shouldReceive('lastActivity')->andReturn($lastActivity);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/new-user');
$this->assertResponseStatus(200);

View File

@@ -58,6 +58,7 @@ class PiggyBankControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('XXxx');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/piggy-banks/add/' . $piggyBank->id);
$this->assertResponseOk();
@@ -208,6 +209,7 @@ class PiggyBankControllerTest extends TestCase
$accounts->shouldReceive('leftOnAccount')->andReturn(12);
Amount::shouldReceive('format')->andReturn('123');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('GET', '/piggy-banks');
@@ -254,6 +256,7 @@ class PiggyBankControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('something');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe']);
$this->assertResponseStatus(302);
@@ -273,6 +276,7 @@ class PiggyBankControllerTest extends TestCase
Amount::shouldReceive('format')->andReturn('something');
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
$this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe', 'amount' => '10000']);
$this->assertResponseStatus(302);

View File

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

View File

@@ -339,6 +339,7 @@ class TransactionControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
Amount::shouldReceive('getAllCurrencies')->andReturn([$currency]);
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
Amount::shouldReceive('getCurrencySymbol')->andReturn('X');
Amount::shouldReceive('formatTransaction')->andReturn('X');
Amount::shouldReceive('format')->andReturn('X');