mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
More tests
This commit is contained in:
parent
dc28ba42ef
commit
74e01a52b9
@ -304,7 +304,7 @@ class BudgetController extends Controller
|
|||||||
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
|
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
|
||||||
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||||
$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET, AccountType::CASH]);
|
$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET, AccountType::CASH]);
|
||||||
|
$repetition = null;
|
||||||
// collector:
|
// collector:
|
||||||
$collector = new JournalCollector(auth()->user());
|
$collector = new JournalCollector(auth()->user());
|
||||||
$collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page);
|
$collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page);
|
||||||
|
@ -255,22 +255,27 @@ Breadcrumbs::register(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Breadcrumbs::register(
|
Breadcrumbs::register(
|
||||||
'budgets.noBudget', function (BreadCrumbGenerator $breadcrumbs, $subTitle) {
|
'budgets.no-budget', function (BreadCrumbGenerator $breadcrumbs, $subTitle) {
|
||||||
$breadcrumbs->parent('budgets.index');
|
$breadcrumbs->parent('budgets.index');
|
||||||
$breadcrumbs->push($subTitle, route('budgets.noBudget'));
|
$breadcrumbs->push($subTitle, route('budgets.no-budget'));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Breadcrumbs::register(
|
Breadcrumbs::register(
|
||||||
'budgets.show', function (BreadCrumbGenerator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) {
|
'budgets.show', function (BreadCrumbGenerator $breadcrumbs, Budget $budget) {
|
||||||
$breadcrumbs->parent('budgets.index');
|
$breadcrumbs->parent('budgets.index');
|
||||||
$breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id]));
|
$breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id]));
|
||||||
if (!is_null($repetition) && !is_null($repetition->id)) {
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Breadcrumbs::register(
|
||||||
|
'budgets.show.repetition', function (BreadCrumbGenerator $breadcrumbs, Budget $budget, LimitRepetition $repetition) {
|
||||||
|
$breadcrumbs->parent('budgets.index');
|
||||||
|
$breadcrumbs->push(e($budget->name), route('budgets.show.repetition', [$budget->id, $repetition->id]));
|
||||||
$breadcrumbs->push(
|
$breadcrumbs->push(
|
||||||
Navigation::periodShow($repetition->startdate, $repetition->budgetLimit->repeat_freq), route('budgets.show', [$budget->id, $repetition->id])
|
Navigation::periodShow($repetition->startdate, $repetition->budgetLimit->repeat_freq), route('budgets.show', [$budget->id, $repetition->id])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -324,9 +329,9 @@ Breadcrumbs::register(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Breadcrumbs::register(
|
Breadcrumbs::register(
|
||||||
'categories.noCategory', function (BreadCrumbGenerator $breadcrumbs, $subTitle) {
|
'categories.no-category', function (BreadCrumbGenerator $breadcrumbs, $subTitle) {
|
||||||
$breadcrumbs->parent('categories.index');
|
$breadcrumbs->parent('categories.index');
|
||||||
$breadcrumbs->push($subTitle, route('categories.noCategory'));
|
$breadcrumbs->push($subTitle, route('categories.no-category'));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ Route::group(
|
|||||||
Route::post('store', ['uses' => 'BudgetController@store', 'as' => 'store']);
|
Route::post('store', ['uses' => 'BudgetController@store', 'as' => 'store']);
|
||||||
Route::post('update/{budget}', ['uses' => 'BudgetController@update', 'as' => 'update']);
|
Route::post('update/{budget}', ['uses' => 'BudgetController@update', 'as' => 'update']);
|
||||||
Route::post('destroy/{budget}', ['uses' => 'BudgetController@destroy', 'as' => 'destroy']);
|
Route::post('destroy/{budget}', ['uses' => 'BudgetController@destroy', 'as' => 'destroy']);
|
||||||
Route::post('amount/{budget}', ['uses' => 'BudgetController@amount']);
|
Route::post('amount/{budget}', ['uses' => 'BudgetController@amount', 'as' => 'amount']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
*
|
*
|
||||||
* See the LICENSE file for details.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,117 +30,150 @@ class BillControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::create
|
* @covers \FireflyIII\Http\Controllers\BillController::create
|
||||||
* Implement testCreate().
|
|
||||||
*/
|
*/
|
||||||
public function testCreate()
|
public function testCreate()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('bills.create'));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::delete
|
* @covers \FireflyIII\Http\Controllers\BillController::delete
|
||||||
* Implement testDelete().
|
|
||||||
*/
|
*/
|
||||||
public function testDelete()
|
public function testDelete()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('bills.delete', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::destroy
|
* @covers \FireflyIII\Http\Controllers\BillController::destroy
|
||||||
* Implement testDestroy().
|
|
||||||
*/
|
*/
|
||||||
public function testDestroy()
|
public function testDestroy()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$repository = $this->mock(BillRepositoryInterface::class);
|
||||||
$this->markTestIncomplete(
|
$repository->shouldReceive('destroy')->andReturn(true);
|
||||||
'This test has not been implemented yet.'
|
|
||||||
);
|
$this->session(['bills.delete.url' => 'http://localhost']);
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('bills.destroy', [1]));
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::edit
|
* @covers \FireflyIII\Http\Controllers\BillController::edit
|
||||||
* Implement testEdit().
|
|
||||||
*/
|
*/
|
||||||
public function testEdit()
|
public function testEdit()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('bills.edit', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::index
|
* @covers \FireflyIII\Http\Controllers\BillController::index
|
||||||
* Implement testIndex().
|
|
||||||
*/
|
*/
|
||||||
public function testIndex()
|
public function testIndex()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('bills.index'));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::rescan
|
* @covers \FireflyIII\Http\Controllers\BillController::rescan
|
||||||
* Implement testRescan().
|
|
||||||
*/
|
*/
|
||||||
public function testRescan()
|
public function testRescan()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$repository = $this->mock(BillRepositoryInterface::class);
|
||||||
$this->markTestIncomplete(
|
$repository->shouldReceive('getPossiblyRelatedJournals')->once()->andReturn(new Collection);
|
||||||
'This test has not been implemented yet.'
|
$this->be($this->user());
|
||||||
);
|
$this->call('GET', route('bills.rescan', [1]));
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::show
|
* @covers \FireflyIII\Http\Controllers\BillController::show
|
||||||
* Implement testShow().
|
|
||||||
*/
|
*/
|
||||||
public function testShow()
|
public function testShow()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('bills.show', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::store
|
* @covers \FireflyIII\Http\Controllers\BillController::store
|
||||||
* Implement testStore().
|
|
||||||
*/
|
*/
|
||||||
public function testStore()
|
public function testStore()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$data = [
|
||||||
$this->markTestIncomplete(
|
'name' => 'New Bill ' . rand(1000, 9999),
|
||||||
'This test has not been implemented yet.'
|
'match' => 'some words',
|
||||||
);
|
'amount_min' => 100,
|
||||||
|
'amount_currency_id_amount_min' => 1,
|
||||||
|
'amount_currency_id_amount_max' => 1,
|
||||||
|
'skip' => 0,
|
||||||
|
'amount_max' => 100,
|
||||||
|
'date' => '2016-01-01',
|
||||||
|
'repeat_freq' => 'monthly',
|
||||||
|
];
|
||||||
|
$this->session(['bills.create.url' => 'http://localhost']);
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('bills.store'), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
|
||||||
|
// list must be updated
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('bills.index'));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
|
$this->see($data['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BillController::update
|
* @covers \FireflyIII\Http\Controllers\BillController::update
|
||||||
* Implement testUpdate().
|
|
||||||
*/
|
*/
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$data = [
|
||||||
$this->markTestIncomplete(
|
'name' => 'Updated Bill ' . rand(1000, 9999),
|
||||||
'This test has not been implemented yet.'
|
'match' => 'some more words',
|
||||||
);
|
'amount_min' => 100,
|
||||||
|
'amount_currency_id_amount_min' => 1,
|
||||||
|
'amount_currency_id_amount_max' => 1,
|
||||||
|
'skip' => 0,
|
||||||
|
'amount_max' => 100,
|
||||||
|
'date' => '2016-01-01',
|
||||||
|
'repeat_freq' => 'monthly',
|
||||||
|
];
|
||||||
|
$this->session(['bills.edit.url' => 'http://localhost']);
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('bills.update', [1]), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
|
||||||
|
// list must be updated
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('bills.index'));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
|
$this->see($data['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tears down the fixture, for example, closes a network connection.
|
|
||||||
* This method is called after a test is executed.
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
*
|
*
|
||||||
* See the LICENSE file for details.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,165 +29,193 @@ class BudgetControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::amount
|
* @covers \FireflyIII\Http\Controllers\BudgetController::amount
|
||||||
* Implement testAmount().
|
|
||||||
*/
|
*/
|
||||||
public function testAmount()
|
public function testAmount()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$data = [
|
||||||
$this->markTestIncomplete(
|
'amount' => 200,
|
||||||
'This test has not been implemented yet.'
|
];
|
||||||
);
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('budgets.amount', [1], $data));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::create
|
* @covers \FireflyIII\Http\Controllers\BudgetController::create
|
||||||
* Implement testCreate().
|
|
||||||
*/
|
*/
|
||||||
public function testCreate()
|
public function testCreate()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('budgets.create'));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::delete
|
* @covers \FireflyIII\Http\Controllers\BudgetController::delete
|
||||||
* Implement testDelete().
|
|
||||||
*/
|
*/
|
||||||
public function testDelete()
|
public function testDelete()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('budgets.delete', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::destroy
|
* @covers \FireflyIII\Http\Controllers\BudgetController::destroy
|
||||||
* Implement testDestroy().
|
|
||||||
*/
|
*/
|
||||||
public function testDestroy()
|
public function testDestroy()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['budgets.delete.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||||
'This test has not been implemented yet.'
|
$repository->shouldReceive('destroy')->andReturn(true);
|
||||||
);
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('budgets.destroy', [1]));
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::edit
|
* @covers \FireflyIII\Http\Controllers\BudgetController::edit
|
||||||
* Implement testEdit().
|
|
||||||
*/
|
*/
|
||||||
public function testEdit()
|
public function testEdit()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('budgets.edit', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
||||||
* Implement testIndex().
|
* @dataProvider dateRangeProvider
|
||||||
*/
|
*/
|
||||||
public function testIndex()
|
public function testIndex(string $range)
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->changeDateRange($this->user(), $range);
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('budgets.index'));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::noBudget
|
* @covers \FireflyIII\Http\Controllers\BudgetController::noBudget
|
||||||
* Implement testNoBudget().
|
* @dataProvider dateRangeProvider
|
||||||
*/
|
*/
|
||||||
public function testNoBudget()
|
public function testNoBudget(string $range)
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->changeDateRange($this->user(), $range);
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('budgets.no-budget'));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::postUpdateIncome
|
* @covers \FireflyIII\Http\Controllers\BudgetController::postUpdateIncome
|
||||||
* Implement testPostUpdateIncome().
|
|
||||||
*/
|
*/
|
||||||
public function testPostUpdateIncome()
|
public function testPostUpdateIncome()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$data = [
|
||||||
$this->markTestIncomplete(
|
'amount' => 200,
|
||||||
'This test has not been implemented yet.'
|
];
|
||||||
);
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('budgets.income.post', [1]), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::show
|
* @covers \FireflyIII\Http\Controllers\BudgetController::show
|
||||||
* Implement testShow().
|
* @dataProvider dateRangeProvider
|
||||||
*/
|
*/
|
||||||
public function testShow()
|
public function testShow(string $range)
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->changeDateRange($this->user(), $range);
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('budgets.show', [1]));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::showByRepetition
|
* @covers \FireflyIII\Http\Controllers\BudgetController::showByRepetition
|
||||||
* Implement testShowByRepetition().
|
* @dataProvider dateRangeProvider
|
||||||
*/
|
*/
|
||||||
public function testShowByRepetition()
|
public function testShowByRepetition(string $range)
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->changeDateRange($this->user(), $range);
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('budgets.show.repetition', [1, 1]));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::store
|
* @covers \FireflyIII\Http\Controllers\BudgetController::store
|
||||||
* Implement testStore().
|
|
||||||
*/
|
*/
|
||||||
public function testStore()
|
public function testStore()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['budgets.create.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
|
||||||
'This test has not been implemented yet.'
|
$data = [
|
||||||
);
|
'name' => 'New Budget ' . rand(1000, 9999),
|
||||||
|
];
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('budgets.store'), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
|
||||||
|
// must be in list
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('budgets.index'));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
|
$this->see($data['name']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::update
|
* @covers \FireflyIII\Http\Controllers\BudgetController::update
|
||||||
* Implement testUpdate().
|
|
||||||
*/
|
*/
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['budgets.edit.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
|
||||||
'This test has not been implemented yet.'
|
$data = [
|
||||||
);
|
'name' => 'Updated Budget ' . rand(1000, 9999),
|
||||||
|
'active' => 1,
|
||||||
|
];
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('budgets.update', [1]), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
|
||||||
|
// must be in list
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('budgets.index'));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
|
$this->see($data['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\BudgetController::updateIncome
|
* @covers \FireflyIII\Http\Controllers\BudgetController::updateIncome
|
||||||
* Implement testUpdateIncome().
|
|
||||||
*/
|
*/
|
||||||
public function testUpdateIncome()
|
public function testUpdateIncome()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
// must be in list
|
||||||
$this->markTestIncomplete(
|
$this->be($this->user());
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('budgets.income', [1]));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tears down the fixture, for example, closes a network connection.
|
|
||||||
* This method is called after a test is executed.
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
*
|
*
|
||||||
* See the LICENSE file for details.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,129 +29,152 @@ class CategoryControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::create
|
* @covers \FireflyIII\Http\Controllers\CategoryController::create
|
||||||
* Implement testCreate().
|
|
||||||
*/
|
*/
|
||||||
public function testCreate()
|
public function testCreate()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('categories.create'));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::delete
|
* @covers \FireflyIII\Http\Controllers\CategoryController::delete
|
||||||
* Implement testDelete().
|
|
||||||
*/
|
*/
|
||||||
public function testDelete()
|
public function testDelete()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('categories.delete', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::destroy
|
* @covers \FireflyIII\Http\Controllers\CategoryController::destroy
|
||||||
* Implement testDestroy().
|
|
||||||
*/
|
*/
|
||||||
public function testDestroy()
|
public function testDestroy()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['categories.delete.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
$repository = $this->mock(CategoryRepositoryInterface::class);
|
||||||
'This test has not been implemented yet.'
|
$repository->shouldReceive('destroy')->andReturn(true);
|
||||||
);
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('categories.destroy', [1]));
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::edit
|
* @covers \FireflyIII\Http\Controllers\CategoryController::edit
|
||||||
* Implement testEdit().
|
|
||||||
*/
|
*/
|
||||||
public function testEdit()
|
public function testEdit()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('categories.edit', [1]));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::index
|
* @covers \FireflyIII\Http\Controllers\CategoryController::index
|
||||||
* Implement testIndex().
|
|
||||||
*/
|
*/
|
||||||
public function testIndex()
|
public function testIndex()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->call('GET', route('categories.index'));
|
||||||
'This test has not been implemented yet.'
|
$this->assertResponseStatus(200);
|
||||||
);
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::noCategory
|
* @covers \FireflyIII\Http\Controllers\CategoryController::noCategory
|
||||||
* Implement testNoCategory().
|
* @dataProvider dateRangeProvider
|
||||||
*/
|
*/
|
||||||
public function testNoCategory()
|
public function testNoCategory(string $range)
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->changeDateRange($this->user(), $range);
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('categories.no-category'));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
|
// has bread crumb
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::show
|
* @covers \FireflyIII\Http\Controllers\CategoryController::show
|
||||||
* Implement testShow().
|
* @dataProvider dateRangeProvider
|
||||||
*/
|
*/
|
||||||
public function testShow()
|
public function testShow(string $range)
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->changeDateRange($this->user(), $range);
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('categories.show', [1]));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::showByDate
|
* @covers \FireflyIII\Http\Controllers\CategoryController::showByDate
|
||||||
* Implement testShowByDate().
|
* @dataProvider dateRangeProvider
|
||||||
*/
|
*/
|
||||||
public function testShowByDate()
|
public function testShowByDate(string $range)
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->be($this->user());
|
||||||
$this->markTestIncomplete(
|
$this->changeDateRange($this->user(), $range);
|
||||||
'This test has not been implemented yet.'
|
$this->call('GET', route('categories.show', [1, '2015-01-01']));
|
||||||
);
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::store
|
* @covers \FireflyIII\Http\Controllers\CategoryController::store
|
||||||
* Implement testStore().
|
|
||||||
*/
|
*/
|
||||||
public function testStore()
|
public function testStore()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['categories.create.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
|
||||||
'This test has not been implemented yet.'
|
$data = [
|
||||||
);
|
'name' => 'New Category ' . rand(1000, 9999),
|
||||||
|
];
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('categories.store'), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
|
||||||
|
// must be in list
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('categories.index'));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
|
$this->see($data['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\CategoryController::update
|
* @covers \FireflyIII\Http\Controllers\CategoryController::update
|
||||||
* Implement testUpdate().
|
|
||||||
*/
|
*/
|
||||||
public function testUpdate()
|
public function testUpdate()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
$this->session(['categories.edit.url' => 'http://localhost']);
|
||||||
$this->markTestIncomplete(
|
|
||||||
'This test has not been implemented yet.'
|
$data = [
|
||||||
);
|
'name' => 'Updated Category ' . rand(1000, 9999),
|
||||||
|
'active' => 1,
|
||||||
|
];
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('post', route('categories.update', [1]), $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
|
||||||
|
// must be in list
|
||||||
|
$this->be($this->user());
|
||||||
|
$this->call('GET', route('categories.index'));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
$this->see('<ol class="breadcrumb">');
|
||||||
|
$this->see($data['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tears down the fixture, for example, closes a network connection.
|
|
||||||
* This method is called after a test is executed.
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user