From 6edab656c86c1ba27b2cfdf54215f28e348aaa6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?=
 <saimaz@users.noreply.github.com>
Date: Fri, 11 Nov 2016 11:29:27 +0200
Subject: [PATCH] Functional tests (#166)

* Moved all tests to Unit folder

* updated travis to install elasticsearch

* updated composer to install elasticsearch

* updated namespace in unit tests

* added funtional tests

* fix match all query composing

When there are no parameters it has to return \stdClass.

(cherry picked from commit 5970e92)

* updated unit test for match all query

* constants can only have underscore dash

* fixed psr style issues

* updated travis

* exclude not compatible versions
---
 .travis.yml                                   |  22 ++-
 composer.json                                 |   3 +-
 src/Query/MatchAllQuery.php                   |   3 +-
 .../AbstractElasticsearchTestCase.php         | 152 ++++++++++++++++++
 tests/Functional/Query/MatchAllQueryTest.php  |  51 ++++++
 .../CardinalityAggregationTest.php            |   2 +-
 .../Aggregation/ChildrenAggregationTest.php   |   2 +-
 .../DateHistogramAggregationTest.php          |   2 +-
 .../Aggregation/DateRangeAggregationTest.php  |   2 +-
 .../Aggregation/FilterAggregationTest.php     |   2 +-
 .../Aggregation/FiltersAggregationTest.php    |   2 +-
 .../Aggregation/GeoBoundsAggregationTest.php  |   2 +-
 .../GeoCentroidAggregationTest.php            |   2 +-
 .../GeoDistanceAggregationTest.php            |   2 +-
 .../GeoHashGridAggregationTest.php            |   2 +-
 .../Aggregation/GlobalAggregationTest.php     |   2 +-
 .../Aggregation/Ipv4RangeAggregationTest.php  |   2 +-
 .../Aggregation/MissingAggregationTest.php    |   2 +-
 .../Aggregation/NestedAggregationTest.php     |   2 +-
 .../PercentileRanksAggregationTest.php        |   2 +-
 .../PercentilesAggregationTest.php            |   2 +-
 .../Pipeline/AvgBucketAggregationTest.php     |   2 +-
 .../Pipeline/BucketScriptAggregationTest.php  |   2 +-
 .../BucketSelectorAggregationTest.php         |   2 +-
 .../Pipeline/CumulativeSumAggregationTest.php |   2 +-
 .../Pipeline/DerivativeAggregationTest.php    |   2 +-
 .../ExtendedStatsBucketAggregationTest.php    |   2 +-
 .../Pipeline/MaxBucketAggregationTest.php     |   2 +-
 .../Pipeline/MinBucketAggregationTest.php     |   2 +-
 .../PercentilesBucketAggregationTest.php      |   2 +-
 .../SerialDifferencingAggregationTest.php     |   2 +-
 .../Pipeline/StatsBucketAggregationTest.php   |   2 +-
 .../Pipeline/SumBucketAggregationTest.php     |   2 +-
 .../Aggregation/RangeAggregationTest.php      |   2 +-
 .../ReverseNestedAggregationTest.php          |   2 +-
 .../Aggregation/SamplerAggregationTest.php    |   2 +-
 .../SignificantTermsAggregationTest.php       |   2 +-
 .../Aggregation/StatsAggregationTest.php      |   2 +-
 .../Aggregation/TermsAggregationTest.php      |   2 +-
 .../Aggregation/TopHitsAggregationTest.php    |   2 +-
 tests/{ => Unit}/BuilderBagTest.php           |   2 +-
 tests/{ => Unit}/Highlight/HighlightTest.php  |   2 +-
 .../InnerHit/NestedInnerHitTest.php           |   2 +-
 .../InnerHit/ParentInnerHitTest.php           |   2 +-
 tests/{ => Unit}/Integration/SearchTest.php   |   2 +-
 tests/{ => Unit}/ParametersTraitTest.php      |   2 +-
 tests/{ => Unit}/Query/BoolQueryTest.php      |   2 +-
 tests/{ => Unit}/Query/BoostingQueryTest.php  |   2 +-
 .../{ => Unit}/Query/CommonTermsQueryTest.php |   2 +-
 .../Query/ConstantScoreQueryTest.php          |   2 +-
 tests/{ => Unit}/Query/DisMaxQueryTest.php    |   2 +-
 tests/{ => Unit}/Query/ExistsQueryTest.php    |   2 +-
 .../Query/FunctionScoreQueryTest.php          |   2 +-
 tests/{ => Unit}/Query/FuzzyQueryTest.php     |   2 +-
 .../Query/GeoBoundingBoxQueryTest.php         |   2 +-
 .../{ => Unit}/Query/GeoDistanceQueryTest.php |   2 +-
 .../Query/GeoDistanceRangeQueryTest.php       |   2 +-
 .../{ => Unit}/Query/GeoPolygonQueryTest.php  |   2 +-
 tests/{ => Unit}/Query/GeoShapeQueryTest.php  |   2 +-
 .../{ => Unit}/Query/GeohashCellQueryTest.php |   2 +-
 tests/{ => Unit}/Query/HasChildQueryTest.php  |   2 +-
 tests/{ => Unit}/Query/HasParentQueryTest.php |   2 +-
 tests/{ => Unit}/Query/IdsQueryTest.php       |   2 +-
 tests/{ => Unit}/Query/IndicesQueryTest.php   |   2 +-
 tests/{ => Unit}/Query/LimitQueryTest.php     |   2 +-
 tests/{ => Unit}/Query/MatchAllQueryTest.php  |  16 +-
 .../Query/MatchPhrasePrefixQueryTest.php      |   2 +-
 .../{ => Unit}/Query/MatchPhraseQueryTest.php |   2 +-
 tests/{ => Unit}/Query/MatchQueryTest.php     |   2 +-
 tests/{ => Unit}/Query/MissingQueryTest.php   |   2 +-
 .../Query/MoreLikeThisQueryTest.php           |   2 +-
 .../{ => Unit}/Query/MultiMatchQueryTest.php  |   2 +-
 tests/{ => Unit}/Query/NestedQueryTest.php    |   2 +-
 tests/{ => Unit}/Query/PrefixQueryTest.php    |   2 +-
 .../{ => Unit}/Query/QueryStringQueryTest.php |   2 +-
 tests/{ => Unit}/Query/RangeQueryTest.php     |   2 +-
 tests/{ => Unit}/Query/RegexpQueryTest.php    |   2 +-
 tests/{ => Unit}/Query/ScriptQueryTest.php    |   2 +-
 .../Query/SimpleQueryStringQueryTest.php      |   2 +-
 .../Query/Span/SpanContainingQueryTest.php    |   2 +-
 .../Query/Span/SpanFirstQueryTest.php         |   2 +-
 .../Query/Span/SpanMultiTermQueryTest.php     |   2 +-
 .../Query/Span/SpanNearQueryTest.php          |   2 +-
 .../Query/Span/SpanNotQueryTest.php           |   2 +-
 .../{ => Unit}/Query/Span/SpanOrQueryTest.php |   2 +-
 .../Query/Span/SpanTermQueryTest.php          |   2 +-
 .../Query/Span/SpanWithinQueryTest.php        |   2 +-
 tests/{ => Unit}/Query/TemplateQueryTest.php  |   2 +-
 tests/{ => Unit}/Query/TermQueryTest.php      |   2 +-
 tests/{ => Unit}/Query/TermsQueryTest.php     |   2 +-
 tests/{ => Unit}/Query/TypeQueryTest.php      |   2 +-
 tests/{ => Unit}/Query/WildcardQueryTest.php  |   2 +-
 .../AggregationsEndpointTest.php              |   2 +-
 .../SearchEndpoint/FilterEndpointTest.php     |   2 +-
 .../SearchEndpoint/HighlightEndpointTest.php  |   2 +-
 .../SearchEndpoint/InnerHitsEndpointTest.php  |   2 +-
 .../SearchEndpoint/PostFilterEndpointTest.php |   2 +-
 .../SearchEndpoint/QueryEndpointTest.php      |   2 +-
 .../SearchEndpointFactoryTest.php             |   2 +-
 .../SearchEndpoint/SortEndpointTest.php       |   2 +-
 .../SearchEndpoint/SuggestEndpointTest.php    |   2 +-
 tests/{ => Unit}/SearchTest.php               |   2 +-
 .../Suggest/CompletionSuggestTest.php         |   2 +-
 tests/{ => Unit}/Suggest/SuggestTest.php      |   2 +-
 tests/{ => Unit}/Suggest/TermSuggestTest.php  |   2 +-
 105 files changed, 340 insertions(+), 105 deletions(-)
 create mode 100644 tests/Functional/AbstractElasticsearchTestCase.php
 create mode 100644 tests/Functional/Query/MatchAllQueryTest.php
 rename tests/{ => Unit}/Aggregation/CardinalityAggregationTest.php (97%)
 rename tests/{ => Unit}/Aggregation/ChildrenAggregationTest.php (96%)
 rename tests/{ => Unit}/Aggregation/DateHistogramAggregationTest.php (96%)
 rename tests/{ => Unit}/Aggregation/DateRangeAggregationTest.php (98%)
 rename tests/{ => Unit}/Aggregation/FilterAggregationTest.php (98%)
 rename tests/{ => Unit}/Aggregation/FiltersAggregationTest.php (98%)
 rename tests/{ => Unit}/Aggregation/GeoBoundsAggregationTest.php (96%)
 rename tests/{ => Unit}/Aggregation/GeoCentroidAggregationTest.php (95%)
 rename tests/{ => Unit}/Aggregation/GeoDistanceAggregationTest.php (98%)
 rename tests/{ => Unit}/Aggregation/GeoHashGridAggregationTest.php (97%)
 rename tests/{ => Unit}/Aggregation/GlobalAggregationTest.php (97%)
 rename tests/{ => Unit}/Aggregation/Ipv4RangeAggregationTest.php (96%)
 rename tests/{ => Unit}/Aggregation/MissingAggregationTest.php (95%)
 rename tests/{ => Unit}/Aggregation/NestedAggregationTest.php (94%)
 rename tests/{ => Unit}/Aggregation/PercentileRanksAggregationTest.php (97%)
 rename tests/{ => Unit}/Aggregation/PercentilesAggregationTest.php (96%)
 rename tests/{ => Unit}/Aggregation/Pipeline/AvgBucketAggregationTest.php (93%)
 rename tests/{ => Unit}/Aggregation/Pipeline/BucketScriptAggregationTest.php (96%)
 rename tests/{ => Unit}/Aggregation/Pipeline/BucketSelectorAggregationTest.php (95%)
 rename tests/{ => Unit}/Aggregation/Pipeline/CumulativeSumAggregationTest.php (92%)
 rename tests/{ => Unit}/Aggregation/Pipeline/DerivativeAggregationTest.php (93%)
 rename tests/{ => Unit}/Aggregation/Pipeline/ExtendedStatsBucketAggregationTest.php (92%)
 rename tests/{ => Unit}/Aggregation/Pipeline/MaxBucketAggregationTest.php (92%)
 rename tests/{ => Unit}/Aggregation/Pipeline/MinBucketAggregationTest.php (92%)
 rename tests/{ => Unit}/Aggregation/Pipeline/PercentilesBucketAggregationTest.php (93%)
 rename tests/{ => Unit}/Aggregation/Pipeline/SerialDifferencingAggregationTest.php (93%)
 rename tests/{ => Unit}/Aggregation/Pipeline/StatsBucketAggregationTest.php (92%)
 rename tests/{ => Unit}/Aggregation/Pipeline/SumBucketAggregationTest.php (92%)
 rename tests/{ => Unit}/Aggregation/RangeAggregationTest.php (99%)
 rename tests/{ => Unit}/Aggregation/ReverseNestedAggregationTest.php (97%)
 rename tests/{ => Unit}/Aggregation/SamplerAggregationTest.php (96%)
 rename tests/{ => Unit}/Aggregation/SignificantTermsAggregationTest.php (95%)
 rename tests/{ => Unit}/Aggregation/StatsAggregationTest.php (95%)
 rename tests/{ => Unit}/Aggregation/TermsAggregationTest.php (99%)
 rename tests/{ => Unit}/Aggregation/TopHitsAggregationTest.php (96%)
 rename tests/{ => Unit}/BuilderBagTest.php (98%)
 rename tests/{ => Unit}/Highlight/HighlightTest.php (98%)
 rename tests/{ => Unit}/InnerHit/NestedInnerHitTest.php (98%)
 rename tests/{ => Unit}/InnerHit/ParentInnerHitTest.php (92%)
 rename tests/{ => Unit}/Integration/SearchTest.php (98%)
 rename tests/{ => Unit}/ParametersTraitTest.php (95%)
 rename tests/{ => Unit}/Query/BoolQueryTest.php (98%)
 rename tests/{ => Unit}/Query/BoostingQueryTest.php (95%)
 rename tests/{ => Unit}/Query/CommonTermsQueryTest.php (94%)
 rename tests/{ => Unit}/Query/ConstantScoreQueryTest.php (95%)
 rename tests/{ => Unit}/Query/DisMaxQueryTest.php (95%)
 rename tests/{ => Unit}/Query/ExistsQueryTest.php (92%)
 rename tests/{ => Unit}/Query/FunctionScoreQueryTest.php (98%)
 rename tests/{ => Unit}/Query/FuzzyQueryTest.php (93%)
 rename tests/{ => Unit}/Query/GeoBoundingBoxQueryTest.php (97%)
 rename tests/{ => Unit}/Query/GeoDistanceQueryTest.php (97%)
 rename tests/{ => Unit}/Query/GeoDistanceRangeQueryTest.php (97%)
 rename tests/{ => Unit}/Query/GeoPolygonQueryTest.php (97%)
 rename tests/{ => Unit}/Query/GeoShapeQueryTest.php (97%)
 rename tests/{ => Unit}/Query/GeohashCellQueryTest.php (96%)
 rename tests/{ => Unit}/Query/HasChildQueryTest.php (93%)
 rename tests/{ => Unit}/Query/HasParentQueryTest.php (93%)
 rename tests/{ => Unit}/Query/IdsQueryTest.php (92%)
 rename tests/{ => Unit}/Query/IndicesQueryTest.php (97%)
 rename tests/{ => Unit}/Query/LimitQueryTest.php (92%)
 rename tests/{ => Unit}/Query/MatchAllQueryTest.php (50%)
 rename tests/{ => Unit}/Query/MatchPhrasePrefixQueryTest.php (94%)
 rename tests/{ => Unit}/Query/MatchPhraseQueryTest.php (93%)
 rename tests/{ => Unit}/Query/MatchQueryTest.php (93%)
 rename tests/{ => Unit}/Query/MissingQueryTest.php (95%)
 rename tests/{ => Unit}/Query/MoreLikeThisQueryTest.php (93%)
 rename tests/{ => Unit}/Query/MultiMatchQueryTest.php (93%)
 rename tests/{ => Unit}/Query/NestedQueryTest.php (97%)
 rename tests/{ => Unit}/Query/PrefixQueryTest.php (93%)
 rename tests/{ => Unit}/Query/QueryStringQueryTest.php (93%)
 rename tests/{ => Unit}/Query/RangeQueryTest.php (93%)
 rename tests/{ => Unit}/Query/RegexpQueryTest.php (93%)
 rename tests/{ => Unit}/Query/ScriptQueryTest.php (96%)
 rename tests/{ => Unit}/Query/SimpleQueryStringQueryTest.php (93%)
 rename tests/{ => Unit}/Query/Span/SpanContainingQueryTest.php (96%)
 rename tests/{ => Unit}/Query/Span/SpanFirstQueryTest.php (94%)
 rename tests/{ => Unit}/Query/Span/SpanMultiTermQueryTest.php (94%)
 rename tests/{ => Unit}/Query/Span/SpanNearQueryTest.php (95%)
 rename tests/{ => Unit}/Query/Span/SpanNotQueryTest.php (95%)
 rename tests/{ => Unit}/Query/Span/SpanOrQueryTest.php (95%)
 rename tests/{ => Unit}/Query/Span/SpanTermQueryTest.php (94%)
 rename tests/{ => Unit}/Query/Span/SpanWithinQueryTest.php (96%)
 rename tests/{ => Unit}/Query/TemplateQueryTest.php (96%)
 rename tests/{ => Unit}/Query/TermQueryTest.php (92%)
 rename tests/{ => Unit}/Query/TermsQueryTest.php (93%)
 rename tests/{ => Unit}/Query/TypeQueryTest.php (92%)
 rename tests/{ => Unit}/Query/WildcardQueryTest.php (93%)
 rename tests/{ => Unit}/SearchEndpoint/AggregationsEndpointTest.php (94%)
 rename tests/{ => Unit}/SearchEndpoint/FilterEndpointTest.php (97%)
 rename tests/{ => Unit}/SearchEndpoint/HighlightEndpointTest.php (96%)
 rename tests/{ => Unit}/SearchEndpoint/InnerHitsEndpointTest.php (96%)
 rename tests/{ => Unit}/SearchEndpoint/PostFilterEndpointTest.php (97%)
 rename tests/{ => Unit}/SearchEndpoint/QueryEndpointTest.php (97%)
 rename tests/{ => Unit}/SearchEndpoint/SearchEndpointFactoryTest.php (92%)
 rename tests/{ => Unit}/SearchEndpoint/SortEndpointTest.php (96%)
 rename tests/{ => Unit}/SearchEndpoint/SuggestEndpointTest.php (96%)
 rename tests/{ => Unit}/SearchTest.php (99%)
 rename tests/{ => Unit}/Suggest/CompletionSuggestTest.php (97%)
 rename tests/{ => Unit}/Suggest/SuggestTest.php (98%)
 rename tests/{ => Unit}/Suggest/TermSuggestTest.php (96%)

diff --git a/.travis.yml b/.travis.yml
index 85b514f..3021f79 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,4 @@
-sudo: false
+sudo: true
 language: php
 php:
   - 5.4
@@ -6,10 +6,30 @@ php:
   - 5.6
   - 7.0
   - hhvm
+env:
+  global:
+    - JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre"
+  matrix:
+    - ES_VERSION="5.0" ELASTICSEARH_PHP="~5.0"
+    - ES_VERSION="2.4" ELASTICSEARH_PHP="~2.0"
 matrix:
   allow_failures:
     - php: hhvm
+  exclude:
+    - php: 5.4
+      env: ES_VERSION="5.0" ELASTICSEARH_PHP="~5.0"
+    - php: 5.5
+      env: ES_VERSION="5.0" ELASTICSEARH_PHP="~5.0"
+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
 before_script:
+  - composer require --no-update elasticsearch/elasticsearch:${ELASTICSEARH_PHP}
+  - composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH
   - composer install --no-interaction --prefer-dist
 script:
   - vendor/bin/phpunit --coverage-clover=coverage.clover
diff --git a/composer.json b/composer.json
index a59b969..2c66aaf 100644
--- a/composer.json
+++ b/composer.json
@@ -17,7 +17,8 @@
     "require-dev": {
         "phpunit/phpunit": "~4.4",
         "squizlabs/php_codesniffer": "~2.0",
-        "satooshi/php-coveralls": "~0.7"
+        "satooshi/php-coveralls": "~0.7",
+        "elasticsearch/elasticsearch": "~5.0"
     },
     "autoload": {
         "psr-4": {
diff --git a/src/Query/MatchAllQuery.php b/src/Query/MatchAllQuery.php
index ec9fde7..2529ac6 100644
--- a/src/Query/MatchAllQuery.php
+++ b/src/Query/MatchAllQuery.php
@@ -44,6 +44,7 @@ class MatchAllQuery implements BuilderInterface
      */
     public function toArray()
     {
-        return [$this->getType() => $this->getParameters()];
+        $params = $this->getParameters();
+        return [$this->getType() => !empty($params) ? $params : new \stdClass()];
     }
 }
diff --git a/tests/Functional/AbstractElasticsearchTestCase.php b/tests/Functional/AbstractElasticsearchTestCase.php
new file mode 100644
index 0000000..9741cd0
--- /dev/null
+++ b/tests/Functional/AbstractElasticsearchTestCase.php
@@ -0,0 +1,152 @@
+<?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\Tests\Functional;
+
+use Elasticsearch\Client;
+use Elasticsearch\ClientBuilder;
+use ONGR\ElasticsearchDSL\Search;
+
+abstract class AbstractElasticsearchTestCase extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Test index name in the elasticsearch.
+     */
+    const INDEX_NAME = 'elasticsaerch-dsl-test';
+
+    /**
+     * @var Client
+     */
+    private $client;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+
+        $this->client = ClientBuilder::create()->build();
+        $this->deleteIndex();
+
+        $this->client->indices()->create(
+            array_filter(
+                [
+                    'index' => self::INDEX_NAME,
+                    'mapping' => $this->getMapping()
+                ]
+            )
+        );
+
+        $bulkBody = [];
+
+        foreach ($this->getDataArray() as $type => $documents) {
+            foreach ($documents as $id => $document) {
+                $bulkBody[] = [
+                   'index' => [
+                        '_index' => self::INDEX_NAME,
+                        '_type' => $type,
+                        '_id' => $id,
+                    ]
+                ];
+                $bulkBody[] = $document;
+            }
+        }
+
+        $this->client->bulk(
+            [
+                'body' => $bulkBody
+            ]
+        );
+        $this->client->indices()->refresh();
+    }
+
+    private function deleteIndex()
+    {
+        try {
+            $this->client->indices()->delete(['index' => self::INDEX_NAME]);
+        } catch (\Exception $e) {
+            // Do nothing.
+        }
+    }
+
+    /**
+     * Defines index mapping for test index.
+     * Override this function in your test case and return array with mapping body.
+     * More info check here: https://goo.gl/zWBree
+     *
+     * @return array Mapping body
+     */
+    protected function getMapping()
+    {
+        return [];
+    }
+
+    /**
+     * Can be overwritten in child class to populate elasticsearch index with the data.
+     *
+     * Example:
+     *      [
+     *          'type_name' => [
+     *              'custom_id' => [
+     *                  'title' => 'foo',
+     *              ],
+     *              3 => [
+     *                  '_id' => 2,
+     *                  'title' => 'bar',
+     *              ]
+     *          ]
+     *      ]
+     * Document _id can be set as it's id.
+     *
+     * @return array
+     */
+    protected function getDataArray()
+    {
+        return [];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function tearDown()
+    {
+        parent::tearDown();
+        $this->deleteIndex();
+    }
+
+    protected function executeSearch(Search $search, $type = null, $returnRaw = false)
+    {
+        $response = $this->client->search(
+            array_filter([
+                'index' => self::INDEX_NAME,
+                'type' => $type,
+                'body' => $search->toArray(),
+            ])
+        );
+
+        if ($returnRaw) {
+            return $response;
+        }
+
+        $documents = [];
+
+        try {
+            foreach ($response['hits']['hits'] as $document) {
+                $documents[$document['_id']] = $document['_source'];
+            }
+        } catch (\Exception $e) {
+            return $documents;
+        }
+
+        return $documents;
+    }
+}
diff --git a/tests/Functional/Query/MatchAllQueryTest.php b/tests/Functional/Query/MatchAllQueryTest.php
new file mode 100644
index 0000000..b0f8497
--- /dev/null
+++ b/tests/Functional/Query/MatchAllQueryTest.php
@@ -0,0 +1,51 @@
+<?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\Tests\Functional\Query;
+
+use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
+use ONGR\ElasticsearchDSL\Search;
+use ONGR\ElasticsearchDSL\Tests\Functional\AbstractElasticsearchTestCase;
+
+class MatchAllQueryTest extends AbstractElasticsearchTestCase
+{
+    /**
+     * {@inheritdoc}
+     */
+    protected function getDataArray()
+    {
+        return [
+            'product' => [
+                [
+                    'title' => 'acme',
+                ],
+                [
+                    'title' => 'foo',
+                ],
+            ]
+        ];
+    }
+
+    /**
+     * Match all test
+     */
+    public function testMatchAll()
+    {
+        $search = new Search();
+        $matchAll = new MatchAllQuery();
+
+        $search->addQuery($matchAll);
+
+        $results = $this->executeSearch($search);
+
+        $this->assertEquals($this->getDataArray()['product'], $results);
+    }
+}
diff --git a/tests/Aggregation/CardinalityAggregationTest.php b/tests/Unit/Aggregation/CardinalityAggregationTest.php
similarity index 97%
rename from tests/Aggregation/CardinalityAggregationTest.php
rename to tests/Unit/Aggregation/CardinalityAggregationTest.php
index 934f274..4cf5d1d 100644
--- a/tests/Aggregation/CardinalityAggregationTest.php
+++ b/tests/Unit/Aggregation/CardinalityAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\CardinalityAggregation;
 
diff --git a/tests/Aggregation/ChildrenAggregationTest.php b/tests/Unit/Aggregation/ChildrenAggregationTest.php
similarity index 96%
rename from tests/Aggregation/ChildrenAggregationTest.php
rename to tests/Unit/Aggregation/ChildrenAggregationTest.php
index 89eeced..dd5cd63 100644
--- a/tests/Aggregation/ChildrenAggregationTest.php
+++ b/tests/Unit/Aggregation/ChildrenAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\ChildrenAggregation;
 
diff --git a/tests/Aggregation/DateHistogramAggregationTest.php b/tests/Unit/Aggregation/DateHistogramAggregationTest.php
similarity index 96%
rename from tests/Aggregation/DateHistogramAggregationTest.php
rename to tests/Unit/Aggregation/DateHistogramAggregationTest.php
index 50f1643..5845f88 100644
--- a/tests/Aggregation/DateHistogramAggregationTest.php
+++ b/tests/Unit/Aggregation/DateHistogramAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\DateHistogramAggregation;
 
diff --git a/tests/Aggregation/DateRangeAggregationTest.php b/tests/Unit/Aggregation/DateRangeAggregationTest.php
similarity index 98%
rename from tests/Aggregation/DateRangeAggregationTest.php
rename to tests/Unit/Aggregation/DateRangeAggregationTest.php
index 718f8a8..03afc28 100644
--- a/tests/Aggregation/DateRangeAggregationTest.php
+++ b/tests/Unit/Aggregation/DateRangeAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\DateRangeAggregation;
 
diff --git a/tests/Aggregation/FilterAggregationTest.php b/tests/Unit/Aggregation/FilterAggregationTest.php
similarity index 98%
rename from tests/Aggregation/FilterAggregationTest.php
rename to tests/Unit/Aggregation/FilterAggregationTest.php
index fcc432d..cf36bd7 100644
--- a/tests/Aggregation/FilterAggregationTest.php
+++ b/tests/Unit/Aggregation/FilterAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\FilterAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\HistogramAggregation;
diff --git a/tests/Aggregation/FiltersAggregationTest.php b/tests/Unit/Aggregation/FiltersAggregationTest.php
similarity index 98%
rename from tests/Aggregation/FiltersAggregationTest.php
rename to tests/Unit/Aggregation/FiltersAggregationTest.php
index cb05d92..b487fd9 100644
--- a/tests/Aggregation/FiltersAggregationTest.php
+++ b/tests/Unit/Aggregation/FiltersAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\FiltersAggregation;
 use ONGR\ElasticsearchDSL\BuilderInterface;
diff --git a/tests/Aggregation/GeoBoundsAggregationTest.php b/tests/Unit/Aggregation/GeoBoundsAggregationTest.php
similarity index 96%
rename from tests/Aggregation/GeoBoundsAggregationTest.php
rename to tests/Unit/Aggregation/GeoBoundsAggregationTest.php
index 24376fb..505b912 100644
--- a/tests/Aggregation/GeoBoundsAggregationTest.php
+++ b/tests/Unit/Aggregation/GeoBoundsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\GeoBoundsAggregation;
diff --git a/tests/Aggregation/GeoCentroidAggregationTest.php b/tests/Unit/Aggregation/GeoCentroidAggregationTest.php
similarity index 95%
rename from tests/Aggregation/GeoCentroidAggregationTest.php
rename to tests/Unit/Aggregation/GeoCentroidAggregationTest.php
index e8d6ea9..a28a16c 100644
--- a/tests/Aggregation/GeoCentroidAggregationTest.php
+++ b/tests/Unit/Aggregation/GeoCentroidAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\GeoCentroidAggregation;
 
diff --git a/tests/Aggregation/GeoDistanceAggregationTest.php b/tests/Unit/Aggregation/GeoDistanceAggregationTest.php
similarity index 98%
rename from tests/Aggregation/GeoDistanceAggregationTest.php
rename to tests/Unit/Aggregation/GeoDistanceAggregationTest.php
index 513f246..1c5d21b 100644
--- a/tests/Aggregation/GeoDistanceAggregationTest.php
+++ b/tests/Unit/Aggregation/GeoDistanceAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\GeoDistanceAggregation;
 
diff --git a/tests/Aggregation/GeoHashGridAggregationTest.php b/tests/Unit/Aggregation/GeoHashGridAggregationTest.php
similarity index 97%
rename from tests/Aggregation/GeoHashGridAggregationTest.php
rename to tests/Unit/Aggregation/GeoHashGridAggregationTest.php
index e97a022..499d642 100644
--- a/tests/Aggregation/GeoHashGridAggregationTest.php
+++ b/tests/Unit/Aggregation/GeoHashGridAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\GeoHashGridAggregation;
 
diff --git a/tests/Aggregation/GlobalAggregationTest.php b/tests/Unit/Aggregation/GlobalAggregationTest.php
similarity index 97%
rename from tests/Aggregation/GlobalAggregationTest.php
rename to tests/Unit/Aggregation/GlobalAggregationTest.php
index b2e8850..40e101e 100644
--- a/tests/Aggregation/GlobalAggregationTest.php
+++ b/tests/Unit/Aggregation/GlobalAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\GlobalAggregation;
 
diff --git a/tests/Aggregation/Ipv4RangeAggregationTest.php b/tests/Unit/Aggregation/Ipv4RangeAggregationTest.php
similarity index 96%
rename from tests/Aggregation/Ipv4RangeAggregationTest.php
rename to tests/Unit/Aggregation/Ipv4RangeAggregationTest.php
index 0582f68..4d42c41 100644
--- a/tests/Aggregation/Ipv4RangeAggregationTest.php
+++ b/tests/Unit/Aggregation/Ipv4RangeAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\Ipv4RangeAggregation;
diff --git a/tests/Aggregation/MissingAggregationTest.php b/tests/Unit/Aggregation/MissingAggregationTest.php
similarity index 95%
rename from tests/Aggregation/MissingAggregationTest.php
rename to tests/Unit/Aggregation/MissingAggregationTest.php
index ffa66d5..ed8d222 100644
--- a/tests/Aggregation/MissingAggregationTest.php
+++ b/tests/Unit/Aggregation/MissingAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\MissingAggregation;
 
diff --git a/tests/Aggregation/NestedAggregationTest.php b/tests/Unit/Aggregation/NestedAggregationTest.php
similarity index 94%
rename from tests/Aggregation/NestedAggregationTest.php
rename to tests/Unit/Aggregation/NestedAggregationTest.php
index 874c299..f24a002 100644
--- a/tests/Aggregation/NestedAggregationTest.php
+++ b/tests/Unit/Aggregation/NestedAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\NestedAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation;
diff --git a/tests/Aggregation/PercentileRanksAggregationTest.php b/tests/Unit/Aggregation/PercentileRanksAggregationTest.php
similarity index 97%
rename from tests/Aggregation/PercentileRanksAggregationTest.php
rename to tests/Unit/Aggregation/PercentileRanksAggregationTest.php
index e2f8914..8c71bbd 100644
--- a/tests/Aggregation/PercentileRanksAggregationTest.php
+++ b/tests/Unit/Aggregation/PercentileRanksAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\PercentileRanksAggregation;
diff --git a/tests/Aggregation/PercentilesAggregationTest.php b/tests/Unit/Aggregation/PercentilesAggregationTest.php
similarity index 96%
rename from tests/Aggregation/PercentilesAggregationTest.php
rename to tests/Unit/Aggregation/PercentilesAggregationTest.php
index 2357f35..a7c4fff 100644
--- a/tests/Aggregation/PercentilesAggregationTest.php
+++ b/tests/Unit/Aggregation/PercentilesAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\PercentilesAggregation;
 
diff --git a/tests/Aggregation/Pipeline/AvgBucketAggregationTest.php b/tests/Unit/Aggregation/Pipeline/AvgBucketAggregationTest.php
similarity index 93%
rename from tests/Aggregation/Pipeline/AvgBucketAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/AvgBucketAggregationTest.php
index 05a350c..e468224 100644
--- a/tests/Aggregation/Pipeline/AvgBucketAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/AvgBucketAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\AvgBucketAggregation;
 
diff --git a/tests/Aggregation/Pipeline/BucketScriptAggregationTest.php b/tests/Unit/Aggregation/Pipeline/BucketScriptAggregationTest.php
similarity index 96%
rename from tests/Aggregation/Pipeline/BucketScriptAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/BucketScriptAggregationTest.php
index 5dd8a05..8f75353 100644
--- a/tests/Aggregation/Pipeline/BucketScriptAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/BucketScriptAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\BucketScriptAggregation;
 
diff --git a/tests/Aggregation/Pipeline/BucketSelectorAggregationTest.php b/tests/Unit/Aggregation/Pipeline/BucketSelectorAggregationTest.php
similarity index 95%
rename from tests/Aggregation/Pipeline/BucketSelectorAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/BucketSelectorAggregationTest.php
index 559c2d9..d54f61f 100644
--- a/tests/Aggregation/Pipeline/BucketSelectorAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/BucketSelectorAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\BucketSelectorAggregation;
 
diff --git a/tests/Aggregation/Pipeline/CumulativeSumAggregationTest.php b/tests/Unit/Aggregation/Pipeline/CumulativeSumAggregationTest.php
similarity index 92%
rename from tests/Aggregation/Pipeline/CumulativeSumAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/CumulativeSumAggregationTest.php
index b2214a1..e5cebf8 100644
--- a/tests/Aggregation/Pipeline/CumulativeSumAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/CumulativeSumAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\CumulativeSumAggregation;
 
diff --git a/tests/Aggregation/Pipeline/DerivativeAggregationTest.php b/tests/Unit/Aggregation/Pipeline/DerivativeAggregationTest.php
similarity index 93%
rename from tests/Aggregation/Pipeline/DerivativeAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/DerivativeAggregationTest.php
index 2f7748e..ada4424 100644
--- a/tests/Aggregation/Pipeline/DerivativeAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/DerivativeAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\DerivativeAggregation;
 
diff --git a/tests/Aggregation/Pipeline/ExtendedStatsBucketAggregationTest.php b/tests/Unit/Aggregation/Pipeline/ExtendedStatsBucketAggregationTest.php
similarity index 92%
rename from tests/Aggregation/Pipeline/ExtendedStatsBucketAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/ExtendedStatsBucketAggregationTest.php
index 4868907..de15f10 100644
--- a/tests/Aggregation/Pipeline/ExtendedStatsBucketAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/ExtendedStatsBucketAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\ExtendedStatsBucketAggregation;
 
diff --git a/tests/Aggregation/Pipeline/MaxBucketAggregationTest.php b/tests/Unit/Aggregation/Pipeline/MaxBucketAggregationTest.php
similarity index 92%
rename from tests/Aggregation/Pipeline/MaxBucketAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/MaxBucketAggregationTest.php
index 72cc292..a5f9d07 100644
--- a/tests/Aggregation/Pipeline/MaxBucketAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/MaxBucketAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\MaxBucketAggregation;
 
diff --git a/tests/Aggregation/Pipeline/MinBucketAggregationTest.php b/tests/Unit/Aggregation/Pipeline/MinBucketAggregationTest.php
similarity index 92%
rename from tests/Aggregation/Pipeline/MinBucketAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/MinBucketAggregationTest.php
index 06323e4..c570569 100644
--- a/tests/Aggregation/Pipeline/MinBucketAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/MinBucketAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\MinBucketAggregation;
 
diff --git a/tests/Aggregation/Pipeline/PercentilesBucketAggregationTest.php b/tests/Unit/Aggregation/Pipeline/PercentilesBucketAggregationTest.php
similarity index 93%
rename from tests/Aggregation/Pipeline/PercentilesBucketAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/PercentilesBucketAggregationTest.php
index d4f740f..ae94d77 100644
--- a/tests/Aggregation/Pipeline/PercentilesBucketAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/PercentilesBucketAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\PercentilesBucketAggregation;
 
diff --git a/tests/Aggregation/Pipeline/SerialDifferencingAggregationTest.php b/tests/Unit/Aggregation/Pipeline/SerialDifferencingAggregationTest.php
similarity index 93%
rename from tests/Aggregation/Pipeline/SerialDifferencingAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/SerialDifferencingAggregationTest.php
index aa52044..77e75e8 100644
--- a/tests/Aggregation/Pipeline/SerialDifferencingAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/SerialDifferencingAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\SerialDifferencingAggregation;
 
diff --git a/tests/Aggregation/Pipeline/StatsBucketAggregationTest.php b/tests/Unit/Aggregation/Pipeline/StatsBucketAggregationTest.php
similarity index 92%
rename from tests/Aggregation/Pipeline/StatsBucketAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/StatsBucketAggregationTest.php
index 47fa412..876ee8d 100644
--- a/tests/Aggregation/Pipeline/StatsBucketAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/StatsBucketAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\StatsBucketAggregation;
 
diff --git a/tests/Aggregation/Pipeline/SumBucketAggregationTest.php b/tests/Unit/Aggregation/Pipeline/SumBucketAggregationTest.php
similarity index 92%
rename from tests/Aggregation/Pipeline/SumBucketAggregationTest.php
rename to tests/Unit/Aggregation/Pipeline/SumBucketAggregationTest.php
index a909354..2ee9a4a 100644
--- a/tests/Aggregation/Pipeline/SumBucketAggregationTest.php
+++ b/tests/Unit/Aggregation/Pipeline/SumBucketAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Pipeline;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Pipeline;
 
 use ONGR\ElasticsearchDSL\Aggregation\Pipeline\SumBucketAggregation;
 
diff --git a/tests/Aggregation/RangeAggregationTest.php b/tests/Unit/Aggregation/RangeAggregationTest.php
similarity index 99%
rename from tests/Aggregation/RangeAggregationTest.php
rename to tests/Unit/Aggregation/RangeAggregationTest.php
index 9ee23c1..70ee5cc 100644
--- a/tests/Aggregation/RangeAggregationTest.php
+++ b/tests/Unit/Aggregation/RangeAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\RangeAggregation;
diff --git a/tests/Aggregation/ReverseNestedAggregationTest.php b/tests/Unit/Aggregation/ReverseNestedAggregationTest.php
similarity index 97%
rename from tests/Aggregation/ReverseNestedAggregationTest.php
rename to tests/Unit/Aggregation/ReverseNestedAggregationTest.php
index 4070738..a47aaeb 100644
--- a/tests/Aggregation/ReverseNestedAggregationTest.php
+++ b/tests/Unit/Aggregation/ReverseNestedAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\ReverseNestedAggregation;
diff --git a/tests/Aggregation/SamplerAggregationTest.php b/tests/Unit/Aggregation/SamplerAggregationTest.php
similarity index 96%
rename from tests/Aggregation/SamplerAggregationTest.php
rename to tests/Unit/Aggregation/SamplerAggregationTest.php
index 1f32157..4ac64c8 100644
--- a/tests/Aggregation/SamplerAggregationTest.php
+++ b/tests/Unit/Aggregation/SamplerAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\SamplerAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation;
diff --git a/tests/Aggregation/SignificantTermsAggregationTest.php b/tests/Unit/Aggregation/SignificantTermsAggregationTest.php
similarity index 95%
rename from tests/Aggregation/SignificantTermsAggregationTest.php
rename to tests/Unit/Aggregation/SignificantTermsAggregationTest.php
index 1406d41..6f75c1b 100644
--- a/tests/Aggregation/SignificantTermsAggregationTest.php
+++ b/tests/Unit/Aggregation/SignificantTermsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\SignificantTermsAggregation;
 
diff --git a/tests/Aggregation/StatsAggregationTest.php b/tests/Unit/Aggregation/StatsAggregationTest.php
similarity index 95%
rename from tests/Aggregation/StatsAggregationTest.php
rename to tests/Unit/Aggregation/StatsAggregationTest.php
index 8ed469b..4d98696 100644
--- a/tests/Aggregation/StatsAggregationTest.php
+++ b/tests/Unit/Aggregation/StatsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\StatsAggregation;
diff --git a/tests/Aggregation/TermsAggregationTest.php b/tests/Unit/Aggregation/TermsAggregationTest.php
similarity index 99%
rename from tests/Aggregation/TermsAggregationTest.php
rename to tests/Unit/Aggregation/TermsAggregationTest.php
index dab248a..3d61d8f 100644
--- a/tests/Aggregation/TermsAggregationTest.php
+++ b/tests/Unit/Aggregation/TermsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation;
diff --git a/tests/Aggregation/TopHitsAggregationTest.php b/tests/Unit/Aggregation/TopHitsAggregationTest.php
similarity index 96%
rename from tests/Aggregation/TopHitsAggregationTest.php
rename to tests/Unit/Aggregation/TopHitsAggregationTest.php
index 70b18ae..127e02b 100644
--- a/tests/Aggregation/TopHitsAggregationTest.php
+++ b/tests/Unit/Aggregation/TopHitsAggregationTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation;
 
 use ONGR\ElasticsearchDSL\Aggregation\TopHitsAggregation;
 use ONGR\ElasticsearchDSL\Sort\FieldSort;
diff --git a/tests/BuilderBagTest.php b/tests/Unit/BuilderBagTest.php
similarity index 98%
rename from tests/BuilderBagTest.php
rename to tests/Unit/BuilderBagTest.php
index ec16fc0..59270d1 100644
--- a/tests/BuilderBagTest.php
+++ b/tests/Unit/BuilderBagTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL;
+namespace ONGR\ElasticsearchDSL\Tests\Unit;
 
 use ONGR\ElasticsearchDSL\BuilderBag;
 use ONGR\ElasticsearchDSL\BuilderInterface;
diff --git a/tests/Highlight/HighlightTest.php b/tests/Unit/Highlight/HighlightTest.php
similarity index 98%
rename from tests/Highlight/HighlightTest.php
rename to tests/Unit/Highlight/HighlightTest.php
index 1b75447..ede0f36 100644
--- a/tests/Highlight/HighlightTest.php
+++ b/tests/Unit/Highlight/HighlightTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Highlight;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Highlight;
 
 use ONGR\ElasticsearchDSL\Highlight\Highlight;
 
diff --git a/tests/InnerHit/NestedInnerHitTest.php b/tests/Unit/InnerHit/NestedInnerHitTest.php
similarity index 98%
rename from tests/InnerHit/NestedInnerHitTest.php
rename to tests/Unit/InnerHit/NestedInnerHitTest.php
index c9bfe8a..2d51234 100644
--- a/tests/InnerHit/NestedInnerHitTest.php
+++ b/tests/Unit/InnerHit/NestedInnerHitTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace ONGR\ElasticsearchDSL\Tests\InnerHit;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\InnerHit;
 
 use ONGR\ElasticsearchDSL\InnerHit\NestedInnerHit;
 use ONGR\ElasticsearchDSL\Query\MatchQuery;
diff --git a/tests/InnerHit/ParentInnerHitTest.php b/tests/Unit/InnerHit/ParentInnerHitTest.php
similarity index 92%
rename from tests/InnerHit/ParentInnerHitTest.php
rename to tests/Unit/InnerHit/ParentInnerHitTest.php
index 9444ec6..427a2a8 100644
--- a/tests/InnerHit/ParentInnerHitTest.php
+++ b/tests/Unit/InnerHit/ParentInnerHitTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace ONGR\ElasticsearchDSL\Tests\InnerHit;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\InnerHit;
 
 use ONGR\ElasticsearchDSL\InnerHit\ParentInnerHit;
 use ONGR\ElasticsearchDSL\Query\TermQuery;
diff --git a/tests/Integration/SearchTest.php b/tests/Unit/Integration/SearchTest.php
similarity index 98%
rename from tests/Integration/SearchTest.php
rename to tests/Unit/Integration/SearchTest.php
index 9573f57..fb2c6e3 100644
--- a/tests/Integration/SearchTest.php
+++ b/tests/Unit/Integration/SearchTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Aggregation\Integration;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Aggregation\Integration;
 
 use ONGR\ElasticsearchDSL\Aggregation\FiltersAggregation;
 use ONGR\ElasticsearchDSL\Aggregation\HistogramAggregation;
diff --git a/tests/ParametersTraitTest.php b/tests/Unit/ParametersTraitTest.php
similarity index 95%
rename from tests/ParametersTraitTest.php
rename to tests/Unit/ParametersTraitTest.php
index e5d3c9f..8b3e9f6 100644
--- a/tests/ParametersTraitTest.php
+++ b/tests/Unit/ParametersTraitTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL;
+namespace ONGR\ElasticsearchDSL\Tests\Unit;
 
 use ONGR\ElasticsearchDSL\ParametersTrait;
 
diff --git a/tests/Query/BoolQueryTest.php b/tests/Unit/Query/BoolQueryTest.php
similarity index 98%
rename from tests/Query/BoolQueryTest.php
rename to tests/Unit/Query/BoolQueryTest.php
index 738bada..2d3da88 100644
--- a/tests/Query/BoolQueryTest.php
+++ b/tests/Unit/Query/BoolQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\BoolQuery;
 use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
diff --git a/tests/Query/BoostingQueryTest.php b/tests/Unit/Query/BoostingQueryTest.php
similarity index 95%
rename from tests/Query/BoostingQueryTest.php
rename to tests/Unit/Query/BoostingQueryTest.php
index 516f9b1..b9a19de 100644
--- a/tests/Query/BoostingQueryTest.php
+++ b/tests/Unit/Query/BoostingQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\BoostingQuery;
 
diff --git a/tests/Query/CommonTermsQueryTest.php b/tests/Unit/Query/CommonTermsQueryTest.php
similarity index 94%
rename from tests/Query/CommonTermsQueryTest.php
rename to tests/Unit/Query/CommonTermsQueryTest.php
index 749bb58..e25dd55 100644
--- a/tests/Query/CommonTermsQueryTest.php
+++ b/tests/Unit/Query/CommonTermsQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\CommonTermsQuery;
 
diff --git a/tests/Query/ConstantScoreQueryTest.php b/tests/Unit/Query/ConstantScoreQueryTest.php
similarity index 95%
rename from tests/Query/ConstantScoreQueryTest.php
rename to tests/Unit/Query/ConstantScoreQueryTest.php
index 4c4fdb6..a8c7128 100644
--- a/tests/Query/ConstantScoreQueryTest.php
+++ b/tests/Unit/Query/ConstantScoreQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\ConstantScoreQuery;
 
diff --git a/tests/Query/DisMaxQueryTest.php b/tests/Unit/Query/DisMaxQueryTest.php
similarity index 95%
rename from tests/Query/DisMaxQueryTest.php
rename to tests/Unit/Query/DisMaxQueryTest.php
index 8c5e442..8b47d57 100644
--- a/tests/Query/DisMaxQueryTest.php
+++ b/tests/Unit/Query/DisMaxQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\DisMaxQuery;
 
diff --git a/tests/Query/ExistsQueryTest.php b/tests/Unit/Query/ExistsQueryTest.php
similarity index 92%
rename from tests/Query/ExistsQueryTest.php
rename to tests/Unit/Query/ExistsQueryTest.php
index 292b8ad..99138b0 100644
--- a/tests/Query/ExistsQueryTest.php
+++ b/tests/Unit/Query/ExistsQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\ExistsQuery;
 
diff --git a/tests/Query/FunctionScoreQueryTest.php b/tests/Unit/Query/FunctionScoreQueryTest.php
similarity index 98%
rename from tests/Query/FunctionScoreQueryTest.php
rename to tests/Unit/Query/FunctionScoreQueryTest.php
index 5f0bb5a..578b822 100644
--- a/tests/Query/FunctionScoreQueryTest.php
+++ b/tests/Unit/Query/FunctionScoreQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\BuilderInterface;
 use ONGR\ElasticsearchDSL\Query\FunctionScoreQuery;
diff --git a/tests/Query/FuzzyQueryTest.php b/tests/Unit/Query/FuzzyQueryTest.php
similarity index 93%
rename from tests/Query/FuzzyQueryTest.php
rename to tests/Unit/Query/FuzzyQueryTest.php
index 16edbf7..7b1b3b5 100644
--- a/tests/Query/FuzzyQueryTest.php
+++ b/tests/Unit/Query/FuzzyQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\FuzzyQuery;
 
diff --git a/tests/Query/GeoBoundingBoxQueryTest.php b/tests/Unit/Query/GeoBoundingBoxQueryTest.php
similarity index 97%
rename from tests/Query/GeoBoundingBoxQueryTest.php
rename to tests/Unit/Query/GeoBoundingBoxQueryTest.php
index c192fc8..c50cfaf 100644
--- a/tests/Query/GeoBoundingBoxQueryTest.php
+++ b/tests/Unit/Query/GeoBoundingBoxQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\GeoBoundingBoxQuery;
 
diff --git a/tests/Query/GeoDistanceQueryTest.php b/tests/Unit/Query/GeoDistanceQueryTest.php
similarity index 97%
rename from tests/Query/GeoDistanceQueryTest.php
rename to tests/Unit/Query/GeoDistanceQueryTest.php
index 496bec8..c5b0412 100644
--- a/tests/Query/GeoDistanceQueryTest.php
+++ b/tests/Unit/Query/GeoDistanceQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\GeoDistanceQuery;
 
diff --git a/tests/Query/GeoDistanceRangeQueryTest.php b/tests/Unit/Query/GeoDistanceRangeQueryTest.php
similarity index 97%
rename from tests/Query/GeoDistanceRangeQueryTest.php
rename to tests/Unit/Query/GeoDistanceRangeQueryTest.php
index 0394658..1850266 100644
--- a/tests/Query/GeoDistanceRangeQueryTest.php
+++ b/tests/Unit/Query/GeoDistanceRangeQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\GeoDistanceRangeQuery;
 
diff --git a/tests/Query/GeoPolygonQueryTest.php b/tests/Unit/Query/GeoPolygonQueryTest.php
similarity index 97%
rename from tests/Query/GeoPolygonQueryTest.php
rename to tests/Unit/Query/GeoPolygonQueryTest.php
index 3f8d09f..5584bc7 100644
--- a/tests/Query/GeoPolygonQueryTest.php
+++ b/tests/Unit/Query/GeoPolygonQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\GeoPolygonQuery;
 
diff --git a/tests/Query/GeoShapeQueryTest.php b/tests/Unit/Query/GeoShapeQueryTest.php
similarity index 97%
rename from tests/Query/GeoShapeQueryTest.php
rename to tests/Unit/Query/GeoShapeQueryTest.php
index f188878..870cd33 100644
--- a/tests/Query/GeoShapeQueryTest.php
+++ b/tests/Unit/Query/GeoShapeQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\GeoShapeQuery;
 
diff --git a/tests/Query/GeohashCellQueryTest.php b/tests/Unit/Query/GeohashCellQueryTest.php
similarity index 96%
rename from tests/Query/GeohashCellQueryTest.php
rename to tests/Unit/Query/GeohashCellQueryTest.php
index 91687e6..669cdc3 100644
--- a/tests/Query/GeohashCellQueryTest.php
+++ b/tests/Unit/Query/GeohashCellQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\GeohashCellQuery;
 
diff --git a/tests/Query/HasChildQueryTest.php b/tests/Unit/Query/HasChildQueryTest.php
similarity index 93%
rename from tests/Query/HasChildQueryTest.php
rename to tests/Unit/Query/HasChildQueryTest.php
index f7c15cf..d287087 100644
--- a/tests/Query/HasChildQueryTest.php
+++ b/tests/Unit/Query/HasChildQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\HasChildQuery;
 
diff --git a/tests/Query/HasParentQueryTest.php b/tests/Unit/Query/HasParentQueryTest.php
similarity index 93%
rename from tests/Query/HasParentQueryTest.php
rename to tests/Unit/Query/HasParentQueryTest.php
index d206909..04bb3a5 100644
--- a/tests/Query/HasParentQueryTest.php
+++ b/tests/Unit/Query/HasParentQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\HasParentQuery;
 
diff --git a/tests/Query/IdsQueryTest.php b/tests/Unit/Query/IdsQueryTest.php
similarity index 92%
rename from tests/Query/IdsQueryTest.php
rename to tests/Unit/Query/IdsQueryTest.php
index f4ef6af..5db7650 100644
--- a/tests/Query/IdsQueryTest.php
+++ b/tests/Unit/Query/IdsQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\IdsQuery;
 
diff --git a/tests/Query/IndicesQueryTest.php b/tests/Unit/Query/IndicesQueryTest.php
similarity index 97%
rename from tests/Query/IndicesQueryTest.php
rename to tests/Unit/Query/IndicesQueryTest.php
index ba384a2..8618830 100644
--- a/tests/Query/IndicesQueryTest.php
+++ b/tests/Unit/Query/IndicesQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\IndicesQuery;
 
diff --git a/tests/Query/LimitQueryTest.php b/tests/Unit/Query/LimitQueryTest.php
similarity index 92%
rename from tests/Query/LimitQueryTest.php
rename to tests/Unit/Query/LimitQueryTest.php
index d1ddcb9..a818e0b 100644
--- a/tests/Query/LimitQueryTest.php
+++ b/tests/Unit/Query/LimitQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\LimitQuery;
 
diff --git a/tests/Query/MatchAllQueryTest.php b/tests/Unit/Query/MatchAllQueryTest.php
similarity index 50%
rename from tests/Query/MatchAllQueryTest.php
rename to tests/Unit/Query/MatchAllQueryTest.php
index 86c7cae..f513818 100644
--- a/tests/Query/MatchAllQueryTest.php
+++ b/tests/Unit/Query/MatchAllQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
 
@@ -18,9 +18,19 @@ class MatchAllQueryTest extends \PHPUnit_Framework_TestCase
     /**
      * Tests toArray().
      */
-    public function testToArray()
+    public function testToArrayWhenThereAreNoParams()
     {
         $query = new MatchAllQuery();
-        $this->assertEquals(['match_all' => []], $query->toArray());
+        $this->assertEquals(['match_all' => new \stdClass()], $query->toArray());
+    }
+
+    /**
+     * Tests toArray().
+     */
+    public function testToArrayWithParams()
+    {
+        $params = ['boost' => 5];
+        $query = new MatchAllQuery($params);
+        $this->assertEquals(['match_all' => $params], $query->toArray());
     }
 }
