diff --git a/tasks.txt b/tasks.txt deleted file mode 100644 index bd9c044afc..0000000000 --- a/tasks.txt +++ /dev/null @@ -1,2 +0,0 @@ -- replace \Session with Session -- find all event::fire's, and see if they fire in new ff as well. \ No newline at end of file diff --git a/tests/controllers/ReminderControllerTest.php b/tests/controllers/ReminderControllerTest.php index 25864aa2d1..0719edd721 100644 --- a/tests/controllers/ReminderControllerTest.php +++ b/tests/controllers/ReminderControllerTest.php @@ -64,7 +64,7 @@ class ReminderControllerTest extends TestCase $reminder = FactoryMuffin::create('FireflyIII\Models\Reminder'); $collection = new Collection([$reminder]); - $repository = $this->mock('FireflyIII\Repositories\Reminder\ReminderRepositoryInterface\ReminderRepositoryInterface'); + $repository = $this->mock('FireflyIII\Repositories\Reminder\ReminderRepositoryInterface'); $repository->shouldReceive('getActiveReminders')->andReturn($collection); $repository->shouldReceive('getExpiredReminders')->andReturn($collection); diff --git a/tests/controllers/TransactionControllerTest.php b/tests/controllers/TransactionControllerTest.php index b1780446f1..6902808bc4 100644 --- a/tests/controllers/TransactionControllerTest.php +++ b/tests/controllers/TransactionControllerTest.php @@ -289,11 +289,56 @@ class TransactionControllerTest extends TestCase 'account_id' => $account->id, 'expense_account' => 'Lunch House', 'amount' => '4.72', - 'amount_currency_id' => '1', + 'amount_currency_id' => $currency->id, 'date' => '2015-05-31', 'budget_id' => '0', 'category' => 'Lunch', - 'return_to_edit' => 1, + 'tags' => '', + 'piggy_bank_id' => '0', + ]; + + $this->call('POST', '/transactions/store/withdrawal', $data); + + // mock! + $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface'); + + // fake! + $repository->shouldReceive('update')->andReturn($journal); + + + $this->call('POST', '/transaction/update/' . $journal->id, $data); + //$this->assertSessionHas('errors','bla'); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); + + + } + + public function testUpdateWithRedirect() + { + $account = FactoryMuffin::create('FireflyIII\Models\Account'); + $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency'); + $journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal'); + FactoryMuffin::create('FireflyIII\Models\TransactionType'); + FactoryMuffin::create('FireflyIII\Models\TransactionType'); + FactoryMuffin::create('FireflyIII\Models\TransactionType'); + $this->be($journal->user); + $account->user_id = $journal->user_id; + $account->save(); + + $data = [ + '_token' => 'replaceMe', + 'id' => $journal->id, + 'what' => 'withdrawal', + 'description' => 'LunchX', + 'account_id' => $account->id, + 'expense_account' => 'Lunch House', + 'amount' => '4.72', + 'amount_currency_id' => $currency->id, + 'date' => '2015-05-31', + 'budget_id' => '0', + 'category' => 'Lunch', + 'return_to_edit' => 1, 'tags' => '', 'piggy_bank_id' => '0', ];