Tests for preferences controller.

This commit is contained in:
James Cole 2014-12-24 22:39:23 +01:00
parent 037452e525
commit 8ef659f5de
4 changed files with 60 additions and 19 deletions

View File

@ -215,14 +215,14 @@ Route::group(
// piggy bank controller // piggy bank controller
Route::get('/piggy_banks', ['uses' => 'PiggybankController@index', 'as' => 'piggy_banks.index']); 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/add/{piggy_bank}', ['uses' => 'PiggyBankController@add']); # add money
Route::get('/piggy_banks/remove/{piggy_bank}', ['uses' => 'PiggybankController@remove']); #remove 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/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/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/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/show/{piggy_bank}', ['uses' => 'PiggyBankController@show', 'as' => 'piggy_banks.show']);
// preferences controller // preferences controller
Route::get('/preferences', ['uses' => 'PreferencesController@index', 'as' => 'preferences']); 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']); Route::post('/currency/destroy/{currency}', ['uses' => 'CurrencyController@destroy', 'as' => 'currency.destroy']);
// piggy bank controller // piggy bank controller
Route::post('/piggy_banks/store', ['uses' => 'PiggybankController@store', 'as' => 'piggy_banks.store']); 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/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/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/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/remove/{piggy_bank}', ['uses' => 'PiggyBankController@postRemove', 'as' => 'piggy_banks.remove']); # remove money.
// repeated expense controller // repeated expense controller
Route::post('/repeatedexpense/store', ['uses' => 'RepeatedExpenseController@store', 'as' => 'repeated.store']); Route::post('/repeatedexpense/store', ['uses' => 'RepeatedExpenseController@store', 'as' => 'repeated.store']);

View File

@ -2,7 +2,7 @@
@section('content') @section('content')
{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }} {{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) }}
<!-- form --> <!-- form -->
{{Form::open(['class' => 'form-horizontal'])}} {{Form::open(['class' => 'form-horizontal','id' => 'preferences'])}}
<div class="row"> <div class="row">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">

12
composer.lock generated
View File

@ -1825,21 +1825,21 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "barryvdh/laravel-debugbar", "name": "barryvdh/laravel-debugbar",
"version": "v1.8.4", "version": "v1.8.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git", "url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "410e98739c58ccd1b9ad2f49afd77a8d40144515" "reference": "548e12d45760ee66192029f4b642d2f4e3d64118"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/410e98739c58ccd1b9ad2f49afd77a8d40144515", "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/548e12d45760ee66192029f4b642d2f4e3d64118",
"reference": "410e98739c58ccd1b9ad2f49afd77a8d40144515", "reference": "548e12d45760ee66192029f4b642d2f4e3d64118",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"laravel/framework": "4.*|5.0.*", "laravel/framework": "4.*|5.0.*",
"maximebf/debugbar": "~1.10.1", "maximebf/debugbar": "~1.10.2",
"php": ">=5.3.0", "php": ">=5.3.0",
"symfony/finder": "~2.3" "symfony/finder": "~2.3"
}, },
@ -1875,7 +1875,7 @@
"profiler", "profiler",
"webprofiler" "webprofiler"
], ],
"time": "2014-12-04 12:14:32" "time": "2014-12-24 08:00:07"
}, },
{ {
"name": "barryvdh/laravel-ide-helper", "name": "barryvdh/laravel-ide-helper",

View File

@ -0,0 +1,41 @@
<?php
class PreferencesControllerCest
{
/**
* @param FunctionalTester $I
*/
public function _after(FunctionalTester $I)
{
}
/**
* @param FunctionalTester $I
*/
public function _before(FunctionalTester $I)
{
$I->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!');
}
}