mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-03 20:56:21 +00:00
More tests
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
*
|
||||
* 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
|
||||
* Implement testCreate().
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::delete
|
||||
* Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::destroy
|
||||
* Implement testDestroy().
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$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
|
||||
* Implement testEdit().
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::index
|
||||
* Implement testIndex().
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::rescan
|
||||
* Implement testRescan().
|
||||
*/
|
||||
public function testRescan()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$repository->shouldReceive('getPossiblyRelatedJournals')->once()->andReturn(new Collection);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.rescan', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::show
|
||||
* Implement testShow().
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::store
|
||||
* Implement testStore().
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = [
|
||||
'name' => 'New Bill ' . rand(1000, 9999),
|
||||
'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
|
||||
* Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = [
|
||||
'name' => 'Updated Bill ' . rand(1000, 9999),
|
||||
'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.
|
||||
*/
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
@@ -28,165 +29,193 @@ class BudgetControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::amount
|
||||
* Implement testAmount().
|
||||
*/
|
||||
public function testAmount()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = [
|
||||
'amount' => 200,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('budgets.amount', [1], $data));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::create
|
||||
* Implement testCreate().
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('budgets.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::delete
|
||||
* Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('budgets.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::destroy
|
||||
* Implement testDestroy().
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['budgets.delete.url' => 'http://localhost']);
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$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
|
||||
* Implement testEdit().
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('budgets.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
||||
* Implement testIndex().
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
||||
* @dataProvider dateRangeProvider
|
||||
*/
|
||||
public function testIndex()
|
||||
public function testIndex(string $range)
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('budgets.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::noBudget
|
||||
* Implement testNoBudget().
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::noBudget
|
||||
* @dataProvider dateRangeProvider
|
||||
*/
|
||||
public function testNoBudget()
|
||||
public function testNoBudget(string $range)
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('budgets.no-budget'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::postUpdateIncome
|
||||
* Implement testPostUpdateIncome().
|
||||
*/
|
||||
public function testPostUpdateIncome()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = [
|
||||
'amount' => 200,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('budgets.income.post', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::show
|
||||
* Implement testShow().
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::show
|
||||
* @dataProvider dateRangeProvider
|
||||
*/
|
||||
public function testShow()
|
||||
public function testShow(string $range)
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('budgets.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::showByRepetition
|
||||
* Implement testShowByRepetition().
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::showByRepetition
|
||||
* @dataProvider dateRangeProvider
|
||||
*/
|
||||
public function testShowByRepetition()
|
||||
public function testShowByRepetition(string $range)
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$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
|
||||
* Implement testStore().
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['budgets.create.url' => 'http://localhost']);
|
||||
|
||||
$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
|
||||
* Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['budgets.edit.url' => 'http://localhost']);
|
||||
|
||||
$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
|
||||
* Implement testUpdateIncome().
|
||||
*/
|
||||
public function testUpdateIncome()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
// must be in list
|
||||
$this->be($this->user());
|
||||
$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.
|
||||
*/
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
@@ -28,129 +29,152 @@ class CategoryControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::create
|
||||
* Implement testCreate().
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::delete
|
||||
* Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::destroy
|
||||
* Implement testDestroy().
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['categories.delete.url' => 'http://localhost']);
|
||||
$repository = $this->mock(CategoryRepositoryInterface::class);
|
||||
$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
|
||||
* Implement testEdit().
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::index
|
||||
* Implement testIndex().
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::noCategory
|
||||
* Implement testNoCategory().
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::noCategory
|
||||
* @dataProvider dateRangeProvider
|
||||
*/
|
||||
public function testNoCategory()
|
||||
public function testNoCategory(string $range)
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.no-category'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::show
|
||||
* Implement testShow().
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::show
|
||||
* @dataProvider dateRangeProvider
|
||||
*/
|
||||
public function testShow()
|
||||
public function testShow(string $range)
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::showByDate
|
||||
* Implement testShowByDate().
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::showByDate
|
||||
* @dataProvider dateRangeProvider
|
||||
*/
|
||||
public function testShowByDate()
|
||||
public function testShowByDate(string $range)
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.show', [1, '2015-01-01']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::store
|
||||
* Implement testStore().
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['categories.create.url' => 'http://localhost']);
|
||||
|
||||
$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
|
||||
* Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->session(['categories.edit.url' => 'http://localhost']);
|
||||
|
||||
$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()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user