mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
adaptations for third party search
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Search;
|
||||
|
||||
use Chill\MainBundle\Search\SearchApiQuery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SearchApiQueryTest extends TestCase
|
||||
{
|
||||
public function testMultipleWhereClauses()
|
||||
{
|
||||
$q = new SearchApiQuery();
|
||||
$q->setSelectJsonbMetadata('boum')
|
||||
->setSelectKey('bim')
|
||||
->setSelectPertinence('1')
|
||||
->setFromClause('badaboum')
|
||||
->andWhereClause('foo', [ 'alpha' ])
|
||||
->andWhereClause('bar', [ 'beta' ])
|
||||
;
|
||||
|
||||
$query = $q->buildQuery();
|
||||
|
||||
$this->assertStringContainsString('foo AND bar', $query);
|
||||
$this->assertEquals(['alpha', 'beta'], $q->buildParameters());
|
||||
}
|
||||
|
||||
public function testWithoutWhereClause()
|
||||
{
|
||||
$q = new SearchApiQuery();
|
||||
$q->setSelectJsonbMetadata('boum')
|
||||
->setSelectKey('bim')
|
||||
->setSelectPertinence('1')
|
||||
->setFromClause('badaboum')
|
||||
;
|
||||
|
||||
$this->assertTrue(\is_string($q->buildQuery()));
|
||||
$this->assertEquals([], $q->buildParameters());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user