diff --git a/tests/Query/MatchPhrasePrefixQueryTest.php b/tests/Unit/Query/MatchPhrasePrefixQueryTest.php
similarity index 94%
rename from tests/Query/MatchPhrasePrefixQueryTest.php
rename to tests/Unit/Query/MatchPhrasePrefixQueryTest.php
index ea5c202..5aa55d3 100644
--- a/tests/Query/MatchPhrasePrefixQueryTest.php
+++ b/tests/Unit/Query/MatchPhrasePrefixQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\MatchPhrasePrefixQuery;
 use PHPUnit_Framework_TestCase;
diff --git a/tests/Query/MatchPhraseQueryTest.php b/tests/Unit/Query/MatchPhraseQueryTest.php
similarity index 93%
rename from tests/Query/MatchPhraseQueryTest.php
rename to tests/Unit/Query/MatchPhraseQueryTest.php
index 74cf40b..33570c7 100644
--- a/tests/Query/MatchPhraseQueryTest.php
+++ b/tests/Unit/Query/MatchPhraseQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\MatchPhraseQuery;
 use PHPUnit_Framework_TestCase;
diff --git a/tests/Query/MatchQueryTest.php b/tests/Unit/Query/MatchQueryTest.php
similarity index 93%
rename from tests/Query/MatchQueryTest.php
rename to tests/Unit/Query/MatchQueryTest.php
index af9597b..162f26c 100644
--- a/tests/Query/MatchQueryTest.php
+++ b/tests/Unit/Query/MatchQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\MatchQuery;
 
