From 8ef659f5de85db8ee2172fd023a3468a09cf32ad Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 24 Dec 2014 22:39:23 +0100 Subject: [PATCH] Tests for preferences controller. --- app/routes.php | 24 +++++------ app/views/preferences/index.blade.php | 2 +- composer.lock | 12 +++--- .../functional/PreferencesControllerCest.php | 41 +++++++++++++++++++ 4 files changed, 60 insertions(+), 19 deletions(-) create mode 100644 tests/functional/PreferencesControllerCest.php diff --git a/app/routes.php b/app/routes.php index cf569382f6..7288405638 100644 --- a/app/routes.php +++ b/app/routes.php @@ -215,14 +215,14 @@ Route::group( // piggy bank controller - Route::get('/piggy_banks', ['uses' => 'PiggybankController@index', 'as' => 'piggy_banks.index']); - Route::get('/piggy_banks/add/{piggy_bank}', ['uses' => 'PiggybankController@add']); # add money - Route::get('/piggy_banks/remove/{piggy_bank}', ['uses' => 'PiggybankController@remove']); #remove money + Route::get('/piggy_banks', ['uses' => 'PiggyBankController@index', 'as' => 'piggy_banks.index']); + Route::get('/piggy_banks/add/{piggy_bank}', ['uses' => 'PiggyBankController@add']); # add money + Route::get('/piggy_banks/remove/{piggy_bank}', ['uses' => 'PiggyBankController@remove']); #remove money - Route::get('/piggy_banks/create', ['uses' => 'PiggybankController@create', 'as' => 'piggy_banks.create']); - Route::get('/piggy_banks/edit/{piggy_bank}', ['uses' => 'PiggybankController@edit', 'as' => 'piggy_banks.edit']); - Route::get('/piggy_banks/delete/{piggy_bank}', ['uses' => 'PiggybankController@delete', 'as' => 'piggy_banks.delete']); - Route::get('/piggy_banks/show/{piggy_bank}', ['uses' => 'PiggybankController@show', 'as' => 'piggy_banks.show']); + Route::get('/piggy_banks/create', ['uses' => 'PiggyBankController@create', 'as' => 'piggy_banks.create']); + Route::get('/piggy_banks/edit/{piggy_bank}', ['uses' => 'PiggyBankController@edit', 'as' => 'piggy_banks.edit']); + Route::get('/piggy_banks/delete/{piggy_bank}', ['uses' => 'PiggyBankController@delete', 'as' => 'piggy_banks.delete']); + Route::get('/piggy_banks/show/{piggy_bank}', ['uses' => 'PiggyBankController@show', 'as' => 'piggy_banks.show']); // preferences controller Route::get('/preferences', ['uses' => 'PreferencesController@index', 'as' => 'preferences']); @@ -308,11 +308,11 @@ Route::group( Route::post('/currency/destroy/{currency}', ['uses' => 'CurrencyController@destroy', 'as' => 'currency.destroy']); // piggy bank controller - Route::post('/piggy_banks/store', ['uses' => 'PiggybankController@store', 'as' => 'piggy_banks.store']); - Route::post('/piggy_banks/update/{piggy_bank}', ['uses' => 'PiggybankController@update', 'as' => 'piggy_banks.update']); - Route::post('/piggy_banks/destroy/{piggy_bank}', ['uses' => 'PiggybankController@destroy', 'as' => 'piggy_banks.destroy']); - Route::post('/piggy_banks/add/{piggy_bank}', ['uses' => 'PiggybankController@postAdd', 'as' => 'piggy_banks.add']); # add money - Route::post('/piggy_banks/remove/{piggy_bank}', ['uses' => 'PiggybankController@postRemove', 'as' => 'piggy_banks.remove']); # remove money. + Route::post('/piggy_banks/store', ['uses' => 'PiggyBankController@store', 'as' => 'piggy_banks.store']); + Route::post('/piggy_banks/update/{piggy_bank}', ['uses' => 'PiggyBankController@update', 'as' => 'piggy_banks.update']); + Route::post('/piggy_banks/destroy/{piggy_bank}', ['uses' => 'PiggyBankController@destroy', 'as' => 'piggy_banks.destroy']); + Route::post('/piggy_banks/add/{piggy_bank}', ['uses' => 'PiggyBankController@postAdd', 'as' => 'piggy_banks.add']); # add money + Route::post('/piggy_banks/remove/{piggy_bank}', ['uses' => 'PiggyBankController@postRemove', 'as' => 'piggy_banks.remove']); # remove money. // repeated expense controller Route::post('/repeatedexpense/store', ['uses' => 'RepeatedExpenseController@store', 'as' => 'repeated.store']); diff --git a/app/views/preferences/index.blade.php b/app/views/preferences/index.blade.php index 0a3816f684..d57aa6636b 100644 --- a/app/views/preferences/index.blade.php +++ b/app/views/preferences/index.blade.php @@ -2,7 +2,7 @@ @section('content') {{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} -{{Form::open(['class' => 'form-horizontal'])}} +{{Form::open(['class' => 'form-horizontal','id' => 'preferences'])}}
diff --git a/composer.lock b/composer.lock index 20676b73a9..07850e0b5c 100644 --- a/composer.lock +++ b/composer.lock @@ -1825,21 +1825,21 @@ "packages-dev": [ { "name": "barryvdh/laravel-debugbar", - "version": "v1.8.4", + "version": "v1.8.5", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "410e98739c58ccd1b9ad2f49afd77a8d40144515" + "reference": "548e12d45760ee66192029f4b642d2f4e3d64118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/410e98739c58ccd1b9ad2f49afd77a8d40144515", - "reference": "410e98739c58ccd1b9ad2f49afd77a8d40144515", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/548e12d45760ee66192029f4b642d2f4e3d64118", + "reference": "548e12d45760ee66192029f4b642d2f4e3d64118", "shasum": "" }, "require": { "laravel/framework": "4.*|5.0.*", - "maximebf/debugbar": "~1.10.1", + "maximebf/debugbar": "~1.10.2", "php": ">=5.3.0", "symfony/finder": "~2.3" }, @@ -1875,7 +1875,7 @@ "profiler", "webprofiler" ], - "time": "2014-12-04 12:14:32" + "time": "2014-12-24 08:00:07" }, { "name": "barryvdh/laravel-ide-helper", diff --git a/tests/functional/PreferencesControllerCest.php b/tests/functional/PreferencesControllerCest.php new file mode 100644 index 0000000000..680ca70a49 --- /dev/null +++ b/tests/functional/PreferencesControllerCest.php @@ -0,0 +1,41 @@ +amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']); + } + + /** + * @param FunctionalTester $I + */ + public function index(FunctionalTester $I) + { + $I->wantTo('see my current set of preferences'); + $I->amOnPage('/preferences'); + $I->see('Preferences'); + } + + /** + * @param FunctionalTester $I + */ + public function postIndex(FunctionalTester $I) + { + $I->wantTo('want to update my preferences'); + $I->amOnPage('/preferences'); + $I->see('Preferences'); + $I->submitForm('#preferences', []); + $I->see('Preferences saved!'); + } +} \ No newline at end of file