mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 09:51:21 -06:00
Tests for search [skip ci]
This commit is contained in:
parent
ba7c01c6bc
commit
94fcfacec4
@ -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) . '"';
|
||||
|
39
tests/functional/SearchControllerCest.php
Normal file
39
tests/functional/SearchControllerCest.php
Normal file
@ -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' => 'thegrumpydictator@gmail.com', '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 ""');
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user