mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Covered search controller.
This commit is contained in:
parent
aa6209af00
commit
f560fc6d76
56
tests/controllers/SearchControllerTest.php
Normal file
56
tests/controllers/SearchControllerTest.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
|
||||
/**
|
||||
* Class SearchControllerTest
|
||||
*/
|
||||
class SearchControllerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called before the first test of this test class is run.
|
||||
*
|
||||
* @since Method available since Release 3.4.0
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testSearch() {
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
$words = ['Something'];
|
||||
// mock!
|
||||
$repository = $this->mock('FireflyIII\Support\Search\SearchInterface');
|
||||
$repository->shouldReceive('searchTransactions')->with($words)->once()->andReturn([]);
|
||||
$repository->shouldReceive('searchAccounts')->with($words)->once()->andReturn([]);
|
||||
$repository->shouldReceive('searchCategories')->with($words)->once()->andReturn([]);
|
||||
$repository->shouldReceive('searchBudgets')->with($words)->once()->andReturn([]);
|
||||
$repository->shouldReceive('searchTags')->with($words)->once()->andReturn([]);
|
||||
|
||||
$this->call('GET','/search?q=Something');
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user