mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,12 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Search;
|
||||
|
||||
use Chill\MainBundle\Search\SearchApiQuery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use function is_string;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class SearchApiQueryTest extends TestCase
|
||||
{
|
||||
public function testBuildParams()
|
||||
{
|
||||
$q = new SearchApiQuery();
|
||||
|
||||
$q
|
||||
->addSelectClause('bada', ['one', 'two'])
|
||||
->addSelectClause('boum', ['three', 'four'])
|
||||
->setWhereClauses('mywhere', ['six', 'seven']);
|
||||
|
||||
$params = $q->buildParameters();
|
||||
|
||||
$this->assertEquals(['six', 'seven'], $q->buildParameters(true));
|
||||
$this->assertEquals(['one', 'two', 'three', 'four', 'six', 'seven'], $q->buildParameters());
|
||||
}
|
||||
|
||||
public function testMultipleWhereClauses()
|
||||
{
|
||||
$q = new SearchApiQuery();
|
||||
@@ -14,9 +41,8 @@ class SearchApiQueryTest extends TestCase
|
||||
->setSelectKey('bim')
|
||||
->setSelectPertinence('?', ['gamma'])
|
||||
->setFromClause('badaboum')
|
||||
->andWhereClause('foo', [ 'alpha' ])
|
||||
->andWhereClause('bar', [ 'beta' ])
|
||||
;
|
||||
->andWhereClause('foo', ['alpha'])
|
||||
->andWhereClause('bar', ['beta']);
|
||||
|
||||
$query = $q->buildQuery();
|
||||
|
||||
@@ -35,27 +61,9 @@ class SearchApiQueryTest extends TestCase
|
||||
$q->setSelectJsonbMetadata('boum')
|
||||
->setSelectKey('bim')
|
||||
->setSelectPertinence('1')
|
||||
->setFromClause('badaboum')
|
||||
;
|
||||
->setFromClause('badaboum');
|
||||
|
||||
$this->assertTrue(\is_string($q->buildQuery()));
|
||||
$this->assertTrue(is_string($q->buildQuery()));
|
||||
$this->assertEquals([], $q->buildParameters());
|
||||
}
|
||||
|
||||
public function testBuildParams()
|
||||
{
|
||||
$q = new SearchApiQuery();
|
||||
|
||||
$q
|
||||
->addSelectClause('bada', [ 'one', 'two' ])
|
||||
->addSelectClause('boum', ['three', 'four'])
|
||||
->setWhereClauses('mywhere', [ 'six', 'seven'])
|
||||
;
|
||||
|
||||
$params = $q->buildParameters();
|
||||
|
||||
$this->assertEquals(['six', 'seven'], $q->buildParameters(true));
|
||||
$this->assertEquals(['one', 'two', 'three', 'four', 'six', 'seven'], $q->buildParameters());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user