be($this->user());
$this->call('get', route('transactions.create', ['withdrawal']));
$this->assertResponseStatus(200);
// has bread crumb
$this->see('
');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::delete
*/
public function testDelete()
{
$this->be($this->user());
$this->call('get', route('transactions.delete', [12]));
$this->assertResponseStatus(200);
// has bread crumb
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::destroy
*/
public function testDestroy()
{
$this->session(['transactions.delete.url' => 'http://localhost']);
$this->be($this->user());
$repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('delete')->once();
$this->call('post', route('transactions.destroy', [13]));
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
*/
public function testEdit()
{
$this->be($this->user());
$this->call('get', route('transactions.edit', [13]));
$this->assertResponseStatus(200);
// has bread crumb
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
*/
public function testStore()
{
$this->session(['transactions.create.url' => 'http://localhost']);
$this->be($this->user());
$data = [
'what' => 'withdrawal',
'amount' => 10,
'amount_currency_id_amount' => 1,
'source_account_id' => 1,
'destination_account_name' => 'Some destination',
'date' => '2016-01-01',
'description' => 'Some description',
];
$this->call('post', route('transactions.store', ['withdrawal']), $data);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::update
*/
public function testUpdate()
{
$this->session(['transactions.edit.url' => 'http://localhost']);
$this->be($this->user());
$data = [
'id' => 123,
'what' => 'withdrawal',
'description' => 'Updated groceries',
'source_account_id' => 1,
'destination_account_name' => 'PLUS',
'amount' => 123,
'amount_currency_id_amount' => 1,
'budget_id' => 1,
'category' => 'Daily groceries',
'tags' => '',
'date' => '2016-01-01',
];
$this->call('post', route('transactions.update', [123]), $data);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
$this->call('get', route('transactions.show', [123]));
$this->assertResponseStatus(200);
$this->see('Updated groceries');
// has bread crumb
$this->see('');
}
}