diff --git a/tests/Query/MissingQueryTest.php b/tests/Unit/Query/MissingQueryTest.php
similarity index 95%
rename from tests/Query/MissingQueryTest.php
rename to tests/Unit/Query/MissingQueryTest.php
index 710af17..77e8f8a 100644
--- a/tests/Query/MissingQueryTest.php
+++ b/tests/Unit/Query/MissingQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\MissingQuery;
 
diff --git a/tests/Query/MoreLikeThisQueryTest.php b/tests/Unit/Query/MoreLikeThisQueryTest.php
similarity index 93%
rename from tests/Query/MoreLikeThisQueryTest.php
rename to tests/Unit/Query/MoreLikeThisQueryTest.php
index 876c57e..89c1063 100644
--- a/tests/Query/MoreLikeThisQueryTest.php
+++ b/tests/Unit/Query/MoreLikeThisQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\MoreLikeThisQuery;
 
diff --git a/tests/Query/MultiMatchQueryTest.php b/tests/Unit/Query/MultiMatchQueryTest.php
similarity index 93%
rename from tests/Query/MultiMatchQueryTest.php
rename to tests/Unit/Query/MultiMatchQueryTest.php
index 428625f..49c27b2 100644
--- a/tests/Query/MultiMatchQueryTest.php
+++ b/tests/Unit/Query/MultiMatchQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\MultiMatchQuery;
 
