diff --git a/routes/web.php b/routes/web.php
index e96979ecfe..f6dbed2f93 100755
--- a/routes/web.php
+++ b/routes/web.php
@@ -228,9 +228,11 @@ Route::group(
Route::get('expense', ['uses' => 'AccountController@expenseAccounts', 'as' => 'expense']);
Route::get('revenue', ['uses' => 'AccountController@revenueAccounts', 'as' => 'revenue']);
Route::get('report/{accountList}/{start_date}/{end_date}', ['uses' => 'AccountController@report', 'as' => 'report']);
+ Route::get('all/{account}', ['uses' => 'AccountController@period', 'as' => 'all']); // TODO
Route::get('single/{account}', ['uses' => 'AccountController@single', 'as' => 'single']);
Route::get('period/{account}/{date}', ['uses' => 'AccountController@period', 'as' => 'period']);
+
Route::get('income-category/{account}/{start_date}/{end_date}', ['uses' => 'AccountController@incomeCategory', 'as' => 'income-category']);
Route::get('expense-category/{account}/{start_date}/{end_date}', ['uses' => 'AccountController@expenseCategory', 'as' => 'expense-category']);
Route::get('expense-budget/{account}/{start_date}/{end_date}', ['uses' => 'AccountController@expenseBudget', 'as' => 'expense-budget']);
@@ -307,8 +309,8 @@ Route::group(
* Chart\PiggyBank Controller
*/
Route::group(
- ['middleware' => 'user-full-auth', 'namespace' => 'Chart', 'prefix' => 'chart/piggy-bank','as'=> 'chart.piggy-bank.'], function () {
- Route::get('{piggyBank}', ['uses' => 'PiggyBankController@history','as' => 'history']);
+ ['middleware' => 'user-full-auth', 'namespace' => 'Chart', 'prefix' => 'chart/piggy-bank', 'as' => 'chart.piggy-bank.'], function () {
+ Route::get('{piggyBank}', ['uses' => 'PiggyBankController@history', 'as' => 'history']);
}
);
@@ -593,9 +595,11 @@ Route::group(
*/
Route::group(
['middleware' => 'user-full-auth', 'prefix' => 'transactions', 'as' => 'transactions.'], function () {
- Route::get('{what}', ['uses' => 'TransactionController@index', 'as' => 'index'])->where(['what' => 'withdrawal|deposit|transfers']);
- Route::get('{what}/all', ['uses' => 'TransactionController@indexAll', 'as' => 'index.all'])->where(['what' => 'withdrawal|deposit|transfers']);
- Route::get('{what}/{date}', ['uses' => 'TransactionController@indexByDate', 'as' => 'index.date'])->where(['what' => 'withdrawal|deposit|transfers']);
+ Route::get('{what}', ['uses' => 'TransactionController@index', 'as' => 'index'])->where(['what' => 'withdrawal|deposit|transfers|transfer']);
+ Route::get('{what}/all', ['uses' => 'TransactionController@indexAll', 'as' => 'index.all'])->where(['what' => 'withdrawal|deposit|transfers|transfer']);
+ Route::get('{what}/{date}', ['uses' => 'TransactionController@indexByDate', 'as' => 'index.date'])->where(
+ ['what' => 'withdrawal|deposit|transfers|transfer']
+ );
Route::get('show/{tj}', ['uses' => 'TransactionController@show', 'as' => 'show']);
Route::post('reorder', ['uses' => 'TransactionController@reorder', 'as' => 'reorder']);
}
diff --git a/tests/acceptance/Controllers/Transaction/MassControllerTest.php b/tests/acceptance/Controllers/Transaction/MassControllerTest.php
index 4e51159a00..f5278bd6da 100644
--- a/tests/acceptance/Controllers/Transaction/MassControllerTest.php
+++ b/tests/acceptance/Controllers/Transaction/MassControllerTest.php
@@ -30,58 +30,81 @@ class MassControllerTest extends TestCase
}
/**
- * @covers \FireflyIII\Http\Controllers\Transaction\MassController::massDelete
- * Implement testMassDelete().
+ * @covers \FireflyIII\Http\Controllers\Transaction\MassController::delete
*/
- public function testMassDelete()
+ 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('transactions.mass.delete', [561, 562]));
+ $this->assertResponseStatus(200);
+ $this->see('Delete a number of transactions');
+ // has bread crumb
+ $this->see('
');
}
/**
- * @covers \FireflyIII\Http\Controllers\Transaction\MassController::massDestroy
- * Implement testMassDestroy().
+ * @covers \FireflyIII\Http\Controllers\Transaction\MassController::destroy
*/
- public function testMassDestroy()
+ public function testDestroy()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->session(['transactions.mass-delete.url' => 'http://localhost']);
+
+ $data = [
+ 'confirm_mass_delete' => [56, 37],
+ ];
+ $this->be($this->user());
+ $this->call('post', route('transactions.mass.destroy'), $data);
+ $this->assertSessionHas('success');
+ $this->assertResponseStatus(302);
+
+ // visit them should give 404.
+ $this->call('get', route('transactions.show', [56]));
+ $this->assertResponseStatus(404);
+
+
}
/**
- * @covers \FireflyIII\Http\Controllers\Transaction\MassController::massEdit
- * Implement testMassEdit().
+ * @covers \FireflyIII\Http\Controllers\Transaction\MassController::edit
*/
- public function testMassEdit()
+ 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('transactions.mass.delete', [132, 113]));
+ $this->assertResponseStatus(200);
+ $this->see('Edit a number of transactions');
+ // has bread crumb
+ $this->see('');
}
/**
- * @covers \FireflyIII\Http\Controllers\Transaction\MassController::massUpdate
- * Implement testMassUpdate().
+ * @covers \FireflyIII\Http\Controllers\Transaction\MassController::update
*/
- public function testMassUpdate()
+ public function testUpdate()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+
+ $this->session(['transactions.mass-edit.url' => 'http://localhost']);
+
+ $data = [
+ 'journals' => [132],
+ 'description' => [132 => 'Updated salary thing'],
+ 'amount' => [132 => 1600],
+ 'amount_currency_id_amount_132' => 1,
+ 'date' => [132 => '2014-07-24'],
+ 'source_account_name' => [132 => 'Job'],
+ 'destination_account_id' => [132 => 1],
+ 'category' => [132 => 'Salary'],
+ ];
+
+ $this->be($this->user());
+ $this->call('post', route('transactions.mass.update', [132]), $data);
+ $this->assertSessionHas('success');
+ $this->assertResponseStatus(302);
+
+ // visit them should show updated content
+ $this->call('get', route('transactions.show', [132]));
+ $this->assertResponseStatus(200);
+ $this->see('Updated salary thing');
}
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
- }
}
diff --git a/tests/acceptance/Controllers/Transaction/SingleControllerTest.php b/tests/acceptance/Controllers/Transaction/SingleControllerTest.php
index b653368754..172aa7d0d4 100644
--- a/tests/acceptance/Controllers/Transaction/SingleControllerTest.php
+++ b/tests/acceptance/Controllers/Transaction/SingleControllerTest.php
@@ -11,6 +11,8 @@
namespace Transaction;
+use FireflyIII\Models\TransactionJournal;
+use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use TestCase;
/**
@@ -31,81 +33,110 @@ class SingleControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::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('transactions.create', ['withdrawal']));
+ $this->assertResponseStatus(200);
+ // has bread crumb
+ $this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::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('transactions.delete', [12]));
+ $this->assertResponseStatus(200);
+ // has bread crumb
+ $this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::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(['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
- * 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('transactions.edit', [13]));
+ $this->assertResponseStatus(200);
+ // has bread crumb
+ $this->see('');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::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(['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
- * 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(['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('');
+
}
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- */
- protected function tearDown()
- {
- }
}