diff --git a/tests/TestCase.php b/tests/TestCase.php index 9ed7149f88..d3bb04192a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -36,6 +36,14 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase return User::find(2); } + /** + * @return User + */ + public function toBeDeletedUser() + { + return User::find(3); + } + /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. diff --git a/tests/acceptance/Controllers/AccountControllerTest.php b/tests/acceptance/Controllers/AccountControllerTest.php index e38518d2f2..bd24e88edf 100644 --- a/tests/acceptance/Controllers/AccountControllerTest.php +++ b/tests/acceptance/Controllers/AccountControllerTest.php @@ -14,6 +14,7 @@ class AccountControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\AccountController::create + * @covers FireflyIII\Http\Controllers\AccountController::__construct */ public function testCreate() { @@ -77,6 +78,9 @@ class AccountControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\AccountController::store + * @covers FireflyIII\Http\Requests\AccountFormRequest::authorize + * @covers FireflyIII\Http\Requests\AccountFormRequest::rules + * */ public function testStore() { @@ -97,6 +101,8 @@ class AccountControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\AccountController::update + * @covers FireflyIII\Http\Requests\AccountFormRequest::authorize + * @covers FireflyIII\Http\Requests\AccountFormRequest::rules */ public function testUpdate() { diff --git a/tests/acceptance/Controllers/AttachmentControllerTest.php b/tests/acceptance/Controllers/AttachmentControllerTest.php index 6ad10b9bb2..7907eae095 100644 --- a/tests/acceptance/Controllers/AttachmentControllerTest.php +++ b/tests/acceptance/Controllers/AttachmentControllerTest.php @@ -15,6 +15,7 @@ class AttachmentControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\AttachmentController::delete + * @covers FireflyIII\Http\Controllers\AttachmentController::__construct */ public function testDelete() { @@ -42,6 +43,8 @@ class AttachmentControllerTest extends TestCase $this->be($this->user()); $this->call('GET', '/attachment/download/1'); $this->assertResponseStatus(200); + // must have certain headers + } /** @@ -66,6 +69,8 @@ class AttachmentControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\AttachmentController::update + * @covers FireflyIII\Http\Requests\AttachmentFormRequest::authorize + * @covers FireflyIII\Http\Requests\AttachmentFormRequest::rules */ public function testUpdate() { diff --git a/tests/acceptance/Controllers/Auth/AuthControllerTest.php b/tests/acceptance/Controllers/Auth/AuthControllerTest.php index 0631aee89f..270c5de364 100644 --- a/tests/acceptance/Controllers/Auth/AuthControllerTest.php +++ b/tests/acceptance/Controllers/Auth/AuthControllerTest.php @@ -13,43 +13,6 @@ class AuthControllerTest extends TestCase { - /** - * @covers FireflyIII\Http\Controllers\Auth\AuthController::getLogin - */ - public function testGetLogin() - { - $this->call('GET', '/login'); - $this->assertResponseStatus(200); - } - - /** - * @covers FireflyIII\Http\Controllers\Auth\AuthController::getLogout - */ - public function testGetLogout() - { - $this->be($this->user()); - $this->call('GET', '/logout'); - $this->assertResponseStatus(302); - } - - /** - * @covers FireflyIII\Http\Controllers\Auth\AuthController::getRegister - */ - public function testGetRegister() - { - $this->call('GET', '/register'); - $this->assertResponseStatus(200); - } - - /** - * @covers FireflyIII\Http\Controllers\Auth\AuthController::login - */ - public function testLogin() - { - $this->call('GET', '/login'); - $this->assertResponseStatus(200); - } - /** * @covers FireflyIII\Http\Controllers\Auth\AuthController::logout */ @@ -62,14 +25,16 @@ class AuthControllerTest extends TestCase // index should now redirect: $this->call('GET', '/'); $this->assertResponseStatus(302); - - } /** - * @covers FireflyIII\Http\Controllers\Auth\AuthController::postLogin + * @covers FireflyIII\Http\Controllers\Auth\AuthController::login + * @covers FireflyIII\Http\Controllers\Auth\AuthController::__construct + * @covers FireflyIII\Http\Controllers\Auth\AuthController::sendFailedLoginResponse + * @covers FireflyIII\Http\Controllers\Auth\AuthController::getFailedLoginMessage + * */ - public function testPostLogin() + public function testLogin() { $args = [ 'email' => 'thegrumpydictator@gmail.com', @@ -86,9 +51,13 @@ class AuthControllerTest extends TestCase } /** - * @covers FireflyIII\Http\Controllers\Auth\AuthController::postRegister + * @covers FireflyIII\Http\Controllers\Auth\AuthController::register + * @covers FireflyIII\Http\Controllers\Auth\AuthController::create + * @covers FireflyIII\Http\Controllers\Auth\AuthController::isBlockedDomain + * @covers FireflyIII\Http\Controllers\Auth\AuthController::getBlockedDomains + * @covers FireflyIII\Http\Controllers\Auth\AuthController::validator */ - public function testPostRegister() + public function testRegister() { $args = [ 'email' => 'thegrumpydictator+test@gmail.com', @@ -101,9 +70,9 @@ class AuthControllerTest extends TestCase } /** - * @covers FireflyIII\Http\Controllers\Auth\AuthController::register + * @covers FireflyIII\Http\Controllers\Auth\AuthController::showRegistrationForm */ - public function testRegister() + public function testShowRegistrationForm() { $this->call('GET', '/register'); $this->assertResponseStatus(200); diff --git a/tests/acceptance/Controllers/BillControllerTest.php b/tests/acceptance/Controllers/BillControllerTest.php index 9917620b5b..d30195dfec 100644 --- a/tests/acceptance/Controllers/BillControllerTest.php +++ b/tests/acceptance/Controllers/BillControllerTest.php @@ -16,6 +16,7 @@ class BillControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\BillController::create + * @covers FireflyIII\Http\Controllers\BillController::__construct */ public function testCreate() { @@ -26,7 +27,6 @@ class BillControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\BillController::delete - * @todo Implement testDelete(). */ public function testDelete() { @@ -90,6 +90,9 @@ class BillControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\BillController::store + * @covers FireflyIII\Http\Requests\BillFormRequest::authorize + * @covers FireflyIII\Http\Requests\BillFormRequest::getBillData + * @covers FireflyIII\Http\Requests\BillFormRequest::rules */ public function testStore() { @@ -115,6 +118,9 @@ class BillControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\BillController::update + * @covers FireflyIII\Http\Requests\BillFormRequest::authorize + * @covers FireflyIII\Http\Requests\BillFormRequest::getBillData + * @covers FireflyIII\Http\Requests\BillFormRequest::rules */ public function testUpdate() { diff --git a/tests/acceptance/Controllers/BudgetControllerTest.php b/tests/acceptance/Controllers/BudgetControllerTest.php index 806805cb0f..defdab45ad 100644 --- a/tests/acceptance/Controllers/BudgetControllerTest.php +++ b/tests/acceptance/Controllers/BudgetControllerTest.php @@ -15,6 +15,7 @@ class BudgetControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\BudgetController::amount + * @covers FireflyIII\Http\Controllers\BudgetController::__construct */ public function testAmount() { @@ -116,13 +117,15 @@ class BudgetControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\BudgetController::store + * @covers FireflyIII\Http\Requests\BudgetFormRequest::authorize + * @covers FireflyIII\Http\Requests\BudgetFormRequest::rules */ public function testStore() { $this->be($this->user()); $this->session(['budgets.create.url' => 'http://localhost']); $args = [ - 'name' => 'Some kind of test budget.', + 'name' => 'Some kind of test budget.', ]; $this->call('POST', '/budgets/store', $args); @@ -132,13 +135,16 @@ class BudgetControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\BudgetController::update + * @covers FireflyIII\Http\Requests\BudgetFormRequest::authorize + * @covers FireflyIII\Http\Requests\BudgetFormRequest::rules */ public function testUpdate() { $this->be($this->user()); $this->session(['budgets.edit.url' => 'http://localhost']); $args = [ - 'name' => 'Some kind of test budget.', + 'name' => 'Some kind of test budget.', + 'id' => 1, ]; $this->call('POST', '/budgets/update/1', $args); diff --git a/tests/acceptance/Controllers/CategoryControllerTest.php b/tests/acceptance/Controllers/CategoryControllerTest.php index 2d2bb291e3..683772eb0b 100644 --- a/tests/acceptance/Controllers/CategoryControllerTest.php +++ b/tests/acceptance/Controllers/CategoryControllerTest.php @@ -16,6 +16,7 @@ class CategoryControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\CategoryController::create + * @covers FireflyIII\Http\Controllers\CategoryController::__construct */ public function testCreate() { @@ -102,13 +103,15 @@ class CategoryControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\CategoryController::store + * @covers FireflyIII\Http\Requests\CategoryFormRequest::authorize + * @covers FireflyIII\Http\Requests\CategoryFormRequest::rules */ public function testStore() { $this->be($this->user()); $this->session(['categories.create.url' => 'http://localhost']); $args = [ - 'name' => 'Some kind of test cat.', + 'name' => 'Some kind of test cat.', ]; $this->call('POST', '/categories/store', $args); @@ -118,13 +121,16 @@ class CategoryControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\CategoryController::update + * @covers FireflyIII\Http\Requests\CategoryFormRequest::authorize + * @covers FireflyIII\Http\Requests\CategoryFormRequest::rules */ public function testUpdate() { $this->be($this->user()); $this->session(['categories.edit.url' => 'http://localhost']); $args = [ - 'name' => 'Some kind of test category.', + 'name' => 'Some kind of test category.', + 'id' => 1, ]; $this->call('POST', '/categories/update/1', $args); diff --git a/tests/acceptance/Controllers/Chart/ChartAccountControllerTest.php b/tests/acceptance/Controllers/Chart/ChartAccountControllerTest.php index 4f02f165f8..6956629e10 100644 --- a/tests/acceptance/Controllers/Chart/ChartAccountControllerTest.php +++ b/tests/acceptance/Controllers/Chart/ChartAccountControllerTest.php @@ -14,6 +14,7 @@ class ChartAccountControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\Chart\AccountController::expenseAccounts + * @covers FireflyIII\Http\Controllers\Chart\AccountController::__construct */ public function testExpenseAccounts() { diff --git a/tests/acceptance/Controllers/Chart/ChartBillControllerTest.php b/tests/acceptance/Controllers/Chart/ChartBillControllerTest.php index 97fb4704eb..b361bd8834 100644 --- a/tests/acceptance/Controllers/Chart/ChartBillControllerTest.php +++ b/tests/acceptance/Controllers/Chart/ChartBillControllerTest.php @@ -15,6 +15,7 @@ class ChartBillControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\Chart\BillController::frontpage + * @covers FireflyIII\Http\Controllers\Chart\BillController::__construct */ public function testFrontpage() { diff --git a/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php b/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php index ab8cc339ee..ccdda57dd5 100644 --- a/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php +++ b/tests/acceptance/Controllers/Chart/ChartBudgetControllerTest.php @@ -18,6 +18,7 @@ class ChartBudgetControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\Chart\BudgetController::budget + * @covers FireflyIII\Http\Controllers\Chart\BudgetController::__construct */ public function testBudget() { diff --git a/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php b/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php index 0a6ccb44b0..7c8ebc3ebb 100644 --- a/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php +++ b/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php @@ -16,6 +16,7 @@ class ChartCategoryControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\Chart\CategoryController::all + * @covers FireflyIII\Http\Controllers\Chart\CategoryController::__construct */ public function testAll() { diff --git a/tests/acceptance/Controllers/Chart/ChartPiggyBankControllerTest.php b/tests/acceptance/Controllers/Chart/ChartPiggyBankControllerTest.php index ce3ae5beba..861f901ddb 100644 --- a/tests/acceptance/Controllers/Chart/ChartPiggyBankControllerTest.php +++ b/tests/acceptance/Controllers/Chart/ChartPiggyBankControllerTest.php @@ -15,6 +15,7 @@ class ChartPiggyBankControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\Chart\PiggyBankController::history + * @covers FireflyIII\Http\Controllers\Chart\PiggyBankController::__construct */ public function testHistory() { diff --git a/tests/acceptance/Controllers/Chart/ChartReportControllerTest.php b/tests/acceptance/Controllers/Chart/ChartReportControllerTest.php index 93fdba8cd1..6a36e48337 100644 --- a/tests/acceptance/Controllers/Chart/ChartReportControllerTest.php +++ b/tests/acceptance/Controllers/Chart/ChartReportControllerTest.php @@ -14,6 +14,7 @@ class ChartReportControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\Chart\ReportController::yearInOut + * @covers FireflyIII\Http\Controllers\Chart\ReportController::__construct */ public function testYearInOut() { diff --git a/tests/acceptance/Controllers/CsvControllerTest.php b/tests/acceptance/Controllers/CsvControllerTest.php index 9b46be9a58..ba7b6adf67 100644 --- a/tests/acceptance/Controllers/CsvControllerTest.php +++ b/tests/acceptance/Controllers/CsvControllerTest.php @@ -16,6 +16,7 @@ class CsvControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\CsvController::columnRoles + * @covers FireflyIII\Http\Controllers\CsvController::__construct */ public function testColumnRoles() { diff --git a/tests/acceptance/Controllers/CurrencyControllerTest.php b/tests/acceptance/Controllers/CurrencyControllerTest.php index eafd8d193e..ec4ce59ebd 100644 --- a/tests/acceptance/Controllers/CurrencyControllerTest.php +++ b/tests/acceptance/Controllers/CurrencyControllerTest.php @@ -16,6 +16,7 @@ class CurrencyControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\CurrencyController::create + * @covers FireflyIII\Http\Controllers\CurrencyController::__construct */ public function testCreate() { @@ -82,6 +83,9 @@ class CurrencyControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\CurrencyController::store + * @covers FireflyIII\Http\Requests\CurrencyFormRequest::authorize + * @covers FireflyIII\Http\Requests\CurrencyFormRequest::rules + * @covers FireflyIII\Http\Requests\CurrencyFormRequest::getCurrencyData */ public function testStore() { @@ -101,6 +105,9 @@ class CurrencyControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\CurrencyController::update + * @covers FireflyIII\Http\Requests\CurrencyFormRequest::authorize + * @covers FireflyIII\Http\Requests\CurrencyFormRequest::rules + * @covers FireflyIII\Http\Requests\CurrencyFormRequest::getCurrencyData */ public function testUpdate() { diff --git a/tests/acceptance/Controllers/HelpControllerTest.php b/tests/acceptance/Controllers/HelpControllerTest.php index e327a9f57f..aa44217e2a 100644 --- a/tests/acceptance/Controllers/HelpControllerTest.php +++ b/tests/acceptance/Controllers/HelpControllerTest.php @@ -16,6 +16,7 @@ class HelpControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\HelpController::show + * @covers FireflyIII\Http\Controllers\HelpController::__construct */ public function testShow() { diff --git a/tests/acceptance/Controllers/HomeControllerTest.php b/tests/acceptance/Controllers/HomeControllerTest.php index ba2d8cc4c6..299edd8274 100644 --- a/tests/acceptance/Controllers/HomeControllerTest.php +++ b/tests/acceptance/Controllers/HomeControllerTest.php @@ -11,6 +11,7 @@ class HomeControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\HomeController::dateRange + * @covers FireflyIII\Http\Controllers\HomeController::__construct */ public function testDateRange() { diff --git a/tests/acceptance/Controllers/JsonControllerTest.php b/tests/acceptance/Controllers/JsonControllerTest.php index e8ba9f8c16..7454260e70 100644 --- a/tests/acceptance/Controllers/JsonControllerTest.php +++ b/tests/acceptance/Controllers/JsonControllerTest.php @@ -17,6 +17,7 @@ class JsonControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\JsonController::action + * @covers FireflyIII\Http\Controllers\JsonController::__construct */ public function testAction() { diff --git a/tests/acceptance/Controllers/NewUserControllerTest.php b/tests/acceptance/Controllers/NewUserControllerTest.php index 01841352f4..5563c8c92b 100644 --- a/tests/acceptance/Controllers/NewUserControllerTest.php +++ b/tests/acceptance/Controllers/NewUserControllerTest.php @@ -16,6 +16,7 @@ class NewUserControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\NewUserController::index + * @covers FireflyIII\Http\Controllers\NewUserController::__construct */ public function testIndex() { @@ -37,14 +38,18 @@ class NewUserControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\NewUserController::submit + * @covers FireflyIII\Http\Requests\NewUserFormRequest::authorize + * @covers FireflyIII\Http\Requests\NewUserFormRequest::rules */ public function testSubmit() { $this->be($this->emptyUser()); $args = [ - 'bank_name' => 'New bank', - 'bank_balance' => 100, + 'bank_name' => 'New bank', + 'bank_balance' => 100, + 'savings_balance' => 200, + 'credit_card_limit' => 1000, ]; $this->call('POST', '/new-user/submit', $args); diff --git a/tests/acceptance/Controllers/PiggyBankControllerTest.php b/tests/acceptance/Controllers/PiggyBankControllerTest.php index 2ab8691f3d..611d205b2f 100644 --- a/tests/acceptance/Controllers/PiggyBankControllerTest.php +++ b/tests/acceptance/Controllers/PiggyBankControllerTest.php @@ -15,6 +15,7 @@ class PiggyBankControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\PiggyBankController::add + * @covers FireflyIII\Http\Controllers\PiggyBankController::__construct */ public function testAdd() { @@ -35,7 +36,6 @@ class PiggyBankControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\PiggyBankController::delete - * @todo Implement testDelete(). */ public function testDelete() { @@ -93,7 +93,6 @@ class PiggyBankControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\PiggyBankController::postAdd - * @todo Implement testPostAdd(). */ public function testPostAdd() { @@ -144,6 +143,8 @@ class PiggyBankControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\PiggyBankController::store + * @covers FireflyIII\Http\Requests\PiggyBankFormRequest::authorize + * @covers FireflyIII\Http\Requests\PiggyBankFormRequest::rules */ public function testStore() { @@ -163,6 +164,8 @@ class PiggyBankControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\PiggyBankController::update + * @covers FireflyIII\Http\Requests\PiggyBankFormRequest::authorize + * @covers FireflyIII\Http\Requests\PiggyBankFormRequest::rules */ public function testUpdate() { @@ -173,6 +176,7 @@ class PiggyBankControllerTest extends TestCase 'name' => 'Updated', 'targetamount' => 100, 'account_id' => 2, + 'id' => 1, ]; $this->call('POST', '/piggy-banks/update/1', $args); diff --git a/tests/acceptance/Controllers/PreferencesControllerTest.php b/tests/acceptance/Controllers/PreferencesControllerTest.php index 4fbf98a051..3b29a397e5 100644 --- a/tests/acceptance/Controllers/PreferencesControllerTest.php +++ b/tests/acceptance/Controllers/PreferencesControllerTest.php @@ -16,25 +16,32 @@ class PreferencesControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\PreferencesController::index - * @todo Implement testIndex(). + * @covers FireflyIII\Http\Controllers\PreferencesController::__construct */ 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', '/preferences'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\PreferencesController::postIndex - * @todo Implement testPostIndex(). */ public function testPostIndex() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $args = [ + 'frontPageAccounts' => [1], + 'viewRange' => '1M', + 'budgetMaximum' => 100, + 'customFiscalYear' => 1, + 'fiscalYearStart' => '01-01', + 'language' => 'en_US', + ]; + + $this->be($this->user()); + $this->call('POST', '/preferences', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } } diff --git a/tests/acceptance/Controllers/ProfileControllerTest.php b/tests/acceptance/Controllers/ProfileControllerTest.php index ffdf216572..38f7799e93 100644 --- a/tests/acceptance/Controllers/ProfileControllerTest.php +++ b/tests/acceptance/Controllers/ProfileControllerTest.php @@ -15,61 +15,69 @@ class ProfileControllerTest extends TestCase { /** * @covers FireflyIII\Http\Controllers\ProfileController::changePassword - * @todo Implement testChangePassword(). + * @covers FireflyIII\Http\Controllers\ProfileController::__construct */ public function testChangePassword() { - // 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', '/profile/change-password'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\ProfileController::deleteAccount - * @todo Implement testDeleteAccount(). */ public function testDeleteAccount() { - // 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', '/profile/delete-account'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\ProfileController::index - * @todo 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', '/profile'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\ProfileController::postChangePassword - * @todo Implement testPostChangePassword(). + * @covers FireflyIII\Http\Requests\ProfileFormRequest::authorize + * @covers FireflyIII\Http\Requests\ProfileFormRequest::rules */ public function testPostChangePassword() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $args = [ + 'current_password' => 'james', + 'new_password' => 'sander', + 'new_password_confirmation' => 'sander', + ]; + $this->be($this->user()); + $this->call('POST', '/profile/change-password', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\ProfileController::postDeleteAccount - * @todo Implement testPostDeleteAccount(). + * @covers FireflyIII\Http\Requests\DeleteAccountFormRequest::authorize + * @covers FireflyIII\Http\Requests\DeleteAccountFormRequest::rules */ public function testPostDeleteAccount() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $args = [ + 'password' => 'james', + ]; + + $this->be($this->toBeDeletedUser()); + $this->call('POST', '/profile/delete-account', $args); + $this->assertResponseStatus(302); + $this->assertRedirectedToRoute('index'); + $this->assertNull(DB::table('users')->find(3)); } } diff --git a/tests/acceptance/Controllers/ReportControllerTest.php b/tests/acceptance/Controllers/ReportControllerTest.php index 641f7def38..36841ab232 100644 --- a/tests/acceptance/Controllers/ReportControllerTest.php +++ b/tests/acceptance/Controllers/ReportControllerTest.php @@ -7,69 +7,67 @@ * of the MIT license. See the LICENSE file for details. */ +use FireflyIII\Helpers\Collection\Bill as BillCollection; +use FireflyIII\Helpers\Collection\Category as CategoryCollection; +use FireflyIII\Helpers\Collection\Expense; +use FireflyIII\Helpers\Collection\Income; /** * Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:39:28. */ class ReportControllerTest extends TestCase { - /** - * @covers FireflyIII\Http\Controllers\ReportController::defaultMonth - * @todo Implement testDefaultMonth(). - */ - public function testDefaultMonth() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Http\Controllers\ReportController::defaultMultiYear - * @todo Implement testDefaultMultiYear(). - */ - public function testDefaultMultiYear() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * @covers FireflyIII\Http\Controllers\ReportController::defaultYear - * @todo Implement testDefaultYear(). - */ - public function testDefaultYear() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } /** * @covers FireflyIII\Http\Controllers\ReportController::index - * @todo 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', '/reports'); + $this->assertResponseStatus(200); + + } + + /** + * @covers FireflyIII\Http\Controllers\ReportController::__construct + * @covers FireflyIII\Http\Controllers\ReportController::report + * @covers FireflyIII\Http\Controllers\ReportController::defaultMonth + */ + public function testReportDefaultMonth() + { + // mock some stuff. + $repository = $this->mock('FireflyIII\Helpers\Report\ReportHelperInterface'); + $repository->shouldReceive('getCategoryReport')->once()->andReturn(new CategoryCollection); + $repository->shouldReceive('getIncomeReport')->once()->andReturn(new Income); + $repository->shouldReceive('getExpenseReport')->once()->andReturn(new Expense); + $repository->shouldReceive('getBillReport')->once()->andReturn(new BillCollection); + + + $this->be($this->user()); + $this->call('GET', '/reports/report/default/20160101/20160131/1,2'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\ReportController::report - * @todo Implement testReport(). + * @covers FireflyIII\Http\Controllers\ReportController::defaultYear */ - public function testReport() + public function testReportDefaultYear() { - // 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', '/reports/report/default/20160101/20161231/1,2'); + $this->assertResponseStatus(200); + } + + /** + * @covers FireflyIII\Http\Controllers\ReportController::report + * @covers FireflyIII\Http\Controllers\ReportController::defaultMultiYear + */ + public function testReportDefaultMultiYear() + { + $this->be($this->user()); + $this->call('GET', '/reports/report/default/20160101/20171231/1,2'); + $this->assertResponseStatus(200); } } diff --git a/tests/acceptance/Controllers/RuleControllerTest.php b/tests/acceptance/Controllers/RuleControllerTest.php index b33352c035..ab8ed0a935 100644 --- a/tests/acceptance/Controllers/RuleControllerTest.php +++ b/tests/acceptance/Controllers/RuleControllerTest.php @@ -15,134 +15,163 @@ class RuleControllerTest extends TestCase { /** + * @covers FireflyIII\Http\Controllers\RuleController::__construct * @covers FireflyIII\Http\Controllers\RuleController::create - * @todo 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', '/rules/create/1'); + $this->assertResponseStatus(200); + } /** * @covers FireflyIII\Http\Controllers\RuleController::delete - * @todo 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', '/rules/rules/delete/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleController::destroy - * @todo 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(['rules.rule.delete.url' => 'http://localhost']); + + $this->be($this->user()); + $this->call('POST', '/rules/destroy/1'); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\RuleController::down - * @todo Implement testDown(). */ public function testDown() { - // 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', '/rules/rules/down/1'); + $this->assertResponseStatus(302); } /** * @covers FireflyIII\Http\Controllers\RuleController::edit - * @todo Implement testEdit(). + * @covers FireflyIII\Http\Controllers\RuleController::getCurrentTriggers + * @covers FireflyIII\Http\Controllers\RuleController::getCurrentActions */ 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', '/rules/rules/edit/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleController::index - * @todo Implement testIndex(). + * @covers FireflyIII\Http\Controllers\RuleController::createDefaultRuleGroup + * @covers FireflyIII\Http\Controllers\RuleController::createDefaultRule */ 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', '/rules'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleController::reorderRuleActions - * @todo Implement testReorderRuleActions(). */ public function testReorderRuleActions() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->be($this->user()); + $args = ['actions' => [1, 2, 3]]; + $this->call('POST', '/rules/rules/action/reorder/1', $args); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleController::reorderRuleTriggers - * @todo Implement testReorderRuleTriggers(). */ public function testReorderRuleTriggers() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->be($this->user()); + $args = ['actions' => [1, 2]]; + $this->call('POST', '/rules/rules/trigger/reorder/1', $args); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleController::store - * @todo Implement testStore(). + * @covers FireflyIII\Http\Requests\RuleFormRequest::authorize + * @covers FireflyIII\Http\Requests\RuleFormRequest::rules */ public function testStore() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->session(['rules.rule.create.url' => 'http://localhost']); + $this->be($this->user()); + $args = [ + 'rule_group_id' => 1, + 'title' => 'Some new rule', + 'user_id' => 1, + 'trigger' => 'store-journal', + 'description' => 'Some new rule', + 'rule-trigger' => ['description_is'], + 'rule-trigger-value' => ['something'], + 'rule-trigger-stop' => [], + 'rule-action' => ['set_category'], + 'rule-action-value' => ['something'], + 'rule-action-stop' => [], + 'stop_processing' => 0, + ]; + $this->call('POST', '/rules/store/1', $args); + + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\RuleController::up - * @todo Implement testUp(). */ public function testUp() { - // 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', '/rules/rules/up/1'); + $this->assertResponseStatus(302); } /** * @covers FireflyIII\Http\Controllers\RuleController::update - * @todo Implement testUpdate(). + * @covers FireflyIII\Http\Requests\RuleFormRequest::authorize + * @covers FireflyIII\Http\Requests\RuleFormRequest::rules */ public function testUpdate() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->session(['rules.rule.edit.url' => 'http://localhost']); + + $this->be($this->user()); + $args = [ + 'title' => 'Some new rule update', + 'rule_group_id' => 1, + 'id' => 1, + 'active' => 1, + 'trigger' => 'store-journal', + 'description' => 'Some new rule', + 'rule-trigger' => ['description_is'], + 'rule-trigger-value' => ['something'], + 'rule-trigger-stop' => [], + 'rule-action' => ['set_category'], + 'rule-action-value' => ['something'], + 'rule-action-stop' => [], + 'stop_processing' => 0, + ]; + $this->call('POST', '/rules/update/1', $args); + $this->assertSessionHas('success'); + $this->assertResponseStatus(302); } } diff --git a/tests/acceptance/Controllers/RuleGroupControllerTest.php b/tests/acceptance/Controllers/RuleGroupControllerTest.php index f23e52417c..838b110815 100644 --- a/tests/acceptance/Controllers/RuleGroupControllerTest.php +++ b/tests/acceptance/Controllers/RuleGroupControllerTest.php @@ -16,97 +16,105 @@ class RuleGroupControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\RuleGroupController::create - * @todo Implement testCreate(). + * @covers FireflyIII\Http\Controllers\RuleGroupController::__construct */ 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', '/rules/groups/create'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleGroupController::delete - * @todo 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', '/rules/groups/delete/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleGroupController::destroy - * @todo 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(['rules.rule-group.delete.url' => 'http://localhost']); + + $this->be($this->user()); + $this->call('POST', '/rules/groups/destroy/1'); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\RuleGroupController::down - * @todo Implement testDown(). */ public function testDown() { - // 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', '/rules/groups/down/1'); + $this->assertResponseStatus(302); } /** * @covers FireflyIII\Http\Controllers\RuleGroupController::edit - * @todo 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', '/rules/groups/edit/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\RuleGroupController::store - * @todo Implement testStore(). + * @covers FireflyIII\Http\Requests\RuleGroupFormRequest::authorize + * @covers FireflyIII\Http\Requests\RuleGroupFormRequest::rules */ public function testStore() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->session(['rules.rule-group.create.url' => 'http://localhost']); + $args = [ + 'title' => 'Some new rule group', + 'description' => 'New rules', + ]; + + $this->be($this->user()); + $this->call('POST', '/rules/groups/store', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\RuleGroupController::up - * @todo Implement testUp(). */ public function testUp() { - // 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', '/rules/groups/up/1'); + $this->assertResponseStatus(302); } /** * @covers FireflyIII\Http\Controllers\RuleGroupController::update - * @todo Implement testUpdate(). + * @covers FireflyIII\Http\Requests\RuleGroupFormRequest::authorize + * @covers FireflyIII\Http\Requests\RuleGroupFormRequest::rules */ public function testUpdate() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->session(['rules.rule-group.edit.url' => 'http://localhost']); + $args = [ + 'id' => 1, + 'title' => 'Some new rule group X', + 'description' => 'New rules', + 'active' => 1, + ]; + + $this->be($this->user()); + $this->call('POST', '/rules/groups/update/1', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } } diff --git a/tests/acceptance/Controllers/SearchControllerTest.php b/tests/acceptance/Controllers/SearchControllerTest.php index 70f44bc0bc..0d9838e37c 100644 --- a/tests/acceptance/Controllers/SearchControllerTest.php +++ b/tests/acceptance/Controllers/SearchControllerTest.php @@ -14,14 +14,13 @@ class SearchControllerTest extends TestCase { /** + * @covers FireflyIII\Http\Controllers\SearchController::__construct * @covers FireflyIII\Http\Controllers\SearchController::index - * @todo 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', '/search?q=test&search='); + $this->assertResponseStatus(200); } } diff --git a/tests/acceptance/Controllers/TagControllerTest.php b/tests/acceptance/Controllers/TagControllerTest.php index 8aa3cad951..d323a08669 100644 --- a/tests/acceptance/Controllers/TagControllerTest.php +++ b/tests/acceptance/Controllers/TagControllerTest.php @@ -15,110 +15,115 @@ class TagControllerTest extends TestCase { /** + * @covers FireflyIII\Http\Controllers\TagController::__construct * @covers FireflyIII\Http\Controllers\TagController::create - * @todo 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', '/tags/create'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TagController::delete - * @todo 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', '/tags/delete/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TagController::destroy - * @todo Implement testDestroy(). */ public function testDestroy() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->be($this->user()); + $this->call('POST', '/tags/destroy/1'); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\TagController::edit - * @todo 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', '/tags/edit/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TagController::hideTagHelp - * @todo Implement testHideTagHelp(). */ public function testHideTagHelp() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->be($this->user()); + $this->call('POST', '/tags/hideTagHelp/true'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TagController::index - * @todo 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', '/tags'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TagController::show - * @todo 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', '/tags/show/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TagController::store - * @todo Implement testStore(). + * @covers FireflyIII\Http\Requests\TagFormRequest::authorize + * @covers FireflyIII\Http\Requests\TagFormRequest::rules */ public function testStore() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $args = [ + 'tag' => 'Some new tag', + 'tagMode' => 'nothing', + ]; + + $this->session(['tags.create.url' => 'http://localhost']); + + $this->be($this->user()); + $this->call('POST', '/tags/store', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\TagController::update - * @todo Implement testUpdate(). + * @covers FireflyIII\Http\Requests\TagFormRequest::authorize + * @covers FireflyIII\Http\Requests\TagFormRequest::rules */ public function testUpdate() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $args = [ + 'tag' => 'Some new tag yay', + 'id' => 1, + 'tagMode' => 'nothing', + ]; + + $this->session(['tags.edit.url' => 'http://localhost']); + + $this->be($this->user()); + $this->call('POST', '/tags/update/1', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } } diff --git a/tests/acceptance/Controllers/TransactionControllerTest.php b/tests/acceptance/Controllers/TransactionControllerTest.php index 937acaccb8..0d71d0134a 100644 --- a/tests/acceptance/Controllers/TransactionControllerTest.php +++ b/tests/acceptance/Controllers/TransactionControllerTest.php @@ -16,109 +16,130 @@ class TransactionControllerTest extends TestCase /** * @covers FireflyIII\Http\Controllers\TransactionController::create - * @todo Implement testCreate(). + * @covers FireflyIII\Http\Controllers\TransactionController::__construct */ 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', '/transactions/create/withdrawal'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::delete - * @todo 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', '/transaction/delete/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::destroy - * @todo 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()); + $this->call('POST', '/transaction/destroy/1'); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\TransactionController::edit - * @todo 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', '/transaction/edit/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::index - * @todo 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', '/transactions/deposit'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::reorder - * @todo Implement testReorder(). */ public function testReorder() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $args = [ + 'ids' => [1], + 'date' => '2015-01-01', + ]; + $this->be($this->user()); + $this->call('POST', '/transaction/reorder', $args); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::show - * @todo 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', '/transaction/show/1'); + $this->assertResponseStatus(200); } /** * @covers FireflyIII\Http\Controllers\TransactionController::store - * @todo Implement testStore(). + * @covers FireflyIII\Http\Requests\JournalFormRequest::authorize + * @covers FireflyIII\Http\Requests\JournalFormRequest::rules + * @covers FireflyIII\Http\Requests\JournalFormRequest::getJournalData */ 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']); + + $args = [ + 'what' => 'withdrawal', + 'description' => 'Something', + 'account_id' => '1', + 'expense_account' => 'Some expense', + 'amount' => 100, + 'amount_currency_id_amount' => 1, + 'date' => '2015-01-01', + ]; + $this->be($this->user()); + $this->call('POST', '/transactions/store/withdrawal', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } /** * @covers FireflyIII\Http\Controllers\TransactionController::update - * @todo Implement testUpdate(). + * @covers FireflyIII\Http\Requests\JournalFormRequest::authorize + * @covers FireflyIII\Http\Requests\JournalFormRequest::rules + * @covers FireflyIII\Http\Requests\JournalFormRequest::getJournalData */ 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']); + + $args = [ + 'what' => 'withdrawal', + 'id' => 2, + 'description' => 'Something new', + 'account_id' => '1', + 'expense_account' => 'Some expense', + 'amount' => 100, + 'amount_currency_id_amount' => 1, + 'date' => '2015-01-01', + ]; + $this->be($this->user()); + $this->call('POST', '/transaction/update/1', $args); + $this->assertResponseStatus(302); + $this->assertSessionHas('success'); } }