diff --git a/tests/Query/NestedQueryTest.php b/tests/Unit/Query/NestedQueryTest.php
similarity index 97%
rename from tests/Query/NestedQueryTest.php
rename to tests/Unit/Query/NestedQueryTest.php
index a5beaa0..a25360f 100644
--- a/tests/Query/NestedQueryTest.php
+++ b/tests/Unit/Query/NestedQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\NestedQuery;
 use ONGR\ElasticsearchDSL\Query\TermsQuery;
diff --git a/tests/Query/PrefixQueryTest.php b/tests/Unit/Query/PrefixQueryTest.php
similarity index 93%
rename from tests/Query/PrefixQueryTest.php
rename to tests/Unit/Query/PrefixQueryTest.php
index 18e9183..610756c 100644
--- a/tests/Query/PrefixQueryTest.php
+++ b/tests/Unit/Query/PrefixQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\PrefixQuery;
 
diff --git a/tests/Query/QueryStringQueryTest.php b/tests/Unit/Query/QueryStringQueryTest.php
similarity index 93%
rename from tests/Query/QueryStringQueryTest.php
rename to tests/Unit/Query/QueryStringQueryTest.php
index c211bd6..864d789 100644
--- a/tests/Query/QueryStringQueryTest.php
+++ b/tests/Unit/Query/QueryStringQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\QueryStringQuery;
 
