Skip to content

Commit

Permalink
Adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Nov 15, 2021
1 parent 01da1ec commit c14beee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Query/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@
use Elastica\Document;
use Elastica\Query\Common;
use Elastica\Test\Base as BaseTest;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

/**
* @internal
*/
class CommonTest extends BaseTest
{
use ExpectDeprecationTrait;

/**
* @group unit
* @group legacy
*/
public function testToArray(): void
{
$this->expectDeprecation('Since ruflin/elastica 7.1.3: The "Elastica\Query\Common" class is deprecated, use "Elastica\Query\MatchQuery" instead. It will be removed in 8.0.');

$query = new Common('body', 'test query', .001);
$query->setLowFrequencyOperator(Common::OPERATOR_AND);

Expand All @@ -34,6 +40,7 @@ public function testToArray(): void

/**
* @group functional
* @group legacy
*/
public function testQuery(): void
{
Expand Down Expand Up @@ -66,6 +73,7 @@ public function testQuery(): void

/**
* @group unit
* @group legacy
*/
public function testSetHighFrequencyOperator(): void
{
Expand All @@ -78,6 +86,7 @@ public function testSetHighFrequencyOperator(): void

/**
* @group unit
* @group legacy
*/
public function testSetBoost(): void
{
Expand All @@ -90,6 +99,7 @@ public function testSetBoost(): void

/**
* @group unit
* @group legacy
*/
public function testSetAnalyzer(): void
{
Expand Down
6 changes: 6 additions & 0 deletions tests/QueryBuilder/DSL/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
use Elastica\Query;
use Elastica\Query\MatchQuery;
use Elastica\QueryBuilder\DSL;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

/**
* @internal
*/
class QueryTest extends AbstractDSLTest
{
use ExpectDeprecationTrait;

/**
* @group unit
*/
Expand All @@ -36,13 +39,16 @@ public function testMatch(): void

/**
* @group unit
* @group legacy
*/
public function testInterface(): void
{
$queryDSL = new DSL\Query();

$this->_assertImplemented($queryDSL, 'bool', Query\BoolQuery::class, []);
$this->_assertImplemented($queryDSL, 'boosting', Query\Boosting::class, []);
$this->expectDeprecation('Since ruflin/elastica 7.1.3: The "Elastica\QueryBuilder\DSL\Query::common_terms()" method is deprecated, use "match()" instead. It will be removed in 8.0.');
$this->expectDeprecation('Since ruflin/elastica 7.1.3: The "Elastica\Query\Common" class is deprecated, use "Elastica\Query\MatchQuery" instead. It will be removed in 8.0.');
$this->_assertImplemented($queryDSL, 'common_terms', Query\Common::class, ['field', 'query', 0.001]);
$this->_assertImplemented($queryDSL, 'dis_max', Query\DisMax::class, []);
$this->_assertImplemented($queryDSL, 'distance_feature', Query\DistanceFeature::class, ['field', 'now', '7d']);
Expand Down

0 comments on commit c14beee

Please sign in to comment.