adaptations for third party search

This commit is contained in:
2021-10-12 09:28:53 +02:00
parent f4369553e1
commit e9192c5011
5 changed files with 138 additions and 19 deletions

View File

@@ -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());
}
}