Also fixed tests.

This commit is contained in:
James Cole 2016-02-05 19:25:17 +01:00
parent 82a4c706b0
commit c9b215684c
2 changed files with 13 additions and 5 deletions

View File

@ -38,11 +38,11 @@ class SearchController extends Controller
$words = explode(' ', $query); $words = explode(' ', $query);
$subTitle = trans('firefly.search_results_for', ['query' => $query]); $subTitle = trans('firefly.search_results_for', ['query' => $query]);
$transactions = [];//$searcher->searchTransactions($words); $transactions = $searcher->searchTransactions($words);
$accounts = [];//$searcher->searchAccounts($words); $accounts = $searcher->searchAccounts($words);
$categories = [];//$searcher->searchCategories($words); $categories = $searcher->searchCategories($words);
$budgets = [];//$searcher->searchBudgets($words); $budgets = $searcher->searchBudgets($words);
$tags = [];//$searcher->searchTags($words); $tags = $searcher->searchTags($words);
$result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags]; $result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags];
} }

View File

@ -6,6 +6,7 @@
* This software may be modified and distributed under the terms * This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details. * of the MIT license. See the LICENSE file for details.
*/ */
use Illuminate\Support\Collection;
/** /**
@ -19,6 +20,13 @@ class SearchControllerTest extends TestCase
*/ */
public function testIndex() public function testIndex()
{ {
$searcher = $this->mock('FireflyIII\Support\Search\SearchInterface');
$searcher->shouldReceive('searchTransactions')->once()->with(['test'])->andReturn(new Collection);
$searcher->shouldReceive('searchAccounts')->once()->with(['test'])->andReturn(new Collection);
$searcher->shouldReceive('searchCategories')->once()->with(['test'])->andReturn(new Collection);
$searcher->shouldReceive('searchBudgets')->once()->with(['test'])->andReturn(new Collection);
$searcher->shouldReceive('searchTags')->once()->with(['test'])->andReturn(new Collection);
$this->be($this->user()); $this->be($this->user());
$this->call('GET', '/search?q=test&search='); $this->call('GET', '/search?q=test&search=');
$this->assertResponseStatus(200); $this->assertResponseStatus(200);