This commit is contained in:
Julien Fastré 2021-06-28 23:02:15 +02:00
parent 0640631821
commit dd991e3572

View File

@ -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'] ];
}
}