diff --git a/tests/Query/RangeQueryTest.php b/tests/Unit/Query/RangeQueryTest.php
similarity index 93%
rename from tests/Query/RangeQueryTest.php
rename to tests/Unit/Query/RangeQueryTest.php
index 430815f..97cfc93 100644
--- a/tests/Query/RangeQueryTest.php
+++ b/tests/Unit/Query/RangeQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\RangeQuery;
 
diff --git a/tests/Query/RegexpQueryTest.php b/tests/Unit/Query/RegexpQueryTest.php
similarity index 93%
rename from tests/Query/RegexpQueryTest.php
rename to tests/Unit/Query/RegexpQueryTest.php
index c7c583a..2636fb0 100644
--- a/tests/Query/RegexpQueryTest.php
+++ b/tests/Unit/Query/RegexpQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\RegexpQuery;
 
diff --git a/tests/Query/ScriptQueryTest.php b/tests/Unit/Query/ScriptQueryTest.php
similarity index 96%
rename from tests/Query/ScriptQueryTest.php
rename to tests/Unit/Query/ScriptQueryTest.php
index 083ddf4..c520bd2 100644
--- a/tests/Query/ScriptQueryTest.php
+++ b/tests/Unit/Query/ScriptQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\ScriptQuery;
 
