From 0e068d4ccf34b6cf9ebee55cd3389fd2d803f2fd Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 13 May 2015 21:37:11 +0200 Subject: [PATCH] Fixed some tests. --- tests/helpers/ConnectJournalToPiggyBankTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/helpers/ConnectJournalToPiggyBankTest.php b/tests/helpers/ConnectJournalToPiggyBankTest.php index 841e17d27e..a40e4e0130 100644 --- a/tests/helpers/ConnectJournalToPiggyBankTest.php +++ b/tests/helpers/ConnectJournalToPiggyBankTest.php @@ -50,6 +50,7 @@ class ConnectJournalToPiggyBankTest extends TestCase $this->be($user); $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); + /** @var \FireflyIII\Models\PiggyBank $piggyBank */ $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); $account1 = FactoryMuffin::create('FireflyIII\Models\Account'); $account2 = FactoryMuffin::create('FireflyIII\Models\Account'); @@ -60,6 +61,13 @@ class ConnectJournalToPiggyBankTest extends TestCase $account2->save(); $piggyBank->save(); + // because the event handler responds to this piggy bank, we must remove + // the piggy bank repetition: + /** @var \FireflyIII\Models\PiggyBankRepetition $rep */ + foreach($piggyBank->piggyBankRepetitions()->get() as $rep) { + $rep->forceDelete(); + } + Transaction::create( [ 'account_id' => $account1->id,