diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php
index ca7834b792..a0ebcb6bb5 100644
--- a/app/Http/Controllers/Chart/TagReportController.php
+++ b/app/Http/Controllers/Chart/TagReportController.php
@@ -233,7 +233,7 @@ class TagReportController extends Controller
}
}
if (count($newSet) === 0) {
- $newSet = $chartData;
+ $newSet = $chartData; // @codeCoverageIgnore
}
$data = $this->generator->multiSet($newSet);
$cache->store($data);
diff --git a/app/Http/Controllers/Json/ExchangeController.php b/app/Http/Controllers/Json/ExchangeController.php
index 41aa139bf3..e96cae05e8 100644
--- a/app/Http/Controllers/Json/ExchangeController.php
+++ b/app/Http/Controllers/Json/ExchangeController.php
@@ -14,7 +14,6 @@ namespace FireflyIII\Http\Controllers\Json;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
-use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Services\Currency\ExchangeRateInterface;
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index 2ba2f23c5b..27c7cdba77 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -269,8 +269,10 @@ class SingleController extends Controller
$foreignCurrencyId = intval($journal->getMeta('foreign_currency_id'));
if ($foreignCurrencyId > 0) {
// update some fields in pre-filled.
+ // @codeCoverageIgnoreStart
$preFilled['amount'] = $journal->getMeta('foreign_amount');
$preFilled['currency'] = $this->currency->find(intval($journal->getMeta('foreign_currency_id')));
+ // @codeCoverageIgnoreEnd
}
if ($journal->isWithdrawal() && $destinationAccounts->first()->accountType->type == AccountType::CASH) {
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index cbb8e241f7..3e4f5ea09b 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -185,9 +185,11 @@ class TransactionController extends Controller
$foreignCurrency = null;
if ($journal->hasMeta('foreign_currency_id')) {
+ // @codeCoverageIgnoreStart
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
$foreignCurrency = $repository->find(intval($journal->getMeta('foreign_currency_id')));
+ // @codeCoverageIgnoreEnd
}
return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'foreignCurrency'));
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
index 24ee6536a2..df79a8b3c6 100644
--- a/database/factories/ModelFactory.php
+++ b/database/factories/ModelFactory.php
@@ -36,11 +36,35 @@ $factory->define(
}
);
+$factory->define(
+ FireflyIII\Models\CurrencyExchangeRate::class, function (Faker\Generator $faker) {
+
+ return [
+ 'user_id' => 1,
+ 'from_currency_id' => 1,
+ 'to_currency_id' => 2,
+ 'date' => '2017-01-01',
+ 'rate' => '1.5',
+ 'user_rate' => null,
+ ];
+}
+);
+
+$factory->define(
+ FireflyIII\Models\TransactionCurrency::class, function (Faker\Generator $faker) {
+
+ return [
+ 'name' => $faker->words(1, true),
+ 'code' => 'ABC',
+ 'symbol' => 'x',
+ ];
+}
+);
$factory->define(
FireflyIII\Models\ImportJob::class, function (Faker\Generator $faker) {
return [
- 'id' => $faker->numberBetween(1, 10),
+ 'id' => $faker->numberBetween(1, 100),
'user_id' => 1,
'key' => $faker->words(1, true),
'file_type' => 'csv',
@@ -101,7 +125,7 @@ $factory->define(
$factory->define(
FireflyIII\Models\PiggyBank::class, function (Faker\Generator $faker) {
return [
- 'id' => $faker->numberBetween(1, 10),
+ 'id' => $faker->unique()->numberBetween(100, 10000),
'account_id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
'target_amount' => '1000.00',
@@ -116,7 +140,7 @@ $factory->define(
$factory->define(
FireflyIII\Models\Tag::class, function (Faker\Generator $faker) {
return [
- 'id' => $faker->numberBetween(100, 150),
+ 'id' => $faker->unique()->numberBetween(200, 10000),
'user_id' => 1,
'tagMode' => 'nothing',
'tag' => $faker->words(1, true),
diff --git a/phpunit.coverage.specific.xml b/phpunit.coverage.specific.xml
new file mode 100755
index 0000000000..0a42b9d726
--- /dev/null
+++ b/phpunit.coverage.specific.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ ./tests/Feature
+
+
+
+ ./tests/Unit
+
+
+
+
+
+
+
+
+
+ ./app
+
+
+ vendor/
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/phpunit.coverage.xml b/phpunit.coverage.xml
index d643a5d6ec..0997eb6bb2 100755
--- a/phpunit.coverage.xml
+++ b/phpunit.coverage.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.php
index e5956cb305..d80c7d0917 100644
--- a/tests/Feature/Controllers/AccountControllerTest.php
+++ b/tests/Feature/Controllers/AccountControllerTest.php
@@ -7,7 +7,7 @@
* See the LICENSE file for details.
*/
-declare(strict_types = 1);
+declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -16,6 +16,7 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
+use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
@@ -105,6 +106,7 @@ class AccountControllerTest extends TestCase
$repository = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('get')->andReturn(new Collection);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
+ $repository->shouldReceive('find')->once()->andReturn(new TransactionCurrency());
$this->be($this->user());
$account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
@@ -162,14 +164,16 @@ class AccountControllerTest extends TestCase
$repository = $this->mock(AccountRepositoryInterface::class);
$repository->shouldReceive('oldestJournalDate')->andReturn(clone $date)->once();
- $repository->shouldReceive('getAccountsByType')->andReturn(new Collection)->once();
$transaction = factory(Transaction::class)->make();
$collector = $this->mock(JournalCollectorInterface::class);
$collector->shouldReceive('setAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf();
+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf();
$collector->shouldReceive('setPage')->andReturnSelf();
+ $collector->shouldReceive('setTypes')->andReturnSelf();
+ $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]));
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));
@@ -198,6 +202,9 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf();
$collector->shouldReceive('setPage')->andReturnSelf();
+
+ $collector->shouldReceive('setTypes')->andReturnSelf();
+
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));
@@ -249,14 +256,14 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf();
$collector->shouldReceive('setPage')->andReturnSelf();
+
+ $collector->shouldReceive('setTypes')->andReturnSelf();
+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf();
+ $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]));
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10));
- $tasker = $this->mock(AccountTaskerInterface::class);
$repository = $this->mock(AccountRepositoryInterface::class);
$repository->shouldReceive('oldestJournalDate')->andReturn(new Carbon)->once();
- $repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->once()->andReturn(new Collection);
- $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
- $tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
@@ -284,12 +291,12 @@ class AccountControllerTest extends TestCase
$collector->shouldReceive('setPage')->andReturnSelf();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
- $tasker = $this->mock(AccountTaskerInterface::class);
$repository = $this->mock(AccountRepositoryInterface::class);
$repository->shouldReceive('oldestJournalDate')->andReturn(new Carbon);
- $repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->once()->andReturn(new Collection);
- $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
- $tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
+
+ $collector->shouldReceive('setTypes')->andReturnSelf();
+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf();
+ $collector->shouldReceive('getJournals')->andReturn(new Collection);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
diff --git a/tests/Feature/Controllers/Chart/AccountControllerTest.php b/tests/Feature/Controllers/Chart/AccountControllerTest.php
index 21665bcc27..25a766e2c7 100644
--- a/tests/Feature/Controllers/Chart/AccountControllerTest.php
+++ b/tests/Feature/Controllers/Chart/AccountControllerTest.php
@@ -304,17 +304,6 @@ class AccountControllerTest extends TestCase
$response->assertStatus(200);
}
- /**
- * @covers \FireflyIII\Http\Controllers\Chart\AccountController::period
- * @expectedExceptionMessage YYYY-MM-DD
- */
- public function testPeriodBadDate()
- {
- $this->be($this->user());
- $response = $this->get(route('chart.account.period', [1, 'bcdefed']));
- $response->assertStatus(500);
- }
-
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::report
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::accountBalanceChart
diff --git a/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php b/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php
index faa0aa69b5..f8270c231d 100644
--- a/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php
+++ b/tests/Feature/Controllers/Chart/CategoryReportControllerTest.php
@@ -123,7 +123,7 @@ class CategoryReportControllerTest extends TestCase
{
$generator = $this->mock(GeneratorInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
- $transaction = factory(Transaction::class)->make();
+ $transactions = factory(Transaction::class, 10)->make();
$collector->shouldReceive('setAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
@@ -132,7 +132,7 @@ class CategoryReportControllerTest extends TestCase
$collector->shouldReceive('disableFilter')->andReturnSelf();
$collector->shouldReceive('setCategories')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
- $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]));
+ $collector->shouldReceive('getJournals')->andReturn($transactions);
$generator->shouldReceive('multiSet')->andReturn([])->once();
$this->be($this->user());
diff --git a/tests/Feature/Controllers/Chart/ReportControllerTest.php b/tests/Feature/Controllers/Chart/ReportControllerTest.php
index 795abc80ff..7e1a3909c3 100644
--- a/tests/Feature/Controllers/Chart/ReportControllerTest.php
+++ b/tests/Feature/Controllers/Chart/ReportControllerTest.php
@@ -7,7 +7,7 @@
* See the LICENSE file for details.
*/
-declare(strict_types = 1);
+declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
@@ -33,6 +33,7 @@ class ReportControllerTest extends TestCase
public function testNetWorth()
{
$generator = $this->mock(GeneratorInterface::class);
+ $tasker = $this->mock(AccountTaskerInterface::class);
Steam::shouldReceive('balancesById')->andReturn(['5', '10']);
$generator->shouldReceive('singleSet')->andReturn([]);
@@ -50,9 +51,10 @@ class ReportControllerTest extends TestCase
{
$generator = $this->mock(GeneratorInterface::class);
$tasker = $this->mock(AccountTaskerInterface::class);
-
- $tasker->shouldReceive('amountOutInPeriod')->andReturn('-1');
- $tasker->shouldReceive('amountInInPeriod')->andReturn('1');
+ $income = [1 => ['sum' => '100']];
+ $expense = [2 => ['sum' => '-100']];
+ $tasker->shouldReceive('getIncomeReport')->once()->andReturn($income);
+ $tasker->shouldReceive('getExpenseReport')->once()->andReturn($expense);
$generator->shouldReceive('multiSet')->andReturn([]);
$this->be($this->user());
@@ -69,8 +71,11 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(GeneratorInterface::class);
$tasker = $this->mock(AccountTaskerInterface::class);
- $tasker->shouldReceive('amountOutInPeriod')->andReturn('-1');
- $tasker->shouldReceive('amountInInPeriod')->andReturn('1');
+ $income = [];
+ $expense = [];
+ $tasker->shouldReceive('getIncomeReport')->andReturn($income)->times(1);
+ $tasker->shouldReceive('getExpenseReport')->andReturn($expense)->times(1);
+
$generator->shouldReceive('multiSet')->andReturn([]);
$this->be($this->user());
diff --git a/tests/Feature/Controllers/Chart/TagReportControllerTest.php b/tests/Feature/Controllers/Chart/TagReportControllerTest.php
index 14458cd7ac..175955ae41 100644
--- a/tests/Feature/Controllers/Chart/TagReportControllerTest.php
+++ b/tests/Feature/Controllers/Chart/TagReportControllerTest.php
@@ -122,11 +122,17 @@ class TagReportControllerTest extends TestCase
*/
public function testMainChart()
{
- $generator = $this->mock(GeneratorInterface::class);
- $collector = $this->mock(JournalCollectorInterface::class);
- $transaction = factory(Transaction::class)->make();
- $tag = factory(Tag::class)->make();
- $transaction->transactionJournal->tags()->save($tag);
+ $generator = $this->mock(GeneratorInterface::class);
+ $collector = $this->mock(JournalCollectorInterface::class);
+ $set = new Collection;
+ for ($i = 0; $i < 10; $i++) {
+
+
+ $transaction = factory(Transaction::class)->make();
+ $tag = factory(Tag::class)->make();
+ $transaction->transactionJournal->tags()->save($tag);
+ $set->push($transaction);
+ }
$collector->shouldReceive('setAccounts')->andReturnSelf();
@@ -136,7 +142,7 @@ class TagReportControllerTest extends TestCase
$collector->shouldReceive('disableFilter')->andReturnSelf();
$collector->shouldReceive('setTags')->andReturnSelf();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
- $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]));
+ $collector->shouldReceive('getJournals')->andReturn($set);
$generator->shouldReceive('multiSet')->andReturn([])->once();
$this->be($this->user());
diff --git a/tests/Feature/Controllers/JavascriptControllerTest.php b/tests/Feature/Controllers/JavascriptControllerTest.php
index 9a44b78813..737cd8a301 100644
--- a/tests/Feature/Controllers/JavascriptControllerTest.php
+++ b/tests/Feature/Controllers/JavascriptControllerTest.php
@@ -26,6 +26,20 @@ use Tests\TestCase;
*/
class JavascriptControllerTest extends TestCase
{
+ /**
+ * @covers \FireflyIII\Http\Controllers\JavascriptController::currencies
+ */
+ public function testCurrencies()
+ {
+ $repository = $this->mock(CurrencyRepositoryInterface::class);
+ $currency = factory(TransactionCurrency::class)->make();
+ $repository->shouldReceive('get')->andReturn(new Collection([$currency]));
+
+ $this->be($this->user());
+ $response = $this->get(route('javascript.currencies'));
+ $response->assertStatus(200);
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\JavascriptController::accounts
*/
diff --git a/tests/Feature/Controllers/Json/ExchangeControllerTest.php b/tests/Feature/Controllers/Json/ExchangeControllerTest.php
new file mode 100644
index 0000000000..a92ee69d5a
--- /dev/null
+++ b/tests/Feature/Controllers/Json/ExchangeControllerTest.php
@@ -0,0 +1,55 @@
+mock(CurrencyRepositoryInterface::class);
+
+ $rate = factory(CurrencyExchangeRate::class)->make();
+ $repository->shouldReceive('getExchangeRate')->andReturn($rate);
+
+ $this->be($this->user());
+ $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']));
+ $response->assertStatus(200);
+ }
+
+ /**
+ * @covers \FireflyIII\Http\Controllers\Json\ExchangeController::getRate
+ */
+ public function testGetRateAmount()
+ {
+ $repository = $this->mock(CurrencyRepositoryInterface::class);
+ $rate = factory(CurrencyExchangeRate::class)->make();
+ $repository->shouldReceive('getExchangeRate')->andReturn($rate);
+
+ $this->be($this->user());
+ $response = $this->get(route('json.rate', ['EUR', 'USD', '20170101']) . '?amount=10');
+ $response->assertStatus(200);
+ }
+}
diff --git a/tests/Feature/Controllers/JsonControllerTest.php b/tests/Feature/Controllers/JsonControllerTest.php
index 82850b9fc7..798575bbef 100644
--- a/tests/Feature/Controllers/JsonControllerTest.php
+++ b/tests/Feature/Controllers/JsonControllerTest.php
@@ -7,7 +7,7 @@
* See the LICENSE file for details.
*/
-declare(strict_types = 1);
+declare(strict_types=1);
namespace Tests\Feature\Controllers;
@@ -17,7 +17,9 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
+use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
+use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
@@ -123,13 +125,18 @@ class JsonControllerTest extends TestCase
// mock stuff
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$tasker = $this->mock(AccountTaskerInterface::class);
+ $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $accountRepos->shouldReceive('getAccountsByType')->withArgs([([AccountType::DEFAULT, AccountType::ASSET, AccountType::CASH])])->once()->andReturn(
- new Collection
- );
- $accountRepos->shouldReceive('getAccountsByType')->withArgs([([AccountType::DEFAULT, AccountType::ASSET])])->once()->andReturn(new Collection);
- $tasker->shouldReceive('amountInInPeriod')->andReturn('100');
+ $transaction = factory(Transaction::class)->make();
+ $transaction->transaction_amount = '100.00';
+
+ $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
+ $collector->shouldReceive('setRange')->andReturnSelf()->once();
+ $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]))->once();
+ $collector->shouldReceive('setTypes')->withArgs([[TransactionType::DEPOSIT]])->andReturnSelf()->once();
+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once();
+
$this->be($this->user());
$response = $this->get(route('json.box.in'));
@@ -145,13 +152,17 @@ class JsonControllerTest extends TestCase
// mock stuff
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$tasker = $this->mock(AccountTaskerInterface::class);
+ $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $accountRepos->shouldReceive('getAccountsByType')->withArgs([([AccountType::DEFAULT, AccountType::ASSET, AccountType::CASH])])->once()->andReturn(
- new Collection
- );
- $accountRepos->shouldReceive('getAccountsByType')->withArgs([([AccountType::DEFAULT, AccountType::ASSET])])->once()->andReturn(new Collection);
- $tasker->shouldReceive('amountOutInPeriod')->andReturn('100');
+ $transaction = factory(Transaction::class)->make();
+ $transaction->transaction_amount = '100.00';
+
+ $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
+ $collector->shouldReceive('setRange')->andReturnSelf()->once();
+ $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction]))->once();
+ $collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL]])->andReturnSelf()->once();
+ $collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once();
$this->be($this->user());
$response = $this->get(route('json.box.out'));
@@ -165,7 +176,7 @@ class JsonControllerTest extends TestCase
public function testBudgets()
{
// mock stuff
- $budget = factory(Budget::class)->make();
+ $budget = factory(Budget::class)->make();
$categoryRepos = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
@@ -280,22 +291,6 @@ class JsonControllerTest extends TestCase
$response->assertStatus(200);
}
- /**
- * @covers \FireflyIII\Http\Controllers\JsonController::transactionTypes
- */
- public function testTransactionTypes()
- {
- // mock stuff
- $journalRepos = $this->mock(JournalRepositoryInterface::class);
- $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $journalRepos->shouldReceive('getTransactionTypes')->once()->andReturn(new Collection);
-
- $this->be($this->user());
- $response = $this->get(route('json.transaction-types', ['deposit']));
- $response->assertStatus(200);
- $response->assertExactJson([]);
- }
-
/**
* @covers \FireflyIII\Http\Controllers\JsonController::transactionJournals
*/
@@ -316,6 +311,22 @@ class JsonControllerTest extends TestCase
$response->assertExactJson([]);
}
+ /**
+ * @covers \FireflyIII\Http\Controllers\JsonController::transactionTypes
+ */
+ public function testTransactionTypes()
+ {
+ // mock stuff
+ $journalRepos = $this->mock(JournalRepositoryInterface::class);
+ $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
+ $journalRepos->shouldReceive('getTransactionTypes')->once()->andReturn(new Collection);
+
+ $this->be($this->user());
+ $response = $this->get(route('json.transaction-types', ['deposit']));
+ $response->assertStatus(200);
+ $response->assertExactJson([]);
+ }
+
/**
* @covers \FireflyIII\Http\Controllers\JsonController::trigger
*/
diff --git a/tests/Feature/Controllers/PiggyBankControllerTest.php b/tests/Feature/Controllers/PiggyBankControllerTest.php
index a185801ede..bd6003b7f5 100644
--- a/tests/Feature/Controllers/PiggyBankControllerTest.php
+++ b/tests/Feature/Controllers/PiggyBankControllerTest.php
@@ -161,9 +161,11 @@ class PiggyBankControllerTest extends TestCase
// mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
- $piggyBank = factory(PiggyBank::class)->make();
+ $one = factory(PiggyBank::class)->make();
+ $two = factory(PiggyBank::class)->make();
+ $two->account_id = $one->account_id;
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
- $repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$piggyBank]));
+ $repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$one, $two]));
Steam::shouldReceive('balanceIgnoreVirtual')->twice()->andReturn('1');
diff --git a/tests/Feature/Controllers/Report/OperationsControllerTest.php b/tests/Feature/Controllers/Report/OperationsControllerTest.php
index f675e477a1..58bbcce510 100644
--- a/tests/Feature/Controllers/Report/OperationsControllerTest.php
+++ b/tests/Feature/Controllers/Report/OperationsControllerTest.php
@@ -26,8 +26,6 @@ class OperationsControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Report\OperationsController::expenses
- * @covers \FireflyIII\Http\Controllers\Report\OperationsController::getExpenseReport
- * @covers \FireflyIII\Http\Controllers\Report\OperationsController::groupByOpposing
*/
public function testExpenses()
{
@@ -49,7 +47,6 @@ class OperationsControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Report\OperationsController::income
- * @covers \FireflyIII\Http\Controllers\Report\OperationsController::getIncomeReport
*/
public function testIncome()
{