From 48cb528ae4c27afdc83a66b947fc791883b9f7a7 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 21 Dec 2014 17:59:47 +0100 Subject: [PATCH] Increased test coverage. Also updated read me. --- README.md | 15 ++-- app/controllers/HomeController.php | 6 +- .../FireflyIII/Shared/Toolkit/Navigation.php | 5 +- tests/functional/HomeControllerCest.php | 75 +++++++++++++++++++ 4 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 tests/functional/HomeControllerCest.php diff --git a/README.md b/README.md index bf34ed9ef3..25c2f0d92b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Firefly III [![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii) [![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii) +[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.png?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master) [![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii) [![Total Downloads](https://poser.pugx.org/grumpydictator/firefly-iii/downloads.svg)](https://packagist.org/packages/grumpydictator/firefly-iii) @@ -25,7 +26,7 @@ laptop and [Firefly II](https://github.com/JC5/Firefly) is live. - Predict and anticipate large expenses using "repeated expenses" (ie. yearly taxes); - Predict and anticipate bills using "recurring transactions" (rent for example); - View basic income / expense reports. -- +- Lots of help text in case you don't get it; Everything is organised: @@ -39,15 +40,13 @@ Everything is organised: Firefly III will feature, but does not feature yet: - Financial reporting showing you how well you are doing; -- Lots of help text in case you don't get it; - More control over other resources outside of personal finance - Accounts shared with a partner (household accounts) - Debts - Credit cards -- More test-coverage (aka: actual test coverage); +- More test-coverage; - Firefly will be able to split transactions; a single purchase can be split in multiple entries, for more fine-grained control. - Firefly will be able to join transactions. -- Transfers and transactions are combined into one internal datatype which is more consistent with what you're actually doing: moving money from A to B. The fact that A or B or both are yours should not matter. - Any other features I might not have thought of. Some stuff has been removed: @@ -66,13 +65,9 @@ Some stuff has been removed: ![Reports](http://i.imgur.com/EnEIyQI.png) ## Current state -I have the basics up and running. Test coverage is currently non-existent. +I have the basics up and running. Test coverage is currently coming, slowly. Although I have not checked extensively, some forms and views have CSRF vulnerabilities. This is because not all views escape all characters by default. Will be fixed. -The current layout / look & feel is a pretty basic Bootstrap3 template. I am currently working on a more consistent, -expanded layout which will feature shiny AJAX things and data tables and all the Web 3.0 goodies you've come to expect -from social media sites. - -Questions, ideas or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)! +Questions, ideas or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)! \ No newline at end of file diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index 5e944f0386..faea3a7f68 100644 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -77,7 +77,7 @@ class HomeController extends BaseController Session::forget('range'); } - return Redirect::back(); + return Redirect::intended('/'); } /** @@ -87,7 +87,7 @@ class HomeController extends BaseController { Navigation::next(); - return Redirect::back(); + return Redirect::intended('/'); } /** @@ -97,6 +97,6 @@ class HomeController extends BaseController { Navigation::prev(); - return Redirect::back(); + return Redirect::intended('/'); } } \ No newline at end of file diff --git a/app/lib/FireflyIII/Shared/Toolkit/Navigation.php b/app/lib/FireflyIII/Shared/Toolkit/Navigation.php index 701bfead28..4800201f30 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Navigation.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Navigation.php @@ -1,6 +1,7 @@ setSessionRangeValue(); - $start = \Session::get('start'); + $start = \Session::get('start', Carbon::now()->startOfMonth()); /* * Add some period to $start. @@ -50,7 +51,7 @@ class Navigation $filter = new Filter; $range = $filter->setSessionRangeValue(); - $start = \Session::get('start'); + $start = \Session::get('start', Carbon::now()->startOfMonth()); /* * Substract some period to $start. diff --git a/tests/functional/HomeControllerCest.php b/tests/functional/HomeControllerCest.php new file mode 100644 index 0000000000..d6385df4ad --- /dev/null +++ b/tests/functional/HomeControllerCest.php @@ -0,0 +1,75 @@ +amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']); + } + + /** + * @param FunctionalTester $I + */ + public function flush(FunctionalTester $I) + { + $I->wantTo('flush the cache'); + $I->amOnPage('/flush'); + $I->canSeeResponseCodeIs(200); + $I->see('Firefly'); + } + + /** + * @param FunctionalTester $I + */ + public function index(FunctionalTester $I) + { + $I->wantTo('see the home page of Firefly'); + $I->amOnPage('/'); + $I->canSeeResponseCodeIs(200); + $I->see('Firefly'); + } + + /** + * @param FunctionalTester $I + */ + public function rangeJump(FunctionalTester $I) + { + $I->wantTo('switch to another date range'); + $I->amOnPage('/jump/6M'); + $I->canSeeResponseCodeIs(200); + + } + + /** + * @param FunctionalTester $I + */ + public function sessionNext(FunctionalTester $I) + { + $I->wantTo('jump to the next period'); + $I->amOnPage('/next'); + $I->canSeeResponseCodeIs(200); + } + + /** + * @param FunctionalTester $I + */ + public function sessionPrev(FunctionalTester $I) + { + $I->wantTo('jump to the previous period'); + $I->amOnPage('/prev'); + $I->canSeeResponseCodeIs(200); + } +} \ No newline at end of file