diff --git a/tests/Query/SimpleQueryStringQueryTest.php b/tests/Unit/Query/SimpleQueryStringQueryTest.php
similarity index 93%
rename from tests/Query/SimpleQueryStringQueryTest.php
rename to tests/Unit/Query/SimpleQueryStringQueryTest.php
index a92aeb7..55e1ffb 100644
--- a/tests/Query/SimpleQueryStringQueryTest.php
+++ b/tests/Unit/Query/SimpleQueryStringQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\SimpleQueryStringQuery;
 
diff --git a/tests/Query/Span/SpanContainingQueryTest.php b/tests/Unit/Query/Span/SpanContainingQueryTest.php
similarity index 96%
rename from tests/Query/Span/SpanContainingQueryTest.php
rename to tests/Unit/Query/Span/SpanContainingQueryTest.php
index d3a934b..29b4841 100644
--- a/tests/Query/Span/SpanContainingQueryTest.php
+++ b/tests/Unit/Query/Span/SpanContainingQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanContainingQuery;
 
diff --git a/tests/Query/Span/SpanFirstQueryTest.php b/tests/Unit/Query/Span/SpanFirstQueryTest.php
similarity index 94%
rename from tests/Query/Span/SpanFirstQueryTest.php
rename to tests/Unit/Query/Span/SpanFirstQueryTest.php
index 819aee9..c8c2b90 100644
--- a/tests/Query/Span/SpanFirstQueryTest.php
+++ b/tests/Unit/Query/Span/SpanFirstQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanFirstQuery;
 
