diff --git a/tests/controllers/JsonControllerTest.php b/tests/controllers/JsonControllerTest.php index 46618bf5fa..912ee55ce7 100644 --- a/tests/controllers/JsonControllerTest.php +++ b/tests/controllers/JsonControllerTest.php @@ -53,6 +53,7 @@ class JsonControllerTest extends TestCase $bills->shouldReceive('getActiveBills')->andReturn($collection); $bills->shouldReceive('getRanges')->andReturn($ranges); $bills->shouldReceive('getJournalsInRange')->andReturn(new Collection); + $bills->shouldReceive('billPaymentsInRange')->andReturn(12); $accounts->shouldReceive('getCreditCards')->andReturn($ccs); $accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection); Amount::shouldReceive('format')->andReturn('xx'); @@ -111,7 +112,7 @@ class JsonControllerTest extends TestCase $this->be($user); $repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface'); - $repository->shouldReceive('journalsByExpenseAccount')->andReturn(new Collection); + $repository->shouldReceive('expenseInPeriod')->andReturn(new Collection); Amount::shouldReceive('format')->andReturn('xx'); Amount::shouldReceive('getCurrencyCode')->andReturn('X'); diff --git a/tests/helpers/ConnectJournalToPiggyBankTest.php b/tests/helpers/ConnectJournalToPiggyBankTest.php index a5bb44f568..c0e0241538 100644 --- a/tests/helpers/ConnectJournalToPiggyBankTest.php +++ b/tests/helpers/ConnectJournalToPiggyBankTest.php @@ -30,17 +30,6 @@ class ConnectJournalToPiggyBankTest extends TestCase parent::tearDown(); } - - public function testEmptyPiggyBankId() - { - $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); - $event = new JournalCreated($journal, 0); - $class = new ConnectJournalToPiggyBank(); - $result = $class->handle($event); - - $this->assertFalse($result); - } - public function testNoRepetition() { FactoryMuffin::create('FireflyIII\Models\TransactionType'); @@ -222,48 +211,4 @@ class ConnectJournalToPiggyBankTest extends TestCase $this->assertCount(1, $piggyBank->piggyBankEvents()->get()); } - public function testZeroAmount() - { - FactoryMuffin::create('FireflyIII\Models\TransactionType'); - FactoryMuffin::create('FireflyIII\Models\TransactionType'); - - $user = FactoryMuffin::create('FireflyIII\User'); - $this->be($user); - - $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); - $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); - $account1 = FactoryMuffin::create('FireflyIII\Models\Account'); - $account2 = FactoryMuffin::create('FireflyIII\Models\Account'); - $account1->user_id = $user->id; - $account2->user_id = $user->id; - $piggyBank->account_id = $account1->id; - $account1->save(); - $account2->save(); - $piggyBank->save(); - - Transaction::create( - [ - 'account_id' => $account1->id, - 'transaction_journal_id' => $journal->id, - 'amount' => 0 - ] - ); - Transaction::create( - [ - 'account_id' => $account2->id, - 'transaction_journal_id' => $journal->id, - 'amount' => 0 - ] - ); - - // two transactions: - - - $event = new JournalCreated($journal, $piggyBank->id); - $class = new ConnectJournalToPiggyBank(); - $result = $class->handle($event); - - - $this->assertFalse($result); - } } \ No newline at end of file diff --git a/tests/repositories/AccountRepositoryTest.php b/tests/repositories/AccountRepositoryTest.php index 1adaa429a9..c4b5207f38 100644 --- a/tests/repositories/AccountRepositoryTest.php +++ b/tests/repositories/AccountRepositoryTest.php @@ -537,7 +537,7 @@ class AccountRepositoryTest extends TestCase $this->be($piggyBank->account->user); - $result = $this->object->leftOnAccount($piggyBank->account); + $result = $this->object->leftOnAccount($piggyBank->account, new Carbon); $this->assertEquals($piggyBankRepetition->currentamount * -1, $result); diff --git a/tests/repositories/PiggyBankRepositoryTest.php b/tests/repositories/PiggyBankRepositoryTest.php index d6dd282fec..343b9a7c9e 100644 --- a/tests/repositories/PiggyBankRepositoryTest.php +++ b/tests/repositories/PiggyBankRepositoryTest.php @@ -34,49 +34,6 @@ class PiggyBankRepositoryTest extends TestCase parent::tearDown(); } - /** - * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::calculateParts - */ - public function testCalculateParts() - { - /** @var PiggyBankRepetition $repetition */ - $repetition = FactoryMuffin::create('FireflyIII\Models\PiggyBankRepetition'); - $repetition->startdate = new Carbon('2014-01-01'); - $repetition->targetdate = new Carbon('2014-12-31'); - $repetition->save(); - - $parts = $this->object->calculateParts($repetition); - - $this->assertCount(1, $parts); - - - } - - /** - * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::calculateParts - */ - public function testCalculatePartsWithReminder() - { - /** @var PiggyBankRepetition $repetition */ - $repetition = FactoryMuffin::create('FireflyIII\Models\PiggyBankRepetition'); - /** @var PiggyBank $piggyBank */ - $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); - $piggyBank->startdate = new Carbon('2014-01-01'); - $piggyBank->targetdate = new Carbon('2014-12-31'); - $piggyBank->remind_me = 1; - $piggyBank->reminder = 'monthly'; - $repetition->startdate = new Carbon('2014-01-01'); - $repetition->targetdate = new Carbon('2014-12-31'); - $repetition->piggy_bank_id = $piggyBank->id; - $repetition->save(); - $piggyBank->save(); - - $parts = $this->object->calculateParts($repetition); - $this->assertCount(12, $parts); - - - } - /** * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::createEvent */ @@ -88,23 +45,6 @@ class PiggyBankRepositoryTest extends TestCase $this->assertCount(1, $piggyBank->piggybankevents()->get()); } - /** - * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::createPiggyBankPart - */ - public function testCreatePiggyBankPart() - { - $repetition = FactoryMuffin::create('FireflyIII\Models\PiggyBankRepetition'); - $data = [ - 'repetition' => $repetition, - 'amountPerBar' => 100, - 'currentAmount' => 100, - 'cumulativeAmount' => 100, - 'startDate' => new Carbon, - 'targetDate' => new Carbon, - ]; - $part = $this->object->createPiggyBankPart($data); - $this->assertEquals($data['amountPerBar'], $part->getAmountPerBar()); - } /** * @covers FireflyIII\Repositories\PiggyBank\PiggyBankRepository::destroy