be($this->user()); $this->call('GET', '/transactions/create/withdrawal'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::delete */ public function testDelete() { $this->be($this->user()); $this->call('GET', '/transaction/delete/1'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::destroy */ public function testDestroy() { $this->session(['transactions.delete.url' => 'http://localhost']); $this->be($this->user()); $this->call('POST', '/transaction/destroy/1'); $this->assertResponseStatus(302); $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\TransactionController::edit */ public function testEdit() { $this->be($this->user()); $this->call('GET', '/transaction/edit/1'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::index * @dataProvider dateRangeProvider * * @param $range */ public function testIndex($range) { $journals = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface'); $journals->shouldReceive('getJournalsOfTypes')->once()->andReturn(new LengthAwarePaginator([], 0, 50)); $this->be($this->user()); $this->changeDateRange($this->user(), $range); $this->call('GET', '/transactions/deposit'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::reorder */ public function testReorder() { $args = [ 'ids' => [1], 'date' => '2015-01-01', ]; $this->be($this->user()); $this->call('POST', '/transaction/reorder', $args); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::show * @dataProvider dateRangeProvider * * @param $range */ public function testShow($range) { $this->be($this->user()); $this->changeDateRange($this->user(), $range); $this->call('GET', '/transaction/show/1'); $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::store * @covers FireflyIII\Http\Requests\JournalFormRequest::authorize * @covers FireflyIII\Http\Requests\JournalFormRequest::rules * @covers FireflyIII\Http\Requests\JournalFormRequest::getJournalData */ public function testStore() { $this->session(['transactions.create.url' => 'http://localhost']); $args = [ 'what' => 'withdrawal', 'description' => 'Something', 'account_id' => '1', 'expense_account' => 'Some expense', 'amount' => 100, 'amount_currency_id_amount' => 1, 'date' => '2015-01-01', ]; $this->be($this->user()); $this->call('POST', '/transactions/store/withdrawal', $args); $this->assertResponseStatus(302); $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\TransactionController::update * @covers FireflyIII\Http\Requests\JournalFormRequest::authorize * @covers FireflyIII\Http\Requests\JournalFormRequest::rules * @covers FireflyIII\Http\Requests\JournalFormRequest::getJournalData */ public function testUpdate() { $this->session(['transactions.edit.url' => 'http://localhost']); $args = [ 'what' => 'withdrawal', 'id' => 2, 'description' => 'Something new', 'account_id' => '1', 'expense_account' => 'Some expense', 'amount' => 100, 'amount_currency_id_amount' => 1, 'date' => '2015-01-01', ]; $this->be($this->user()); $this->call('POST', '/transaction/update/1', $args); $this->assertResponseStatus(302); $this->assertSessionHas('success'); } }