From e62e0345dfce6b5fddbfee0f3ec55e64134b36ad Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 21 Dec 2014 11:15:37 +0100 Subject: [PATCH] Also covered help. --- app/commands/Cleanup.php | 4 -- app/controllers/PreferencesController.php | 7 ++- tests/functional/HelpControllerCest.php | 76 +++++++++++++++++++++++ 3 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 tests/functional/HelpControllerCest.php diff --git a/app/commands/Cleanup.php b/app/commands/Cleanup.php index 3250d1d75f..76b734fe53 100644 --- a/app/commands/Cleanup.php +++ b/app/commands/Cleanup.php @@ -15,17 +15,13 @@ class Cleanup extends Command * * @var string */ - // @codingStandardsIgnoreStart protected $description = 'Clean caches, regenerate some stuff.'; - // @codingStandardsIgnoreEnd /** * The console command name. * * @var string */ - // @codingStandardsIgnoreStart protected $name = 'firefly:cleanup'; - // @codingStandardsIgnoreEnd /** * diff --git a/app/controllers/PreferencesController.php b/app/controllers/PreferencesController.php index ecd536f6c7..852059497c 100644 --- a/app/controllers/PreferencesController.php +++ b/app/controllers/PreferencesController.php @@ -3,6 +3,8 @@ /** * Class PreferencesController * + * @SuppressWarnings("CyclomaticComplexity") // It's all 5. So ok. + * */ class PreferencesController extends BaseController { @@ -30,9 +32,10 @@ class PreferencesController extends BaseController $accounts = $acct->getAssetAccounts(); $viewRange = $preferences->get('viewRange', '1M'); $viewRangeValue = $viewRange->data; - $frontpage = $preferences->get('frontpageAccounts', []); + $frontPage = $preferences->get('frontpageAccounts', []); - return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)->with('viewRange', $viewRangeValue); + + return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontPage)->with('viewRange', $viewRangeValue); } /** diff --git a/tests/functional/HelpControllerCest.php b/tests/functional/HelpControllerCest.php new file mode 100644 index 0000000000..b728147027 --- /dev/null +++ b/tests/functional/HelpControllerCest.php @@ -0,0 +1,76 @@ +amLoggedAs(['email' => 'thegrumpydictator@gmail.com', 'password' => 'james']); + } + + /** + * @param FunctionalTester $I + */ + public function show(FunctionalTester $I) + { + $I->wantTo('show help for the index page'); + $I->amOnPage('/help/index'); + $I->canSeeResponseCodeIs(200); + $I->see('text'); + + } + + /** + * @param FunctionalTester $I + */ + public function showFromCache(FunctionalTester $I) + { + $I->wantTo('show help for the index page from the cache.'); + $I->amOnPage('/help/index'); + $I->amOnPage('/help/index'); + $I->canSeeResponseCodeIs(200); + $I->see('text'); + + } + + /** + * @param FunctionalTester $I + */ + public function showHelpInvalidRoute(FunctionalTester $I) + { + $I->wantTo('show help for a non-existing route.'); + $I->amOnPage('/help/indexXXXX'); + $I->canSeeResponseCodeIs(200); + $I->see('There is no help for this route'); + + } + + /** + * @param FunctionalTester $I + */ + public function showHelpNoHelpFile(FunctionalTester $I) + { + $I->wantTo('show help for route that has no help file.'); + $I->amOnPage('/help/help.show'); + $I->canSeeResponseCodeIs(200); + $I->see('text'); + + } + +} \ No newline at end of file