diff --git a/tests/Query/Span/SpanMultiTermQueryTest.php b/tests/Unit/Query/Span/SpanMultiTermQueryTest.php
similarity index 94%
rename from tests/Query/Span/SpanMultiTermQueryTest.php
rename to tests/Unit/Query/Span/SpanMultiTermQueryTest.php
index 73c6914..fc53b0c 100644
--- a/tests/Query/Span/SpanMultiTermQueryTest.php
+++ b/tests/Unit/Query/Span/SpanMultiTermQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanMultiTermQuery;
 
diff --git a/tests/Query/Span/SpanNearQueryTest.php b/tests/Unit/Query/Span/SpanNearQueryTest.php
similarity index 95%
rename from tests/Query/Span/SpanNearQueryTest.php
rename to tests/Unit/Query/Span/SpanNearQueryTest.php
index cbfb5e8..020728c 100644
--- a/tests/Query/Span/SpanNearQueryTest.php
+++ b/tests/Unit/Query/Span/SpanNearQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanNearQuery;
 
diff --git a/tests/Query/Span/SpanNotQueryTest.php b/tests/Unit/Query/Span/SpanNotQueryTest.php
similarity index 95%
rename from tests/Query/Span/SpanNotQueryTest.php
rename to tests/Unit/Query/Span/SpanNotQueryTest.php
index 2d5a8f5..37be01f 100644
--- a/tests/Query/Span/SpanNotQueryTest.php
+++ b/tests/Unit/Query/Span/SpanNotQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanNotQuery;
 
diff --git a/tests/Query/Span/SpanOrQueryTest.php b/tests/Unit/Query/Span/SpanOrQueryTest.php
similarity index 95%
rename from tests/Query/Span/SpanOrQueryTest.php
rename to tests/Unit/Query/Span/SpanOrQueryTest.php
index 10efb9b..07e5973 100644
--- a/tests/Query/Span/SpanOrQueryTest.php
+++ b/tests/Unit/Query/Span/SpanOrQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanOrQuery;
 
diff --git a/tests/Query/Span/SpanTermQueryTest.php b/tests/Unit/Query/Span/SpanTermQueryTest.php
similarity index 94%
rename from tests/Query/Span/SpanTermQueryTest.php
rename to tests/Unit/Query/Span/SpanTermQueryTest.php
index 075c122..fd6b70f 100644
--- a/tests/Query/Span/SpanTermQueryTest.php
+++ b/tests/Unit/Query/Span/SpanTermQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanTermQuery;
 
diff --git a/tests/Query/Span/SpanWithinQueryTest.php b/tests/Unit/Query/Span/SpanWithinQueryTest.php
similarity index 96%
rename from tests/Query/Span/SpanWithinQueryTest.php
rename to tests/Unit/Query/Span/SpanWithinQueryTest.php
index 3a933c4..36b7028 100644
--- a/tests/Query/Span/SpanWithinQueryTest.php
+++ b/tests/Unit/Query/Span/SpanWithinQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query\Span;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query\Span;
 
 use ONGR\ElasticsearchDSL\Query\Span\SpanWithinQuery;
 
