diff --git a/tests/QueryTest.php b/tests/QueryTest.php index 79ed0e7b..67cc3a08 100644 --- a/tests/QueryTest.php +++ b/tests/QueryTest.php @@ -458,8 +458,6 @@ public function testFacets() { $connection = $this->getConnection(); - $sphinxVersion = $connection->createCommand("SHOW GLOBAL VARIABLES LIKE 'version'")->queryOne()['Value']; -var_dump($sphinxVersion); $query = new Query(); $results = $query->from('yii2_test_article_index') ->match('about') @@ -486,22 +484,24 @@ public function testFacets() ->from('yii2_test_article_index') ->match('about'); - if (strpos($sphinxVersion, '2.') === 0) { + try { + // Sphinx ^3 $query = $query + ->select(new Expression('INTERVAL(author_id,200,400,600,800) AS range')) ->facets([ 'range' => [ - 'select' => 'INTERVAL(author_id,200,400,600,800) AS range', + 'select' => 'range', ], 'authorId' => [ 'select' => [new Expression('author_id AS authorId')], ], ]); - } else { + } catch (\PDOException $e) { + // Sphinx ^2 $query = $query - ->select(new Expression('INTERVAL(author_id,200,400,600,800) AS range')) ->facets([ 'range' => [ - 'select' => 'range', + 'select' => 'INTERVAL(author_id,200,400,600,800) AS range', ], 'authorId' => [ 'select' => [new Expression('author_id AS authorId')],