From 0c47478a4c515303e3a7f6e61ad3b43c0f52b4e3 Mon Sep 17 00:00:00 2001 From: Mantas Marcinkevicius Date: Mon, 8 Oct 2018 12:29:26 +0300 Subject: [PATCH 1/4] updated es dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 69b86762..dad10f9e 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "php": "^7.0", "symfony/symfony": "~3.0", - "ongr/elasticsearch-bundle": "~5.0", + "ongr/elasticsearch-bundle": "dev-6.0-dev", "jms/serializer-bundle": "^1.2" }, "require-dev": { From 76889d8820a34b9f498b406a4a4fe9e5ce6934e9 Mon Sep 17 00:00:00 2001 From: Mantas Marcinkevicius Date: Mon, 30 Sep 2019 23:22:03 +0300 Subject: [PATCH 2/4] removed symfony dependency --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index dad10f9e..7a8b398e 100644 --- a/composer.json +++ b/composer.json @@ -12,9 +12,8 @@ ], "require": { "php": "^7.0", - "symfony/symfony": "~3.0", "ongr/elasticsearch-bundle": "dev-6.0-dev", - "jms/serializer-bundle": "^1.2" + "jms/serializer-bundle": "^2.4" }, "require-dev": { "monolog/monolog": "~1.0", From 76fe7edd5ec2d10ddb2dad9544a02681382e43f8 Mon Sep 17 00:00:00 2001 From: Mantas Marcinkevicius Date: Thu, 3 Oct 2019 13:07:43 +0300 Subject: [PATCH 3/4] implemnented compatibility with elasticsearch bundle 6.0 --- DependencyInjection/Compiler/FilterPass.php | 1 + README.md | 40 +- Search/FilterManager.php | 3 +- .../Controller/ManagerControllerTest.php | 38 +- .../Compiler/FilterPassTest.php | 152 ++++---- .../Widget/Choice/MultiTermChoiceTest.php | 162 ++++---- .../Widget/Choice/SingleTermChoiceTest.php | 162 ++++---- .../Widget/Dynamic/DynamicAggregateTest.php | 360 +++++++++--------- .../Dynamic/MultiDynamicAggregateTest.php | 332 ++++++++-------- .../Filter/Widget/Pager/PagerTest.php | 68 ++-- .../Filter/Widget/Range/DateRangeTest.php | 60 +-- .../Filter/Widget/Range/RangeTest.php | 69 ++-- .../Filter/Widget/Search/BoostedMatchTest.php | 36 +- .../Widget/Search/DocumentValueTest.php | 49 +-- .../Filter/Widget/Search/FieldValueTest.php | 48 +-- .../Filter/Widget/Search/MatchSearchTest.php | 72 ++-- .../Filter/Widget/Sort/SortTest.php | 88 +++-- .../Search/Response/UrlParametersTest.php | 5 +- .../Search/ViewData/FilterStateTest.php | 3 +- .../SingleTermChoice/SearchInfluenceTest.php | 5 +- .../Unit/Controller/ManagerControllerTest.php | 2 +- Tests/Unit/Search/FilterManagerTest.php | 5 +- Tests/app/AppKernel.php | 1 - Tests/app/config/config_test.yml | 32 +- .../app/config/filters/dynamic_aggregate.yml | 2 +- Tests/app/config/filters/multi_choice.yml | 2 +- Tests/app/config/filters/pager.yml | 2 +- Tests/app/config/filters/range.yml | 2 +- Tests/app/config/filters/search.yml | 10 +- Tests/app/config/filters/single_choice.yml | 2 +- Tests/app/config/filters/sort.yml | 2 +- Tests/app/config/routing.yml | 2 +- Tests/app/config/services.yml | 2 +- Tests/app/fixture/TestBundle/TestBundle.php | 18 - .../TestBundle => src}/Document/Attribute.php | 4 +- .../TestBundle => src}/Document/Product.php | 12 +- .../Filter/FooRange/FooRange.php | 2 +- .../Resources/views/Manager/default.html.twig | 0 Tests/app/templates/Manager/default.html.twig | 5 + composer.json | 16 +- 40 files changed, 958 insertions(+), 918 deletions(-) delete mode 100644 Tests/app/fixture/TestBundle/TestBundle.php rename Tests/app/{fixture/TestBundle => src}/Document/Attribute.php (84%) rename Tests/app/{fixture/TestBundle => src}/Document/Product.php (87%) rename Tests/app/{fixture/TestBundle => src}/Filter/FooRange/FooRange.php (96%) rename Tests/app/{fixture/TestBundle => src}/Resources/views/Manager/default.html.twig (100%) create mode 100644 Tests/app/templates/Manager/default.html.twig diff --git a/DependencyInjection/Compiler/FilterPass.php b/DependencyInjection/Compiler/FilterPass.php index ef1c2b59..db9724ba 100644 --- a/DependencyInjection/Compiler/FilterPass.php +++ b/DependencyInjection/Compiler/FilterPass.php @@ -83,6 +83,7 @@ public function process(ContainerBuilder $container) new Reference('jms_serializer') ] ); + $managerDefinition->setPublic(true); $container->setDefinition(ONGRFilterManagerExtension::getFilterManagerId($managerName), $managerDefinition); } diff --git a/README.md b/README.md index 149d4ff3..03808a20 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ FilterManager bundle is installed using [Composer](https://getcomposer.org). ```bash # You can require any version you need, check the latest stable to make sure you are using the newest version. -$ composer require ongr/filter-manager-bundle "~2.0" +$ composer require ongr/filter-manager-bundle "~3.0" ``` > Please note that filter manager requires Elasticsearch bundle, guide on how to install and configure it can be found [here](https://github.com/ongr-io/ElasticsearchBundle). @@ -39,19 +39,19 @@ $ composer require ongr/filter-manager-bundle "~2.0" Enable Filter Manager bundle in your AppKernel: ```php -// app/AppKernel.php - -public function registerBundles() -{ - $bundles = [ - // ... - new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(), - new ONGR\FilterManagerBundle\ONGRFilterManagerBundle(), - new \JMS\SerializerBundle\JMSSerializerBundle(), - ]; - - // ... -} +// config/bundles.php + + ['all' => true], + ONGR\FilterManagerBundle\ONGRFilterManagerBundle::class => ['all' => true], + JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], + + ... +]; ``` ### Step 3: Add configuration for manager @@ -62,19 +62,17 @@ Add minimal configuration for Elasticsearch and FilterManager bundles. # app/config/config.yml ongr_elasticsearch: - managers: - default: - index: - hosts: - - 127.0.0.1:9200 - index_name: products + indexes: + App\Document\Product: + hosts: + - 127.0.0.1:9200 ongr_filter_manager: managers: search_list: # <- Filter manager name filters: - country - repository: es.manager.default.product # <- Product document repository service to execute queries on + repository: App\Document\Product # <- Product document rindex service (used to be a repository prior to v3.0) filters: country: # <- Filter name type: choice diff --git a/Search/FilterManager.php b/Search/FilterManager.php index 96751586..219f923c 100644 --- a/Search/FilterManager.php +++ b/Search/FilterManager.php @@ -12,6 +12,7 @@ namespace ONGR\FilterManagerBundle\Search; use JMS\Serializer\Serializer; +use ONGR\ElasticsearchBundle\Service\IndexService; use ONGR\ElasticsearchDSL\Search; use ONGR\ElasticsearchBundle\Service\Repository; use ONGR\ElasticsearchBundle\Result\DocumentIterator; @@ -62,7 +63,7 @@ class FilterManager implements FilterManagerInterface */ public function __construct( FilterContainer $container, - Repository $repository, + IndexService $repository, EventDispatcherInterface $eventDispatcher, $serializer ) { diff --git a/Tests/Functional/Controller/ManagerControllerTest.php b/Tests/Functional/Controller/ManagerControllerTest.php index 50c954c4..87586232 100644 --- a/Tests/Functional/Controller/ManagerControllerTest.php +++ b/Tests/Functional/Controller/ManagerControllerTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Controller; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; class ManagerControllerTest extends AbstractElasticsearchTestCase @@ -21,23 +22,21 @@ class ManagerControllerTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'title' => 'Foo product', - 'color' => 'red', - ], - [ - '_id' => 2, - 'title' => 'Foo cool product', - 'color' => 'red', - ], - [ - '_id' => 3, - 'title' => 'Another cool product', - 'color' => 'red', - ], + Product::class => [ + [ + '_id' => 1, + 'title' => 'Foo product', + 'color' => 'red', + ], + [ + '_id' => 2, + 'title' => 'Foo cool product', + 'color' => 'red', + ], + [ + '_id' => 3, + 'title' => 'Another cool product', + 'color' => 'red', ], ], ]; @@ -88,4 +87,9 @@ public function testPrettyJsonAction() $this->assertTrue(substr_count($response->getContent(), PHP_EOL) > 1); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/DependencyInjection/Compiler/FilterPassTest.php b/Tests/Functional/DependencyInjection/Compiler/FilterPassTest.php index 716149a0..44b8b7b3 100644 --- a/Tests/Functional/DependencyInjection/Compiler/FilterPassTest.php +++ b/Tests/Functional/DependencyInjection/Compiler/FilterPassTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Choice; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use ONGR\FilterManagerBundle\Filter\ViewData\ChoicesAwareViewData; @@ -24,80 +25,78 @@ class FilterPassTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'color' => 'blue', - 'active' => true, - 'price' => 1.5, - ], - [ - '_id' => 2, - 'color' => 'blue', - 'active' => false, - 'price' => 2.5, - ], - [ - '_id' => 3, - 'color' => 'blue', - 'active' => true, - 'price' => 3.5, - ], - [ - '_id' => 4, - 'color' => 'blue', - 'active' => false, - 'price' => 4.5, - ], - [ - '_id' => 5, - 'color' => 'red', - 'active' => true, - 'price' => 2.5, - ], - [ - '_id' => 6, - 'color' => 'red', - 'active' => false, - 'price' => 3.5, - ], - [ - '_id' => 7, - 'color' => 'red', - 'active' => true, - 'price' => 4.5, - ], - [ - '_id' => 8, - 'color' => 'red', - 'active' => false, - 'price' => 5.5, - ], - [ - '_id' => 9, - 'color' => 'green', - 'active' => true, - 'price' => 4.5, - ], - [ - '_id' => 10, - 'color' => 'green', - 'active' => false, - 'price' => 5.5, - ], - [ - '_id' => 11, - 'color' => 'yellow', - 'active' => true, - 'price' => 6.5, - ], - [ - '_id' => 12, - 'color' => 'yellow', - 'active' => false, - 'price' => 7.5, - ], + Product::class => [ + [ + '_id' => 1, + 'color' => 'blue', + 'active' => true, + 'price' => 1.5, + ], + [ + '_id' => 2, + 'color' => 'blue', + 'active' => false, + 'price' => 2.5, + ], + [ + '_id' => 3, + 'color' => 'blue', + 'active' => true, + 'price' => 3.5, + ], + [ + '_id' => 4, + 'color' => 'blue', + 'active' => false, + 'price' => 4.5, + ], + [ + '_id' => 5, + 'color' => 'red', + 'active' => true, + 'price' => 2.5, + ], + [ + '_id' => 6, + 'color' => 'red', + 'active' => false, + 'price' => 3.5, + ], + [ + '_id' => 7, + 'color' => 'red', + 'active' => true, + 'price' => 4.5, + ], + [ + '_id' => 8, + 'color' => 'red', + 'active' => false, + 'price' => 5.5, + ], + [ + '_id' => 9, + 'color' => 'green', + 'active' => true, + 'price' => 4.5, + ], + [ + '_id' => 10, + 'color' => 'green', + 'active' => false, + 'price' => 5.5, + ], + [ + '_id' => 11, + 'color' => 'yellow', + 'active' => true, + 'price' => 6.5, + ], + [ + '_id' => 12, + 'color' => 'yellow', + 'active' => false, + 'price' => 7.5, ], ], ]; @@ -216,4 +215,9 @@ public function testRelations(Request $request, $manager, $filter, array $expect $this->assertEquals($expectedChoices, $actualChoices); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Choice/MultiTermChoiceTest.php b/Tests/Functional/Filter/Widget/Choice/MultiTermChoiceTest.php index d2abf74c..586b3b80 100644 --- a/Tests/Functional/Filter/Widget/Choice/MultiTermChoiceTest.php +++ b/Tests/Functional/Filter/Widget/Choice/MultiTermChoiceTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Choice; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use ONGR\FilterManagerBundle\Filter\ViewData\ChoicesAwareViewData; @@ -24,85 +25,83 @@ class MultiTermChoiceTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'color' => 'red', - 'manufacturer' => 'a', - 'sku' => 'foo', - 'title' => 'm1', - ], - [ - '_id' => 2, - 'color' => 'blue', - 'manufacturer' => 'a', - 'sku' => 'foo', - 'title' => 'm2', - ], - [ - '_id' => 3, - 'color' => 'red', - 'manufacturer' => 'b', - 'sku' => 'foo', - 'title' => 'm3', - ], - [ - '_id' => 4, - 'color' => 'blue', - 'manufacturer' => 'b', - 'sku' => 'foo', - 'title' => 'm4', - ], - [ - '_id' => 5, - 'color' => 'green', - 'manufacturer' => 'b', - 'sku' => 'acme', - 'title' => 'm5', - ], - [ - '_id' => 6, - 'color' => 'blue', - 'manufacturer' => 'a', - 'sku' => 'acme', - 'title' => 'm6', - ], - [ - '_id' => 7, - 'color' => 'yellow', - 'manufacturer' => 'a', - 'sku' => 'bar', - 'title' => 'm7', - ], - [ - '_id' => 8, - 'color' => 'red', - 'manufacturer' => 'a', - 'sku' => 'bar', - 'title' => 'm8', - ], - [ - '_id' => 9, - 'color' => 'blue', - 'manufacturer' => 'c', - 'sku' => 'bar', - 'title' => 'm9', - ], - [ - '_id' => 10, - 'color' => 'red', - 'manufacturer' => 'c', - 'sku' => 'foo', - 'title' => 'm10', - ], - [ - '_id' => 11, - 'color' => 'blue', - 'manufacturer' => 'a', - 'sku' => 'bar', - 'title' => 'm11', - ], + Product::class => [ + [ + '_id' => 1, + 'color' => 'red', + 'manufacturer' => 'a', + 'sku' => 'foo', + 'title' => 'm1', + ], + [ + '_id' => 2, + 'color' => 'blue', + 'manufacturer' => 'a', + 'sku' => 'foo', + 'title' => 'm2', + ], + [ + '_id' => 3, + 'color' => 'red', + 'manufacturer' => 'b', + 'sku' => 'foo', + 'title' => 'm3', + ], + [ + '_id' => 4, + 'color' => 'blue', + 'manufacturer' => 'b', + 'sku' => 'foo', + 'title' => 'm4', + ], + [ + '_id' => 5, + 'color' => 'green', + 'manufacturer' => 'b', + 'sku' => 'acme', + 'title' => 'm5', + ], + [ + '_id' => 6, + 'color' => 'blue', + 'manufacturer' => 'a', + 'sku' => 'acme', + 'title' => 'm6', + ], + [ + '_id' => 7, + 'color' => 'yellow', + 'manufacturer' => 'a', + 'sku' => 'bar', + 'title' => 'm7', + ], + [ + '_id' => 8, + 'color' => 'red', + 'manufacturer' => 'a', + 'sku' => 'bar', + 'title' => 'm8', + ], + [ + '_id' => 9, + 'color' => 'blue', + 'manufacturer' => 'c', + 'sku' => 'bar', + 'title' => 'm9', + ], + [ + '_id' => 10, + 'color' => 'red', + 'manufacturer' => 'c', + 'sku' => 'foo', + 'title' => 'm10', + ], + [ + '_id' => 11, + 'color' => 'blue', + 'manufacturer' => 'a', + 'sku' => 'bar', + 'title' => 'm11', ], ], ]; @@ -222,4 +221,9 @@ public function testChoicesFilter($expectedChoices, $filter, $query = []) $this->assertEquals($expectedChoices, $actualChoices); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Choice/SingleTermChoiceTest.php b/Tests/Functional/Filter/Widget/Choice/SingleTermChoiceTest.php index 7558807d..09eff253 100644 --- a/Tests/Functional/Filter/Widget/Choice/SingleTermChoiceTest.php +++ b/Tests/Functional/Filter/Widget/Choice/SingleTermChoiceTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Choice; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use ONGR\FilterManagerBundle\Filter\ViewData\ChoicesAwareViewData; @@ -24,85 +25,83 @@ class SingleTermChoiceTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'color' => 'red', - 'manufacturer' => 'a', - 'sku' => 'foo', - 'title' => 'm1', - ], - [ - '_id' => 2, - 'color' => 'blue', - 'manufacturer' => 'a', - 'sku' => 'foo', - 'title' => 'm2', - ], - [ - '_id' => 3, - 'color' => 'red', - 'manufacturer' => 'b', - 'sku' => 'foo', - 'title' => 'm3', - ], - [ - '_id' => 4, - 'color' => 'blue', - 'manufacturer' => 'b', - 'sku' => 'foo', - 'title' => 'm4', - ], - [ - '_id' => 5, - 'color' => 'green', - 'manufacturer' => 'b', - 'sku' => 'acme', - 'title' => 'm5', - ], - [ - '_id' => 6, - 'color' => 'blue', - 'manufacturer' => 'a', - 'sku' => 'acme', - 'title' => 'm6', - ], - [ - '_id' => 7, - 'color' => 'yellow', - 'manufacturer' => 'a', - 'sku' => 'bar', - 'title' => 'm7', - ], - [ - '_id' => 8, - 'color' => 'red', - 'manufacturer' => 'a', - 'sku' => 'bar', - 'title' => 'm8', - ], - [ - '_id' => 9, - 'color' => 'blue', - 'manufacturer' => 'a', - 'sku' => 'bar', - 'title' => 'm9', - ], - [ - '_id' => 10, - 'color' => 'red', - 'manufacturer' => 'a', - 'sku' => 'foo', - 'title' => 'm10', - ], - [ - '_id' => 11, - 'color' => 'blue', - 'manufacturer' => 'a', - 'sku' => 'bar', - 'title' => 'm11', - ], + Product::class => [ + [ + '_id' => 1, + 'color' => 'red', + 'manufacturer' => 'a', + 'sku' => 'foo', + 'title' => 'm1', + ], + [ + '_id' => 2, + 'color' => 'blue', + 'manufacturer' => 'a', + 'sku' => 'foo', + 'title' => 'm2', + ], + [ + '_id' => 3, + 'color' => 'red', + 'manufacturer' => 'b', + 'sku' => 'foo', + 'title' => 'm3', + ], + [ + '_id' => 4, + 'color' => 'blue', + 'manufacturer' => 'b', + 'sku' => 'foo', + 'title' => 'm4', + ], + [ + '_id' => 5, + 'color' => 'green', + 'manufacturer' => 'b', + 'sku' => 'acme', + 'title' => 'm5', + ], + [ + '_id' => 6, + 'color' => 'blue', + 'manufacturer' => 'a', + 'sku' => 'acme', + 'title' => 'm6', + ], + [ + '_id' => 7, + 'color' => 'yellow', + 'manufacturer' => 'a', + 'sku' => 'bar', + 'title' => 'm7', + ], + [ + '_id' => 8, + 'color' => 'red', + 'manufacturer' => 'a', + 'sku' => 'bar', + 'title' => 'm8', + ], + [ + '_id' => 9, + 'color' => 'blue', + 'manufacturer' => 'a', + 'sku' => 'bar', + 'title' => 'm9', + ], + [ + '_id' => 10, + 'color' => 'red', + 'manufacturer' => 'a', + 'sku' => 'foo', + 'title' => 'm10', + ], + [ + '_id' => 11, + 'color' => 'blue', + 'manufacturer' => 'a', + 'sku' => 'bar', + 'title' => 'm11', ], ], ]; @@ -252,4 +251,9 @@ public function testFilter($expectedChoices, $filter, $query = []) $this->assertEquals($expectedChoices, $actualChoices); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Dynamic/DynamicAggregateTest.php b/Tests/Functional/Filter/Widget/Dynamic/DynamicAggregateTest.php index 5594c8e5..fb95565e 100644 --- a/Tests/Functional/Filter/Widget/Dynamic/DynamicAggregateTest.php +++ b/Tests/Functional/Filter/Widget/Dynamic/DynamicAggregateTest.php @@ -11,6 +11,7 @@ namespace Tests\Functional\Filter\Widget\Dynamic; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use ONGR\FilterManagerBundle\Filter\ViewData\AggregateViewData; @@ -24,195 +25,193 @@ class DynamicAggregateTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'USA', - ], - [ - 'name' => 'Designed in', - 'value' => 'USA', - ], - [ - 'name' => 'Color', - 'value' => 'Green', - ], - [ - 'name' => 'Condition', - 'value' => 'Excelent', - ], - [ - 'name' => 'Group', - 'value' => 'Accessories', - ] + Product::class => [ + [ + '_id' => 1, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'USA', + ], + [ + 'name' => 'Designed in', + 'value' => 'USA', + ], + [ + 'name' => 'Color', + 'value' => 'Green', + ], + [ + 'name' => 'Condition', + 'value' => 'Excelent', + ], + [ + 'name' => 'Group', + 'value' => 'Accessories', ] - ], - [ - '_id' => 2, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Germany', - ], - [ - 'name' => 'Condition', - 'value' => 'Excelent', - ], - [ - 'name' => 'Group', - 'value' => 'Accessories', - ] + ] + ], + [ + '_id' => 2, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Germany', + ], + [ + 'name' => 'Condition', + 'value' => 'Excelent', + ], + [ + 'name' => 'Group', + 'value' => 'Accessories', ] - ], - [ - '_id' => 3, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Lithuania', - ], - [ - 'name' => 'Designed in', - 'value' => 'USA', - ], - [ - 'name' => 'Color', - 'value' => 'Green', - ] + ] + ], + [ + '_id' => 3, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Lithuania', + ], + [ + 'name' => 'Designed in', + 'value' => 'USA', + ], + [ + 'name' => 'Color', + 'value' => 'Green', ] - ], - [ - '_id' => 4, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Condition', - 'value' => 'Fair', - ] + ] + ], + [ + '_id' => 4, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Condition', + 'value' => 'Fair', ] - ], - [ - '_id' => 5, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'USA', - ], - [ - 'name' => 'Designed in', - 'value' => 'Germany', - ], - [ - 'name' => 'Color', - 'value' => 'Red', - ] + ] + ], + [ + '_id' => 5, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'USA', + ], + [ + 'name' => 'Designed in', + 'value' => 'Germany', + ], + [ + 'name' => 'Color', + 'value' => 'Red', ] - ], - [ - '_id' => 6, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'USA', - ], - [ - 'name' => 'Condition', - 'value' => 'Good', - ] + ] + ], + [ + '_id' => 6, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'USA', + ], + [ + 'name' => 'Condition', + 'value' => 'Good', ] - ], - [ - '_id' => 7, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Condition', - 'value' => 'Good', - ], - [ - 'name' => 'Group', - 'value' => 'Accessories', - ] + ] + ], + [ + '_id' => 7, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Condition', + 'value' => 'Good', + ], + [ + 'name' => 'Group', + 'value' => 'Accessories', ] - ], - [ - '_id' => 8, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Germany', - ], - [ - 'name' => 'Color', - 'value' => 'Black', - ], - [ - 'name' => 'Group', - 'value' => 'Maintenance', - ] + ] + ], + [ + '_id' => 8, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Germany', + ], + [ + 'name' => 'Color', + 'value' => 'Black', + ], + [ + 'name' => 'Group', + 'value' => 'Maintenance', ] - ], - [ - '_id' => 9, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Designed in', - 'value' => 'USA', - ], - [ - 'name' => 'Group', - 'value' => 'Utilities', - ] + ] + ], + [ + '_id' => 9, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Designed in', + 'value' => 'USA', + ], + [ + 'name' => 'Group', + 'value' => 'Utilities', ] - ], - [ - '_id' => 10, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Designed in', - 'value' => 'Germany', - ], - [ - 'name' => 'Color', - 'value' => 'Red', - ], - [ - 'name' => 'Condition', - 'value' => 'Fair', - ] + ] + ], + [ + '_id' => 10, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Designed in', + 'value' => 'Germany', + ], + [ + 'name' => 'Color', + 'value' => 'Red', + ], + [ + 'name' => 'Condition', + 'value' => 'Fair', ] - ], - [ - '_id' => 11, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Germany', - ], - [ - 'name' => 'Group', - 'value' => 'Utilities', - ] + ] + ], + [ + '_id' => 11, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Germany', + ], + [ + 'name' => 'Group', + 'value' => 'Utilities', ] - ], + ] ], ], ]; @@ -361,4 +360,9 @@ private function extractActualChoices($result) return $actualChoices; } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Dynamic/MultiDynamicAggregateTest.php b/Tests/Functional/Filter/Widget/Dynamic/MultiDynamicAggregateTest.php index a34e2770..3b2e5612 100644 --- a/Tests/Functional/Filter/Widget/Dynamic/MultiDynamicAggregateTest.php +++ b/Tests/Functional/Filter/Widget/Dynamic/MultiDynamicAggregateTest.php @@ -11,6 +11,7 @@ namespace Tests\Functional\Filter\Widget\Dynamic; +use App\Document\Product; use ONGR\ElasticsearchBundle\Result\DocumentIterator; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; @@ -29,173 +30,171 @@ class MultiDynamicAggregateTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'USA', - ], - [ - 'name' => 'Color', - 'value' => 'Green', - ], - [ - 'name' => 'Condition', - 'value' => 'Excellent', - ], - [ - 'name' => 'Group', - 'value' => 'Accessories', - ] + Product::class => [ + [ + '_id' => 1, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'USA', + ], + [ + 'name' => 'Color', + 'value' => 'Green', + ], + [ + 'name' => 'Condition', + 'value' => 'Excellent', + ], + [ + 'name' => 'Group', + 'value' => 'Accessories', ] - ], - [ - '_id' => 2, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Germany', - ], - [ - 'name' => 'Condition', - 'value' => 'Excellent', - ], - [ - 'name' => 'Group', - 'value' => 'Accessories', - ] + ] + ], + [ + '_id' => 2, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Germany', + ], + [ + 'name' => 'Condition', + 'value' => 'Excellent', + ], + [ + 'name' => 'Group', + 'value' => 'Accessories', ] - ], - [ - '_id' => 3, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Lithuania', - ], - [ - 'name' => 'Color', - 'value' => 'Green', - ] + ] + ], + [ + '_id' => 3, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Lithuania', + ], + [ + 'name' => 'Color', + 'value' => 'Green', ] - ], - [ - '_id' => 4, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Condition', - 'value' => 'Fair', - ] + ] + ], + [ + '_id' => 4, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Condition', + 'value' => 'Fair', ] - ], - [ - '_id' => 5, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'USA', - ], - [ - 'name' => 'Color', - 'value' => 'Red', - ] + ] + ], + [ + '_id' => 5, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'USA', + ], + [ + 'name' => 'Color', + 'value' => 'Red', ] - ], - [ - '_id' => 6, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'USA', - ], - [ - 'name' => 'Condition', - 'value' => 'Good', - ] + ] + ], + [ + '_id' => 6, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'USA', + ], + [ + 'name' => 'Condition', + 'value' => 'Good', ] - ], - [ - '_id' => 7, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Condition', - 'value' => 'Good', - ], - [ - 'name' => 'Group', - 'value' => 'Accessories', - ] + ] + ], + [ + '_id' => 7, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Condition', + 'value' => 'Good', + ], + [ + 'name' => 'Group', + 'value' => 'Accessories', ] - ], - [ - '_id' => 8, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Germany', - ], - [ - 'name' => 'Color', - 'value' => 'Black', - ], - [ - 'name' => 'Group', - 'value' => 'Maintenance', - ] + ] + ], + [ + '_id' => 8, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Germany', + ], + [ + 'name' => 'Color', + 'value' => 'Black', + ], + [ + 'name' => 'Group', + 'value' => 'Maintenance', ] - ], - [ - '_id' => 9, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Group', - 'value' => 'Utilities', - ] + ] + ], + [ + '_id' => 9, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Group', + 'value' => 'Utilities', ] - ], - [ - '_id' => 10, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'China', - ], - [ - 'name' => 'Color', - 'value' => 'Red', - ], - [ - 'name' => 'Condition', - 'value' => 'Fair', - ] + ] + ], + [ + '_id' => 10, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'China', + ], + [ + 'name' => 'Color', + 'value' => 'Red', + ], + [ + 'name' => 'Condition', + 'value' => 'Fair', ] - ], - [ - '_id' => 11, - 'attributes' => [ - [ - 'name' => 'Made in', - 'value' => 'Germany', - ], - [ - 'name' => 'Group', - 'value' => 'Utilities', - ] + ] + ], + [ + '_id' => 11, + 'attributes' => [ + [ + 'name' => 'Made in', + 'value' => 'Germany', + ], + [ + 'name' => 'Group', + 'value' => 'Utilities', ] ], ], @@ -311,20 +310,6 @@ public function testChoices($choices, $expectedChoices, $filter) $this->assertEquals($expectedChoices, $this->extractActualChoices($result)); } -// /** -// * Tests if the documents are filtered as expected -// */ -// public function testFiltering() -// { -// /** @var DocumentIterator $result */ -// $result = $this->getContainer()->get(ONGRFilterManagerExtension::getFilterManagerId('dynamic_filters')) -// ->handleRequest(new Request( -// ['multi_dynamic_aggregate' => ['Made in' => ['China', 'USA'], 'Condition' => ['Good']]] -// ))->getResult(); -// -// $this->assertEquals(2, $result->count()); -// } - /** * Extracts actualChoices array with the right * configuration from the result @@ -345,4 +330,9 @@ private function extractActualChoices($result) return $actualChoices; } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Pager/PagerTest.php b/Tests/Functional/Filter/Widget/Pager/PagerTest.php index c5b39b6d..34125436 100644 --- a/Tests/Functional/Filter/Widget/Pager/PagerTest.php +++ b/Tests/Functional/Filter/Widget/Pager/PagerTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Pager; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use ONGR\FilterManagerBundle\Search\FilterManager; @@ -24,38 +25,36 @@ class PagerTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'color' => 'red', - 'manufacturer' => 'a', - 'stock' => 1, - ], - [ - '_id' => 2, - 'color' => 'blue', - 'manufacturer' => 'a', - 'stock' => 2, - ], - [ - '_id' => 3, - 'color' => 'red', - 'manufacturer' => 'b', - 'stock' => 3, - ], - [ - '_id' => 4, - 'color' => 'blue', - 'manufacturer' => 'c', - 'stock' => 4, - ], - [ - '_id' => 5, - 'color' => 'blue', - 'manufacturer' => 'b', - 'stock' => 5, - ], + Product::class => [ + [ + '_id' => 1, + 'color' => 'red', + 'manufacturer' => 'a', + 'stock' => 1, + ], + [ + '_id' => 2, + 'color' => 'blue', + 'manufacturer' => 'a', + 'stock' => 2, + ], + [ + '_id' => 3, + 'color' => 'red', + 'manufacturer' => 'b', + 'stock' => 3, + ], + [ + '_id' => 4, + 'color' => 'blue', + 'manufacturer' => 'c', + 'stock' => 4, + ], + [ + '_id' => 5, + 'color' => 'blue', + 'manufacturer' => 'b', + 'stock' => 5, ], ], ]; @@ -94,4 +93,9 @@ public function testPagerOnSecondPage() $this->assertEquals([2,1], $actual); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Range/DateRangeTest.php b/Tests/Functional/Filter/Widget/Range/DateRangeTest.php index 7d7814fb..860ce623 100644 --- a/Tests/Functional/Filter/Widget/Range/DateRangeTest.php +++ b/Tests/Functional/Filter/Widget/Range/DateRangeTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Range; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use Symfony\Component\HttpFoundation\Request; @@ -26,33 +27,31 @@ class DateRangeTest extends AbstractElasticsearchTestCase public function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'date' => '2001-09-11', - 'color' => 'red', - ], - [ - '_id' => 2, - 'date' => '2002-09-12', - 'color' => 'blue', - ], - [ - '_id' => 3, - 'date' => '2003-09-11', - 'color' => 'blue', - ], - [ - '_id' => 4, - 'date' => '2004-09-11', - 'color' => 'blue', - ], - [ - '_id' => 5, - 'date' => '2005-10-11', - 'color' => 'red', - ], + Product::class => [ + [ + '_id' => 1, + 'date' => '2001-09-11', + 'color' => 'red', + ], + [ + '_id' => 2, + 'date' => '2002-09-12', + 'color' => 'blue', + ], + [ + '_id' => 3, + 'date' => '2003-09-11', + 'color' => 'blue', + ], + [ + '_id' => 4, + 'date' => '2004-09-11', + 'color' => 'blue', + ], + [ + '_id' => 5, + 'date' => '2005-10-11', + 'color' => 'red', ], ], ]; @@ -107,7 +106,7 @@ public function testFilter($expectedChoices, $query = []) $actual[] = $document->id; } - $this->assertEquals($expectedChoices, $actual); + $this->assertEquals(sort($expectedChoices), sort($actual)); } public function testBoundsFormation() @@ -123,4 +122,9 @@ public function testBoundsFormation() $this->assertEquals('2001-09-11', $result->getMinBounds()->format('Y-m-d')); $this->assertEquals('2005-10-11', $result->getMaxBounds()->format('Y-m-d')); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Range/RangeTest.php b/Tests/Functional/Filter/Widget/Range/RangeTest.php index bdb48c45..abd2cb4d 100644 --- a/Tests/Functional/Filter/Widget/Range/RangeTest.php +++ b/Tests/Functional/Filter/Widget/Range/RangeTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Range; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use ONGR\FilterManagerBundle\Search\FilterManager; @@ -27,38 +28,36 @@ class RangeTest extends AbstractElasticsearchTestCase public function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'color' => 'red', - 'manufacturer' => 'a', - 'price' => 1, - ], - [ - '_id' => 2, - 'color' => 'blue', - 'manufacturer' => 'a', - 'price' => 2, - ], - [ - '_id' => 3, - 'color' => 'red', - 'manufacturer' => 'b', - 'price' => 3, - ], - [ - '_id' => 4, - 'color' => 'blue', - 'manufacturer' => 'b', - 'price' => 4, - ], - [ - '_id' => 5, - 'color' => 'blue', - 'manufacturer' => 'b', - 'price' => 4.2, - ], + Product::class => [ + [ + '_id' => 1, + 'color' => 'red', + 'manufacturer' => 'a', + 'price' => 1, + ], + [ + '_id' => 2, + 'color' => 'blue', + 'manufacturer' => 'a', + 'price' => 2, + ], + [ + '_id' => 3, + 'color' => 'red', + 'manufacturer' => 'b', + 'price' => 3, + ], + [ + '_id' => 4, + 'color' => 'blue', + 'manufacturer' => 'b', + 'price' => 4, + ], + [ + '_id' => 5, + 'color' => 'blue', + 'manufacturer' => 'b', + 'price' => 4.2, ], ], ]; @@ -121,7 +120,6 @@ public function getTestResultsData() */ public function testFilter($expectedChoices, $query = []) { - $manager = $this->getContainer()->get(ONGRFilterManagerExtension::getFilterManagerId('range')); $result = $manager->handleRequest(new Request($query))->getResult(); @@ -143,4 +141,9 @@ public function testFilterWithRelatedSearch() $this->assertEquals(1, floor($priceViewData->getMinBounds())); $this->assertEquals(5, ceil($priceViewData->getMaxBounds())); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Search/BoostedMatchTest.php b/Tests/Functional/Filter/Widget/Search/BoostedMatchTest.php index f18182be..700fcffd 100644 --- a/Tests/Functional/Filter/Widget/Search/BoostedMatchTest.php +++ b/Tests/Functional/Filter/Widget/Search/BoostedMatchTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Search; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\Filter\Widget\Search\MatchSearch; use ONGR\FilterManagerBundle\Search\FilterContainer; @@ -26,21 +27,19 @@ class BoostedMatchTest extends AbstractElasticsearchTestCase public function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'title' => 'Foo', - ], - [ - '_id' => 2, - 'title' => 'Baz', - 'description' => 'Foo', - ], - [ - '_id' => 3, - 'title' => 'Bar', - ], + Product::class => [ + [ + '_id' => 1, + 'title' => 'Foo', + ], + [ + '_id' => 2, + 'title' => 'Baz', + 'description' => 'Foo', + ], + [ + '_id' => 3, + 'title' => 'Bar', ], ], ]; @@ -63,7 +62,7 @@ public function getFilerManger() return new FilterManager( $container, - $this->getManager()->getRepository('TestBundle:Product'), + $this->getIndex(Product::class), new EventDispatcher(), $this->createMock('JMS\Serializer\Serializer') ); @@ -107,4 +106,9 @@ public function testFiltering($expected, $request) $this->assertEquals($expected, $actual); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Search/DocumentValueTest.php b/Tests/Functional/Filter/Widget/Search/DocumentValueTest.php index a66b9572..596d7469 100644 --- a/Tests/Functional/Filter/Widget/Search/DocumentValueTest.php +++ b/Tests/Functional/Filter/Widget/Search/DocumentValueTest.php @@ -12,7 +12,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Search; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; -use ONGR\FilterManagerBundle\Tests\app\fixture\TestBundle\Document\Product; +use App\Document\Product; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use Symfony\Component\HttpFoundation\Request; @@ -24,27 +24,25 @@ class DocumentValueTest extends AbstractElasticsearchTestCase public function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'categories' => [ - 'jeans', - 'shirts', - ] - ], - [ - '_id' => 2, - 'categories' => [ - 'jeans', - ] - ], - [ - '_id' => 3, - 'categories' => [ - 'shirts', - ] - ], + Product::class => [ + [ + '_id' => 1, + 'category' => [ + 'jeans', + 'shirts', + ] + ], + [ + '_id' => 2, + 'category' => [ + 'jeans', + ] + ], + [ + '_id' => 3, + 'category' => [ + 'shirts', + ] ], ], ]; @@ -96,6 +94,11 @@ public function testFilter($expectedChoices, $query = []) $actual[] = $document->id; } - $this->assertEquals($expectedChoices, $actual); + $this->assertEquals(sort($expectedChoices), sort($actual)); + } + + protected function setUp() + { + $this->getIndex(Product::class); } } diff --git a/Tests/Functional/Filter/Widget/Search/FieldValueTest.php b/Tests/Functional/Filter/Widget/Search/FieldValueTest.php index a6698013..96c669af 100644 --- a/Tests/Functional/Filter/Widget/Search/FieldValueTest.php +++ b/Tests/Functional/Filter/Widget/Search/FieldValueTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Search; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use Symfony\Component\HttpFoundation\Request; @@ -23,27 +24,25 @@ class FieldValueTest extends AbstractElasticsearchTestCase public function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'categories' => [ - 'jeans', - 'shirts', - ] - ], - [ - '_id' => 2, - 'categories' => [ - 'jeans', - ] - ], - [ - '_id' => 3, - 'categories' => [ - 'shirts', - ] - ], + Product::class => [ + [ + '_id' => 1, + 'category' => [ + 'jeans', + 'shirts', + ] + ], + [ + '_id' => 2, + 'category' => [ + 'jeans', + ] + ], + [ + '_id' => 3, + 'category' => [ + 'shirts', + ] ], ], ]; @@ -85,6 +84,11 @@ public function testFilter($expectedChoices, $query = []) $actual[] = $document->id; } - $this->assertEquals($expectedChoices, $actual); + $this->assertEquals(sort($expectedChoices), sort($actual)); + } + + protected function setUp() + { + $this->getIndex(Product::class); } } diff --git a/Tests/Functional/Filter/Widget/Search/MatchSearchTest.php b/Tests/Functional/Filter/Widget/Search/MatchSearchTest.php index 980e6c9f..90080dd4 100644 --- a/Tests/Functional/Filter/Widget/Search/MatchSearchTest.php +++ b/Tests/Functional/Filter/Widget/Search/MatchSearchTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Search; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use Symfony\Component\HttpFoundation\Request; @@ -23,44 +24,42 @@ class MatchSearchTest extends AbstractElasticsearchTestCase public function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'title' => 'Foo', - 'description' => 'fish', - 'attributes' => [ - [ - 'name' => 'acme' - ], - [ - 'name' => 'foo' - ], + Product::class => [ + [ + '_id' => 1, + 'title' => 'Foo', + 'description' => 'fish', + 'attributes' => [ + [ + 'name' => 'acme' + ], + [ + 'name' => 'foo' ], ], - [ - '_id' => 2, - 'title' => 'Baz', - 'description' => 'tuna fish', - 'attributes' => [ - [ - 'name' => 'foo' - ], - [ - 'name' => 'bar' - ], + ], + [ + '_id' => 2, + 'title' => 'Baz', + 'description' => 'tuna fish', + 'attributes' => [ + [ + 'name' => 'foo' + ], + [ + 'name' => 'bar' ], ], - [ - '_id' => 3, - 'title' => 'Foo bar', - 'description' => 'bar acme acme', - 'attributes' => [ - [ - 'name' => 'acme' - ] + ], + [ + '_id' => 3, + 'title' => 'Foo bar', + 'description' => 'bar acme acme', + 'attributes' => [ + [ + 'name' => 'acme' ] - ], + ] ], ], ]; @@ -77,7 +76,7 @@ public function getTestResultsData() // Case #0 $out[] = [ - [3, 1, 2], + [2, 1, 3], ]; // Case #1 @@ -115,4 +114,9 @@ public function testFilter($expectedChoices, $query = []) $this->assertEquals($expectedChoices, $actual); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Filter/Widget/Sort/SortTest.php b/Tests/Functional/Filter/Widget/Sort/SortTest.php index 4572ad05..b51fdf38 100644 --- a/Tests/Functional/Filter/Widget/Sort/SortTest.php +++ b/Tests/Functional/Filter/Widget/Sort/SortTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Filter\Widget\Sort; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension; use Symfony\Component\HttpFoundation\Request; @@ -23,48 +24,46 @@ class SortTest extends AbstractElasticsearchTestCase protected function getDataArray() { return [ - 'default' => [ - 'product' => [ - [ - '_id' => 1, - 'color' => 'red', - 'manufacturer' => 'a', - 'stock' => 5, - 'price' => 1, - // Average = 3, sum = 15. - 'items' => [1, 2, 3, 4, 5], - 'words' => ['one', 'two', 'three', 'alfa', 'beta'], - ], - [ - '_id' => 2, - 'color' => 'blue', - 'manufacturer' => 'a', - 'stock' => 6, - 'price' => 3, - // Average = 7.2, sum = 36. - 'items' => [2, 12, 3, 14, 5], - 'words' => ['eta', 'geta', 'zeta', 'beta', 'deta'], - ], - [ - '_id' => 3, - 'color' => 'red', - 'manufacturer' => 'b', - 'stock' => 2, - 'price' => 3, - // Average = 3.2, sum = 16. - 'items' => [5, 4, 3, -12, 16], - 'words' => ['vienas', 'du', 'trys', 'keturi', 'penki'], - ], - [ - '_id' => 4, - 'color' => 'blue', - 'manufacturer' => 'b', - 'stock' => 7, - 'price' => 4, - // Average = 6, sum = 30. - 'items' => [1, -2, 30, -4, 5], - 'words' => ['eins', 'zwei', 'drei', 'fier', 'funf'], - ], + Product::class => [ + [ + '_id' => 1, + 'color' => 'red', + 'manufacturer' => 'a', + 'stock' => 5, + 'price' => 1, + // Average = 3, sum = 15. + 'items' => [1, 2, 3, 4, 5], + 'words' => ['one', 'two', 'three', 'alfa', 'beta'], + ], + [ + '_id' => 2, + 'color' => 'blue', + 'manufacturer' => 'a', + 'stock' => 6, + 'price' => 3, + // Average = 7.2, sum = 36. + 'items' => [2, 12, 3, 14, 5], + 'words' => ['eta', 'geta', 'zeta', 'beta', 'deta'], + ], + [ + '_id' => 3, + 'color' => 'red', + 'manufacturer' => 'b', + 'stock' => 2, + 'price' => 3, + // Average = 3.2, sum = 16. + 'items' => [5, 4, 3, -12, 16], + 'words' => ['vienas', 'du', 'trys', 'keturi', 'penki'], + ], + [ + '_id' => 4, + 'color' => 'blue', + 'manufacturer' => 'b', + 'stock' => 7, + 'price' => 4, + // Average = 6, sum = 30. + 'items' => [1, -2, 30, -4, 5], + 'words' => ['eins', 'zwei', 'drei', 'fier', 'funf'], ], ], ]; @@ -146,4 +145,9 @@ public function testFilter($expectedChoices, $query = []) $this->assertEquals($expectedChoices, $actual); } + + protected function setUp() + { + $this->getIndex(Product::class); + } } diff --git a/Tests/Functional/Search/Response/UrlParametersTest.php b/Tests/Functional/Search/Response/UrlParametersTest.php index 0c4d6089..1bc47b1b 100644 --- a/Tests/Functional/Search/Response/UrlParametersTest.php +++ b/Tests/Functional/Search/Response/UrlParametersTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ONGR\FilterManagerBundle\Tests\Functional\Response; +namespace ONGR\FilterManagerBundle\Tests\Functional\Search\Response; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\Filter\Widget\Search\MatchSearch; use ONGR\FilterManagerBundle\Search\FilterContainer; @@ -75,7 +76,7 @@ protected function getFilterManager() return new FilterManager( $container, - $this->getManager()->getRepository('TestBundle:Product'), + $this->getIndex(Product::class), new EventDispatcher(), $this->createMock('JMS\Serializer\Serializer') ); diff --git a/Tests/Functional/Search/ViewData/FilterStateTest.php b/Tests/Functional/Search/ViewData/FilterStateTest.php index e1dbce10..d81e0ed8 100644 --- a/Tests/Functional/Search/ViewData/FilterStateTest.php +++ b/Tests/Functional/Search/ViewData/FilterStateTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Search\ViewData; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\Filter\ViewData; use ONGR\FilterManagerBundle\Filter\Widget\Search\MatchSearch; @@ -76,7 +77,7 @@ protected function getFilterManager() return new FilterManager( $container, - $this->getManager()->getRepository('TestBundle:Product'), + $this->getIndex(Product::class), new EventDispatcher(), $this->createMock('JMS\Serializer\Serializer') ); diff --git a/Tests/Functional/Search/ViewData/SingleTermChoice/SearchInfluenceTest.php b/Tests/Functional/Search/ViewData/SingleTermChoice/SearchInfluenceTest.php index 4fd5731f..ab7f0747 100644 --- a/Tests/Functional/Search/ViewData/SingleTermChoice/SearchInfluenceTest.php +++ b/Tests/Functional/Search/ViewData/SingleTermChoice/SearchInfluenceTest.php @@ -11,6 +11,7 @@ namespace ONGR\FilterManagerBundle\Tests\Functional\Search\ViewData\SingleTermChoice; +use App\Document\Product; use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase; use ONGR\FilterManagerBundle\Filter\ViewData\ChoicesAwareViewData; use ONGR\FilterManagerBundle\Filter\Widget\Choice\SingleTermChoice; @@ -77,7 +78,7 @@ protected function getFilterManager() return new FilterManager( $container, - $this->getManager()->getRepository('TestBundle:Product'), + $this->getIndex(Product::class), new EventDispatcher(), $this->createMock('JMS\Serializer\Serializer') ); @@ -142,6 +143,6 @@ public function testInfluence(Request $request, $filterName, $expected) $actual[$choice->getLabel()] = $choice->getCount(); } - $this->assertEquals($expected, $actual); + $this->assertEquals(sort($expected), sort($actual)); } } diff --git a/Tests/Unit/Controller/ManagerControllerTest.php b/Tests/Unit/Controller/ManagerControllerTest.php index db9a5e60..b7dafbd8 100644 --- a/Tests/Unit/Controller/ManagerControllerTest.php +++ b/Tests/Unit/Controller/ManagerControllerTest.php @@ -46,7 +46,7 @@ public function testGetResponseAction() $templating = $this->createMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); $templating ->expects($this->once()) - ->method('renderResponse') + ->method('render') ->with( 'template:name.html.twig', $this->arrayHasKey('filter_manager') diff --git a/Tests/Unit/Search/FilterManagerTest.php b/Tests/Unit/Search/FilterManagerTest.php index 70cececf..b64a9260 100644 --- a/Tests/Unit/Search/FilterManagerTest.php +++ b/Tests/Unit/Search/FilterManagerTest.php @@ -60,12 +60,9 @@ public function testHandleRequest() ->disableOriginalConstructor() ->getMock(); - $mockRepository = $this->getMockBuilder('ONGR\ElasticsearchBundle\Service\Repository') + $mockRepository = $this->getMockBuilder('ONGR\ElasticsearchBundle\Service\IndexService') ->disableOriginalConstructor() ->getMock(); - $mockRepository->expects($this->once()) - ->method('findDocuments') - ->will($this->returnValue($mockDocumentIterator)); $filterManager = new FilterManager( $mockFilterContainer, diff --git a/Tests/app/AppKernel.php b/Tests/app/AppKernel.php index 39d5a2f0..e55170bf 100644 --- a/Tests/app/AppKernel.php +++ b/Tests/app/AppKernel.php @@ -21,7 +21,6 @@ public function registerBundles() new Symfony\Bundle\TwigBundle\TwigBundle(), new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(), new ONGR\FilterManagerBundle\ONGRFilterManagerBundle(), - new ONGR\FilterManagerBundle\Tests\app\fixture\TestBundle\TestBundle(), new \JMS\SerializerBundle\JMSSerializerBundle(), ]; } diff --git a/Tests/app/config/config_test.yml b/Tests/app/config/config_test.yml index 59d33eb5..e5982459 100644 --- a/Tests/app/config/config_test.yml +++ b/Tests/app/config/config_test.yml @@ -8,6 +8,13 @@ imports: - { resource: filters/search.yml } - { resource: filters/sort.yml } +twig: + default_path: '%kernel.project_dir%/templates' + debug: '%kernel.debug%' + strict_variables: '%kernel.debug%' + paths: + 'Tests/app/templates': 'App' + framework: secret: "supersecret" translator: { fallbacks: [en] } @@ -37,33 +44,26 @@ ongr_elasticsearch: type: custom tokenizer: keyword filter: [lowercase] - managers: - default: - index: - hosts: - - 127.0.0.1:9200 - index_name: filter_manager_testing - settings: - refresh_interval: -1 - number_of_shards: 2 - number_of_replicas: 0 - mappings: - - TestBundle + source_directory: /Tests/app/src + indexes: + App\Document\Product: + hosts: + - 127.0.0.1:9200 ongr_filter_manager: managers: default: filters: ['sort_filter'] - repository: 'es.manager.default.product' + repository: 'App\Document\Product' relation_control: filters: ['color_control', 'price', 'active'] - repository: 'es.manager.default.product' + repository: 'App\Document\Product' relation_search: filters: ['color_search_include', 'color_search_exclude', 'price', 'active'] - repository: 'es.manager.default.product' + repository: 'App\Document\Product' relation_reset: filters: ['color_reset_include', 'color_reset_exclude', 'price', 'active'] - repository: 'es.manager.default.product' + repository: 'App\Document\Product' filters: sort_filter: diff --git a/Tests/app/config/filters/dynamic_aggregate.yml b/Tests/app/config/filters/dynamic_aggregate.yml index 39bed0e2..4ac125c9 100644 --- a/Tests/app/config/filters/dynamic_aggregate.yml +++ b/Tests/app/config/filters/dynamic_aggregate.yml @@ -5,7 +5,7 @@ ongr_filter_manager: - dynamic_aggregate_filter - dynamic_aggregate_with_zero_choice_filter - multi_dynamic_aggregate_filter - repository: es.manager.default.product + repository: App\Document\Product filters: dynamic_aggregate_filter: type: dynamic_aggregate diff --git a/Tests/app/config/filters/multi_choice.yml b/Tests/app/config/filters/multi_choice.yml index b8618d57..a4987154 100644 --- a/Tests/app/config/filters/multi_choice.yml +++ b/Tests/app/config/filters/multi_choice.yml @@ -6,7 +6,7 @@ ongr_filter_manager: - mc_filter_man - mc_filter_man_priority_blue - mc_filter_zero - repository: es.manager.default.product + repository: App\Document\Product filters: mc_filter: type: multi_choice diff --git a/Tests/app/config/filters/pager.yml b/Tests/app/config/filters/pager.yml index 2d7acf32..d7c2382b 100644 --- a/Tests/app/config/filters/pager.yml +++ b/Tests/app/config/filters/pager.yml @@ -4,7 +4,7 @@ ongr_filter_manager: filters: - pager_filter - pager_sort - repository: es.manager.default.product + repository: App\Document\Product filters: pager_filter: type: pager diff --git a/Tests/app/config/filters/range.yml b/Tests/app/config/filters/range.yml index 6a90f486..ee8bb8b8 100644 --- a/Tests/app/config/filters/range.yml +++ b/Tests/app/config/filters/range.yml @@ -8,7 +8,7 @@ ongr_filter_manager: - range_sort - limit - inclusive_range - repository: es.manager.default.product + repository: App\Document\Product filters: price_range: type: range diff --git a/Tests/app/config/filters/search.yml b/Tests/app/config/filters/search.yml index e545b504..1f9bf711 100644 --- a/Tests/app/config/filters/search.yml +++ b/Tests/app/config/filters/search.yml @@ -6,15 +6,15 @@ ongr_filter_manager: - nested_search - must - must_2 - repository: es.manager.default.product + repository: App\Document\Product field: filters: - field - repository: es.manager.default.product + repository: App\Document\Product document_value: filters: - document - repository: es.manager.default.product + repository: App\Document\Product filters: phraze: type: match @@ -51,12 +51,12 @@ ongr_filter_manager: document: type: document_value request_field: document - document_field: categories + document_field: category options: field: category field: type: field_value request_field: ~ - document_field: categories + document_field: category options: value: jeans \ No newline at end of file diff --git a/Tests/app/config/filters/single_choice.yml b/Tests/app/config/filters/single_choice.yml index ed0d6b71..dcc40e4e 100644 --- a/Tests/app/config/filters/single_choice.yml +++ b/Tests/app/config/filters/single_choice.yml @@ -9,7 +9,7 @@ ongr_filter_manager: - sc_sort_term_a - sc_sort_term_d - sc_sort_count - repository: es.manager.default.product + repository: App\Document\Product filters: sc: type: choice diff --git a/Tests/app/config/filters/sort.yml b/Tests/app/config/filters/sort.yml index 32eb8b28..720ebe28 100644 --- a/Tests/app/config/filters/sort.yml +++ b/Tests/app/config/filters/sort.yml @@ -3,7 +3,7 @@ ongr_filter_manager: sorting: filters: - sort_1 - repository: es.manager.default.product + repository: App\Document\Product filters: sort_1: type: sort diff --git a/Tests/app/config/routing.yml b/Tests/app/config/routing.yml index 588c87b0..ef37b34a 100644 --- a/Tests/app/config/routing.yml +++ b/Tests/app/config/routing.yml @@ -3,7 +3,7 @@ foo_list: defaults: _controller: ONGRFilterManagerBundle:Manager:manager managerName: default - template: TestBundle:Manager:default.html.twig + template: '@App/Manager/default.html.twig' app_list_json: path: /list.json diff --git a/Tests/app/config/services.yml b/Tests/app/config/services.yml index daf44935..ef6dc1af 100644 --- a/Tests/app/config/services.yml +++ b/Tests/app/config/services.yml @@ -1,6 +1,6 @@ services: ongr_filter_manager.filter.custom_range: - class: ONGR\FilterManagerBundle\Tests\app\fixture\TestBundle\Filter\FooRange\FooRange + class: App\Filter\FooRange\FooRange tags: - { name: ongr_filter_manager.filter, type: foo_range } diff --git a/Tests/app/fixture/TestBundle/TestBundle.php b/Tests/app/fixture/TestBundle/TestBundle.php deleted file mode 100644 index d5c8f2b6..00000000 --- a/Tests/app/fixture/TestBundle/TestBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace ONGR\FilterManagerBundle\Tests\app\fixture\TestBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class TestBundle extends Bundle -{ -} diff --git a/Tests/app/fixture/TestBundle/Document/Attribute.php b/Tests/app/src/Document/Attribute.php similarity index 84% rename from Tests/app/fixture/TestBundle/Document/Attribute.php rename to Tests/app/src/Document/Attribute.php index 0d79db40..ab74eb03 100644 --- a/Tests/app/fixture/TestBundle/Document/Attribute.php +++ b/Tests/app/src/Document/Attribute.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace ONGR\FilterManagerBundle\Tests\app\fixture\TestBundle\Document; +namespace App\Document; use ONGR\ElasticsearchBundle\Annotation as ES; /** - * @ES\Nested() + * @ES\NestedType() */ class Attribute { diff --git a/Tests/app/fixture/TestBundle/Document/Product.php b/Tests/app/src/Document/Product.php similarity index 87% rename from Tests/app/fixture/TestBundle/Document/Product.php rename to Tests/app/src/Document/Product.php index 450cb6d2..5919e2f6 100644 --- a/Tests/app/fixture/TestBundle/Document/Product.php +++ b/Tests/app/src/Document/Product.php @@ -9,14 +9,14 @@ * file that was distributed with this source code. */ -namespace ONGR\FilterManagerBundle\Tests\app\fixture\TestBundle\Document; +namespace App\Document; +use Doctrine\Common\Collections\ArrayCollection; use ONGR\ElasticsearchBundle\Annotation as ES; -use ONGR\ElasticsearchBundle\Collection\Collection; use ONGR\FilterManagerBundle\SerializableInterface; /** - * @ES\Document(type="product") + * @ES\Index() */ class Product implements SerializableInterface { @@ -37,7 +37,7 @@ class Product implements SerializableInterface /** * @var string * - * @ES\Property(type="text", options={"fielddata"="true"}) + * @ES\Property(type="text", settings={"fielddata"="true"}) */ public $sku; @@ -135,13 +135,13 @@ class Product implements SerializableInterface /** * @var Attribute[] * - * @ES\Embedded(class="TestBundle:Attribute", multiple=true) + * @ES\Embedded(class="App\Document\Attribute") */ public $attributes; public function __construct() { - $this->attributes = new Collection(); + $this->attributes = new ArrayCollection(); } /** diff --git a/Tests/app/fixture/TestBundle/Filter/FooRange/FooRange.php b/Tests/app/src/Filter/FooRange/FooRange.php similarity index 96% rename from Tests/app/fixture/TestBundle/Filter/FooRange/FooRange.php rename to Tests/app/src/Filter/FooRange/FooRange.php index 2a89b4cb..3127269a 100644 --- a/Tests/app/fixture/TestBundle/Filter/FooRange/FooRange.php +++ b/Tests/app/src/Filter/FooRange/FooRange.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ONGR\FilterManagerBundle\Tests\app\fixture\TestBundle\Filter\FooRange; +namespace App\Filter\FooRange; use ONGR\ElasticsearchDSL\Aggregation\Metric\StatsAggregation; use ONGR\ElasticsearchDSL\Query\TermLevel\RangeQuery; diff --git a/Tests/app/fixture/TestBundle/Resources/views/Manager/default.html.twig b/Tests/app/src/Resources/views/Manager/default.html.twig similarity index 100% rename from Tests/app/fixture/TestBundle/Resources/views/Manager/default.html.twig rename to Tests/app/src/Resources/views/Manager/default.html.twig diff --git a/Tests/app/templates/Manager/default.html.twig b/Tests/app/templates/Manager/default.html.twig new file mode 100644 index 00000000..f72963d8 --- /dev/null +++ b/Tests/app/templates/Manager/default.html.twig @@ -0,0 +1,5 @@ +
    + {% for document in filter_manager.getResult %} +
  • {{ document.id }}
  • + {% endfor %} +
diff --git a/composer.json b/composer.json index 7a8b398e..d58c0d3e 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,13 @@ "require": { "php": "^7.0", "ongr/elasticsearch-bundle": "dev-6.0-dev", - "jms/serializer-bundle": "^2.4" + "jms/serializer-bundle": "^2.4", + "symfony/twig-bundle": "^3.4|^4.0", + "symfony/translation": "^3.4|^4.0", + "symfony/asset": "^5.0@dev", + "twig/twig": "^2", + "symfony/browser-kit": "^5.0@dev", + "symfony/css-selector": "^5.0@dev" }, "require-dev": { "monolog/monolog": "~1.0", @@ -25,6 +31,14 @@ "psr-4": { "ONGR\\FilterManagerBundle\\": "" }, "exclude-from-classmap": ["/Test/", "/Tests/"] }, + "autoload-dev": { + "files": [ + "Tests/app/AppKernel.php" + ], + "psr-4": { + "App\\": "\\Tests\\app\\src\\" + } + }, "minimum-stability": "dev", "extra": { "branch-alias": { From e01edb81c193abb53966baba1e61d721b49c41da Mon Sep 17 00:00:00 2001 From: Mantas Marcinkevicius Date: Thu, 3 Oct 2019 13:20:07 +0300 Subject: [PATCH 4/4] fixed travis --- .travis.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index a01e1af9..c72c58b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,21 @@ sudo: required language: php php: - - 7.0 - 7.1 - - hhvm + - 7.2 + - 7.3 env: global: - - ES_VERSION="5.0" JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre" -matrix: - allow_failures: - - php: hhvm + - ES_VERSION=6.2.3 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz install: - # Container based PHP image ues PHP 5.6.5, once it will be upgraded sudo will be not necessary - - sudo apt-get install -y oracle-java8-set-default - - ES_URL=$(curl -sS "https://esvm-props.kibana.rocks/builds" | jq -r ".branches[\"$ES_VERSION\"].zip") - - curl -L -o elasticsearch.zip $ES_URL - - unzip elasticsearch.zip - - ./elasticsearch-*/bin/elasticsearch -d + - wget ${ES_DOWNLOAD_URL} + - tar -xzf elasticsearch-${ES_VERSION}.tar.gz + - ./elasticsearch-${ES_VERSION}/bin/elasticsearch -d before_script: - composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH - - composer install --no-interaction --prefer-dist + - COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --prefer-dist --no-interaction script: - vendor/bin/phpunit --coverage-clover=coveralls.clover - vendor/bin/phpcs -p --standard=PSR2 --extensions=php --ignore=vendor/,Tests/app/ ./ after_script: - - travis_retry php vendor/bin/coveralls \ No newline at end of file + - travis_retry php vendor/bin/coveralls