mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add test
This commit is contained in:
parent
0640631821
commit
dd991e3572
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Bundle\ChillMainBundle\Tests\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class SearchApiControllerTest extends WebTestCase
|
||||||
|
{
|
||||||
|
use PrepareClientTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider generateSearchData
|
||||||
|
*/
|
||||||
|
public function testSearch(string $pattern, array $types)
|
||||||
|
{
|
||||||
|
$client = $this->getClientAuthenticated();
|
||||||
|
|
||||||
|
$client->request(
|
||||||
|
Request::METHOD_GET,
|
||||||
|
'/api/1.0/search.json',
|
||||||
|
[ 'q' => $pattern, 'type' => $types ]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertResponseIsSuccessful();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateSearchData()
|
||||||
|
{
|
||||||
|
yield ['per', ['person', 'thirdparty'] ];
|
||||||
|
yield ['per', ['thirdparty'] ];
|
||||||
|
yield ['per', ['person'] ];
|
||||||
|
yield ['fjklmeqjfkdqjklrmefdqjklm', ['person', 'thirdparty'] ];
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user