be($this->user());
$this->call('get', route('piggy-banks.add', [1]));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::addMobile
*/
public function testAddMobile()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.add-money-mobile', [1]));
$this->assertResponseStatus(200);
$this->see('
');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::create
*/
public function testCreate()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.create'));
$this->assertResponseStatus(200);
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::delete
*/
public function testDelete()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.delete', [1]));
$this->assertResponseStatus(200);
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::destroy
*/
public function testDestroy()
{
$repository = $this->mock(PiggyBankRepositoryInterface::class);
$repository->shouldReceive('destroy')->andReturn(true);
$this->session(['piggy-banks.delete.url' => 'http://localhost']);
$this->be($this->user());
$this->call('post', route('piggy-banks.destroy', [2]));
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
$this->assertRedirectedToRoute('index');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::edit
*/
public function testEdit()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.edit', [1]));
$this->assertResponseStatus(200);
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::index
*/
public function testIndex()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.index'));
$this->assertResponseStatus(200);
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::order
*/
public function testOrder()
{
$this->be($this->user());
$this->call('post', route('piggy-banks.order', [1, 2]));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::postAdd
*/
public function testPostAdd()
{
$data = ['amount' => 1];
$this->be($this->user());
$this->call('post', route('piggy-banks.add', [1]), $data);
$this->assertResponseStatus(302);
$this->assertRedirectedToRoute('piggy-banks.index');
$this->assertSessionHas('success');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::postRemove
*/
public function testPostRemove()
{
$data = ['amount' => 1];
$this->be($this->user());
$this->call('post', route('piggy-banks.remove', [1]), $data);
$this->assertResponseStatus(302);
$this->assertRedirectedToRoute('piggy-banks.index');
$this->assertSessionHas('success');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::remove
*/
public function testRemove()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.remove', [1]));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::removeMobile
*/
public function testRemoveMobile()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.remove-money-mobile', [1]));
$this->assertResponseStatus(200);
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::show
*/
public function testShow()
{
$this->be($this->user());
$this->call('get', route('piggy-banks.show', [1]));
$this->assertResponseStatus(200);
$this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::store
*/
public function testStore()
{
$this->session(['piggy-banks.create.url' => 'http://localhost']);
$data = [
'name' => 'Piggy ' . rand(999, 10000),
'targetamount' => 100,
'account_id' => 2,
'amount_currency_id_targetamount' => 1,
];
$this->be($this->user());
$this->call('post', route('piggy-banks.store'), $data);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
$this->assertRedirectedToRoute('index');
}
/**
* @covers \FireflyIII\Http\Controllers\PiggyBankController::update
*/
public function testUpdate()
{
$this->session(['piggy-banks.edit.url' => 'http://localhost']);
$data = [
'name' => 'Updated Piggy ' . rand(999, 10000),
'targetamount' => 100,
'account_id' => 2,
'amount_currency_id_targetamount' => 1,
];
$this->be($this->user());
$this->call('post', route('piggy-banks.update', [3]), $data);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
$this->assertRedirectedToRoute('index');
}
}