From 76790afb27b6584c385f18dd13d1fbc467ffa1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?= <simonas.serlinskas@nfq.com> Date: Tue, 30 Jun 2015 09:35:05 +0300 Subject: [PATCH] removed deprecated Bool class --- src/Bool/Bool.php | 38 ------------------- .../BoolFilterTest.php} | 22 +++++------ 2 files changed, 11 insertions(+), 49 deletions(-) delete mode 100644 src/Bool/Bool.php rename tests/{Bool/BoolTest.php => Filter/BoolFilterTest.php} (77%) diff --git a/src/Bool/Bool.php b/src/Bool/Bool.php deleted file mode 100644 index f652842..0000000 --- a/src/Bool/Bool.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/* - * This file is part of the ONGR package. - * - * (c) NFQ Technologies UAB <info@nfq.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace ONGR\ElasticsearchDSL\Bool; - -use ONGR\ElasticsearchDSL\BuilderInterface; -use ONGR\ElasticsearchDSL\Query\BoolQuery; - -/** - * Bool operator. Can be used for filters and queries. - * - * @deprecated Will be removed in 1.0. Use ONGR\ElasticsearchDSL\Query\BoolQuery. - */ -class Bool extends BoolQuery -{ - /** - * Add BuilderInterface object to bool operator. - * - * @param BuilderInterface $bool - * @param string $type - * - * @throws \UnexpectedValueException - * - * @deprecated Will be removed in 1.0. Use ONGR\ElasticsearchDSL\Query\BoolQuery::add(). - */ - public function addToBool(BuilderInterface $bool, $type = BoolQuery::MUST) - { - $this->add($bool, $type); - } -} diff --git a/tests/Bool/BoolTest.php b/tests/Filter/BoolFilterTest.php similarity index 77% rename from tests/Bool/BoolTest.php rename to tests/Filter/BoolFilterTest.php index 521cd7f..0c78e8e 100644 --- a/tests/Bool/BoolTest.php +++ b/tests/Filter/BoolFilterTest.php @@ -11,23 +11,23 @@ namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL\Aggregation; -use ONGR\ElasticsearchDSL\Bool\Bool; +use ONGR\ElasticsearchDSL\Filter\BoolFilter; use ONGR\ElasticsearchDSL\Filter\MissingFilter; use ONGR\ElasticsearchDSL\Filter\TermFilter; /** * Unit test for Bool. */ -class BoolTest extends \PHPUnit_Framework_TestCase +class BoolFilterTest extends \PHPUnit_Framework_TestCase { /** * Tests isRelevant method. */ public function testBoolIsRelevant() { - $bool = new Bool(); + $bool = new BoolFilter(); $this->assertFalse($bool->isRelevant()); - $bool->addToBool(new MissingFilter('test')); + $bool->add(new MissingFilter('test')); $this->assertTrue($bool->isRelevant()); } @@ -39,8 +39,8 @@ class BoolTest extends \PHPUnit_Framework_TestCase */ public function testBoolAddToBoolException() { - $bool = new Bool(); - $bool->addToBool(new MissingFilter('test'), 'Should'); + $bool = new BoolFilter(); + $bool->add(new MissingFilter('test'), 'Should'); } /** @@ -48,10 +48,10 @@ class BoolTest extends \PHPUnit_Framework_TestCase */ public function testBoolToArray() { - $bool = new Bool(); - $bool->addToBool(new TermFilter('key1', 'value1'), 'should'); - $bool->addToBool(new TermFilter('key2', 'value2'), 'must'); - $bool->addToBool(new TermFilter('key3', 'value3'), 'must_not'); + $bool = new BoolFilter(); + $bool->add(new TermFilter('key1', 'value1'), 'should'); + $bool->add(new TermFilter('key2', 'value2'), 'must'); + $bool->add(new TermFilter('key3', 'value3'), 'must_not'); $expected = [ 'should' => [ [ @@ -83,7 +83,7 @@ class BoolTest extends \PHPUnit_Framework_TestCase */ public function testBoolGetType() { - $bool = new Bool(); + $bool = new BoolFilter(); $result = $bool->getType(); $this->assertEquals('bool', $result); } -- GitLab