Merge branch 'features/api-search' into 'master'

Features/api search

See merge request Chill-Projet/chill-bundles!98
This commit is contained in:
2021-06-29 14:50:28 +00:00
12 changed files with 431 additions and 54 deletions

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