diff --git a/tests/Query/TemplateQueryTest.php b/tests/Unit/Query/TemplateQueryTest.php
similarity index 96%
rename from tests/Query/TemplateQueryTest.php
rename to tests/Unit/Query/TemplateQueryTest.php
index 1926562..8d2a444 100644
--- a/tests/Query/TemplateQueryTest.php
+++ b/tests/Unit/Query/TemplateQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\TemplateQuery;
 
diff --git a/tests/Query/TermQueryTest.php b/tests/Unit/Query/TermQueryTest.php
similarity index 92%
rename from tests/Query/TermQueryTest.php
rename to tests/Unit/Query/TermQueryTest.php
index 688e3da..b6aa73b 100644
--- a/tests/Query/TermQueryTest.php
+++ b/tests/Unit/Query/TermQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\TermQuery;
 
diff --git a/tests/Query/TermsQueryTest.php b/tests/Unit/Query/TermsQueryTest.php
similarity index 93%
rename from tests/Query/TermsQueryTest.php
rename to tests/Unit/Query/TermsQueryTest.php
index 1291847..a3567cc 100644
--- a/tests/Query/TermsQueryTest.php
+++ b/tests/Unit/Query/TermsQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\TermsQuery;
 
diff --git a/tests/Query/TypeQueryTest.php b/tests/Unit/Query/TypeQueryTest.php
similarity index 92%
rename from tests/Query/TypeQueryTest.php
rename to tests/Unit/Query/TypeQueryTest.php
index dc2bad8..be1cf8f 100644
--- a/tests/Query/TypeQueryTest.php
+++ b/tests/Unit/Query/TypeQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\TypeQuery;
 
diff --git a/tests/Query/WildcardQueryTest.php b/tests/Unit/Query/WildcardQueryTest.php
similarity index 93%
rename from tests/Query/WildcardQueryTest.php
rename to tests/Unit/Query/WildcardQueryTest.php
index e736df2..cf17483 100644
--- a/tests/Query/WildcardQueryTest.php
+++ b/tests/Unit/Query/WildcardQueryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Query;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
 
 use ONGR\ElasticsearchDSL\Query\WildcardQuery;
 
diff --git a/tests/SearchEndpoint/AggregationsEndpointTest.php b/tests/Unit/SearchEndpoint/AggregationsEndpointTest.php
similarity index 94%
rename from tests/SearchEndpoint/AggregationsEndpointTest.php
rename to tests/Unit/SearchEndpoint/AggregationsEndpointTest.php
index 8a618dd..a61dba8 100644
--- a/tests/SearchEndpoint/AggregationsEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/AggregationsEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\Aggregation\MissingAggregation;
 use ONGR\ElasticsearchDSL\SearchEndpoint\AggregationsEndpoint;
diff --git a/tests/SearchEndpoint/FilterEndpointTest.php b/tests/Unit/SearchEndpoint/FilterEndpointTest.php
similarity index 97%
rename from tests/SearchEndpoint/FilterEndpointTest.php
rename to tests/Unit/SearchEndpoint/FilterEndpointTest.php
index 86425f6..adfc847 100644
--- a/tests/SearchEndpoint/FilterEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/FilterEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
 use ONGR\ElasticsearchDSL\SearchEndpoint\FilterEndpoint;
diff --git a/tests/SearchEndpoint/HighlightEndpointTest.php b/tests/Unit/SearchEndpoint/HighlightEndpointTest.php
similarity index 96%
rename from tests/SearchEndpoint/HighlightEndpointTest.php
rename to tests/Unit/SearchEndpoint/HighlightEndpointTest.php
index ff5e44f..c7058e0 100644
--- a/tests/SearchEndpoint/HighlightEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/HighlightEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\Highlight\Highlight;
 use ONGR\ElasticsearchDSL\SearchEndpoint\HighlightEndpoint;
diff --git a/tests/SearchEndpoint/InnerHitsEndpointTest.php b/tests/Unit/SearchEndpoint/InnerHitsEndpointTest.php
similarity index 96%
rename from tests/SearchEndpoint/InnerHitsEndpointTest.php
rename to tests/Unit/SearchEndpoint/InnerHitsEndpointTest.php
index 268bfcc..d3d4519 100644
--- a/tests/SearchEndpoint/InnerHitsEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/InnerHitsEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\SearchEndpoint\InnerHitsEndpoint;
 
diff --git a/tests/SearchEndpoint/PostFilterEndpointTest.php b/tests/Unit/SearchEndpoint/PostFilterEndpointTest.php
similarity index 97%
rename from tests/SearchEndpoint/PostFilterEndpointTest.php
rename to tests/Unit/SearchEndpoint/PostFilterEndpointTest.php
index 1e9ab86..0862c37 100644
--- a/tests/SearchEndpoint/PostFilterEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/PostFilterEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
 use ONGR\ElasticsearchDSL\SearchEndpoint\PostFilterEndpoint;
diff --git a/tests/SearchEndpoint/QueryEndpointTest.php b/tests/Unit/SearchEndpoint/QueryEndpointTest.php
similarity index 97%
rename from tests/SearchEndpoint/QueryEndpointTest.php
rename to tests/Unit/SearchEndpoint/QueryEndpointTest.php
index b626caa..2dd69a9 100644
--- a/tests/SearchEndpoint/QueryEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/QueryEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
 use ONGR\ElasticsearchDSL\SearchEndpoint\QueryEndpoint;
diff --git a/tests/SearchEndpoint/SearchEndpointFactoryTest.php b/tests/Unit/SearchEndpoint/SearchEndpointFactoryTest.php
similarity index 92%
rename from tests/SearchEndpoint/SearchEndpointFactoryTest.php
rename to tests/Unit/SearchEndpoint/SearchEndpointFactoryTest.php
index 9d134dc..7eefe32 100644
--- a/tests/SearchEndpoint/SearchEndpointFactoryTest.php
+++ b/tests/Unit/SearchEndpoint/SearchEndpointFactoryTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\SearchEndpoint\AggregationsEndpoint;
 use ONGR\ElasticsearchDSL\SearchEndpoint\SearchEndpointFactory;
diff --git a/tests/SearchEndpoint/SortEndpointTest.php b/tests/Unit/SearchEndpoint/SortEndpointTest.php
similarity index 96%
rename from tests/SearchEndpoint/SortEndpointTest.php
rename to tests/Unit/SearchEndpoint/SortEndpointTest.php
index 5f21c9d..42bc761 100644
--- a/tests/SearchEndpoint/SortEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/SortEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\SearchEndpoint\SortEndpoint;
 use ONGR\ElasticsearchDSL\Sort\FieldSort;
diff --git a/tests/SearchEndpoint/SuggestEndpointTest.php b/tests/Unit/SearchEndpoint/SuggestEndpointTest.php
similarity index 96%
rename from tests/SearchEndpoint/SuggestEndpointTest.php
rename to tests/Unit/SearchEndpoint/SuggestEndpointTest.php
index 7702a56..e6e1cca 100644
--- a/tests/SearchEndpoint/SuggestEndpointTest.php
+++ b/tests/Unit/SearchEndpoint/SuggestEndpointTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\SearchEndpoint;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Unit\SearchEndpoint;
 
 use ONGR\ElasticsearchDSL\SearchEndpoint\SuggestEndpoint;
 use ONGR\ElasticsearchDSL\Suggest\TermSuggest;
diff --git a/tests/SearchTest.php b/tests/Unit/SearchTest.php
similarity index 99%
rename from tests/SearchTest.php
rename to tests/Unit/SearchTest.php
index 77d7e40..d89949f 100644
--- a/tests/SearchTest.php
+++ b/tests/Unit/SearchTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Unit\DSL;
+namespace ONGR\ElasticsearchDSL\Tests\Unit;
 
 use ONGR\ElasticsearchDSL\Query\MissingQuery;
 use ONGR\ElasticsearchDSL\Query\TermQuery;
diff --git a/tests/Suggest/CompletionSuggestTest.php b/tests/Unit/Suggest/CompletionSuggestTest.php
similarity index 97%
rename from tests/Suggest/CompletionSuggestTest.php
rename to tests/Unit/Suggest/CompletionSuggestTest.php
index 8e4ce8c..066ae5b 100644
--- a/tests/Suggest/CompletionSuggestTest.php
+++ b/tests/Unit/Suggest/CompletionSuggestTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Suggest;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Suggest;
 
 use ONGR\ElasticsearchDSL\Suggest\CompletionSuggest;
 
diff --git a/tests/Suggest/SuggestTest.php b/tests/Unit/Suggest/SuggestTest.php
similarity index 98%
rename from tests/Suggest/SuggestTest.php
rename to tests/Unit/Suggest/SuggestTest.php
index e748223..626411a 100644
--- a/tests/Suggest/SuggestTest.php
+++ b/tests/Unit/Suggest/SuggestTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Suggest;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Suggest;
 
 use ONGR\ElasticsearchDSL\Suggest\Suggest;
 
diff --git a/tests/Suggest/TermSuggestTest.php b/tests/Unit/Suggest/TermSuggestTest.php
similarity index 96%
rename from tests/Suggest/TermSuggestTest.php
rename to tests/Unit/Suggest/TermSuggestTest.php
index e3685e7..6492937 100644
--- a/tests/Suggest/TermSuggestTest.php
+++ b/tests/Unit/Suggest/TermSuggestTest.php
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace ONGR\ElasticsearchDSL\Tests\Suggest;
+namespace ONGR\ElasticsearchDSL\Tests\Unit\Suggest;
 
 use ONGR\ElasticsearchDSL\Suggest\TermSuggest;
 
-- 
GitLab