Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Tests for search [skip ci]
James Cole94fcfacec4f4
diff --git a/app/controllers/SearchController.php b/app/controllers/SearchController.phpindex e1588d8e3b..978200c8c4 100644--- a/app/controllers/SearchController.php+++ b/app/controllers/SearchController.php@@ -17,7 +17,7 @@ class SearchController extends BaseController$subTitle = null;$rawQuery = null;$result = [];- if (!is_null(Input::get('q'))) {+ if (!is_null(Input::get('q')) && strlen(Input::get('q')) > 0) {$rawQuery = trim(Input::get('q'));$words = explode(' ', $rawQuery);$subTitle = 'Results for "' . e($rawQuery) . '"';diff --git a/tests/functional/SearchControllerCest.php b/tests/functional/SearchControllerCest.phpnew file mode 100644index 0000000000..973b2c54ab--- /dev/null+++ b/tests/functional/SearchControllerCest.php@@ -0,0 +1,39 @@+<?php++/**+ * Class SearchControllerCest+ */+class SearchControllerCest+{+ /**+ * @param FunctionalTester $I+ */+ public function _after(FunctionalTester $I)+ {+ }++ /**+ * @param FunctionalTester $I+ */+ public function _before(FunctionalTester $I)+ {+ $I->amLoggedAs(['email' => '[email protected]', 'password' => 'james']);+ }++ public function index(FunctionalTester $I)+ {+ $I->wantTo('search for "salary"');+ $I->amOnPage('/search?q=salary');+ $I->see('Transactions');+ $I->see('Results for "salary"');++ }++ public function indexNoQuery(FunctionalTester $I)+ {+ $I->wantTo('Search for empty string');+ $I->amOnPage('/search?q=');+ $I->see('Search for ""');++ }+}\ No newline at end of file