diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php
index 6a2642a8568f488d8dd17a06584cfe7ca82b7ac8..ffd912a7cf3671d2137aebd7a7e476bc753c34ea 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php
@@ -143,6 +143,7 @@ abstract class AbstractAction
     protected function processRelations($indexer, $ids, $onlyParents = false)
     {
         $parentIds = $indexer->getRelationsByChild($ids);
+        $parentIds = array_unique(array_merge($parentIds, $ids));
         $childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds);
         return array_unique(array_merge($ids, $childIds, $parentIds));
     }
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php
index d4c78772e7c0be357ac95845dc8f3f1f56d1a72f..d92646769b13b2dfba439393f852e2540b14bcb9 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Value.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php
@@ -11,6 +11,7 @@ namespace Magento\Catalog\Model\Product\Option;
 use Magento\Catalog\Model\Product;
 use Magento\Catalog\Model\Product\Option;
 use Magento\Framework\Model\AbstractModel;
+use Magento\Catalog\Pricing\Price\BasePrice;
 
 /**
  * Catalog product option select type model
@@ -224,7 +225,7 @@ class Value extends AbstractModel implements \Magento\Catalog\Api\Data\ProductCu
     public function getPrice($flag = false)
     {
         if ($flag && $this->getPriceType() == self::TYPE_PERCENT) {
-            $basePrice = $this->getOption()->getProduct()->getFinalPrice();
+            $basePrice = $this->getOption()->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getValue();
             $price = $basePrice * ($this->_getData(self::KEY_PRICE) / 100);
             return $price;
         }
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php
index 58654136ab5a8d67cc586dd5a0b0756e4b5942f9..b621f1a4906d6594b6a7c68e27166ad97bf2ca24 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php
@@ -129,8 +129,9 @@ class AbstractActionTest extends \PHPUnit\Framework\TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
-        $eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($childIds);
-        $eavSource->expects($this->once())->method('getRelationsByParent')->with($childIds)->willReturn($parentIds);
+        $eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($parentIds);
+        $eavSource->expects($this->once())->method('getRelationsByParent')
+            ->with(array_unique(array_merge($parentIds, $childIds)))->willReturn($parentIds);
 
         $eavDecimal->expects($this->once())->method('getRelationsByChild')->with($reindexIds)->willReturn($reindexIds);
         $eavDecimal->expects($this->once())->method('getRelationsByParent')->with($reindexIds)->willReturn([]);
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php
index a2d31f377e92562455407515bca5c40aff46a97e..3f0df9bcd5556cf731dc9c0eaec8cbea830136b4 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/ValueTest.php
@@ -164,13 +164,27 @@ class ValueTest extends \PHPUnit\Framework\TestCase
     private function getMockedProduct()
     {
         $mockBuilder = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
-            ->setMethods(['getFinalPrice', '__wakeup'])
+            ->setMethods(['getPriceInfo', '__wakeup'])
             ->disableOriginalConstructor();
         $mock = $mockBuilder->getMock();
 
-        $mock->expects($this->any())
-            ->method('getFinalPrice')
-            ->will($this->returnValue(10));
+        $priceInfoMock = $this->getMockForAbstractClass(
+            \Magento\Framework\Pricing\PriceInfoInterface::class,
+            [],
+            '',
+            false,
+            false,
+            true,
+            ['getPrice']
+        );
+
+        $priceMock = $this->getMockForAbstractClass(\Magento\Framework\Pricing\Price\PriceInterface::class);
+
+        $priceInfoMock->expects($this->any())->method('getPrice')->willReturn($priceMock);
+
+        $mock->expects($this->any())->method('getPriceInfo')->willReturn($priceInfoMock);
+
+        $priceMock->expects($this->any())->method('getValue')->willReturn(10);
 
         return $mock;
     }
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php
index d1fe1eee80e19ba25cac963bdb3916c6e3c0e23d..e6d6136498a6206b6d673291881d84eeaceffd5a 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Media.php
@@ -17,7 +17,7 @@ class Media extends AbstractImportValidator implements RowValidatorInterface
      */
     const URL_REGEXP = '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i';
 
-    const PATH_REGEXP = '#^(?!.*[\\/]\.{2}[\\/])(?!\.{2}[\\/])[-\w.\\/]+$#';
+    const PATH_REGEXP = '#^(?!.*[\\/]\.{2}[\\/])(?!\.{2}[\\/])[-\w.\\/()]+$#';
 
     const ADDITIONAL_IMAGES = 'additional_images';
 
diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php
index 45a97e22878278eacc4401b963a21eb72deab095..9a26efee744d592f53916727110e23e6210036ba 100644
--- a/app/code/Magento/Dhl/Model/Carrier.php
+++ b/app/code/Magento/Dhl/Model/Carrier.php
@@ -606,7 +606,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin
             'L' => __('Express 10:30'),
             'G' => __('Domestic economy select'),
             'W' => __('Economy select'),
-            'I' => __('Break bulk economy'),
+            'I' => __('Domestic express 9:00'),
             'N' => __('Domestic express'),
             'O' => __('Others'),
             'R' => __('Globalmail business'),
@@ -616,7 +616,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin
         ];
 
         $nonDocType = [
-            '1' => __('Customer services'),
+            '1' => __('Domestic express 12:00'),
             '3' => __('Easy shop'),
             '4' => __('Jetline'),
             '8' => __('Express easy'),
diff --git a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php
index 0f0d784813dfc9eba2616f0b313d3439fc1f86fd..8738d3bb8dae21df93f831afec27aa10fc455c36 100644
--- a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php
+++ b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php
@@ -447,4 +447,67 @@ class CarrierTest extends \PHPUnit\Framework\TestCase
             ]
         ];
     }
+
+    /**
+     * @dataProvider dhlProductsDataProvider
+     *
+     * @param string $docType
+     * @param array $products
+     */
+    public function testGetDhlProducts(string $docType, array $products)
+    {
+        $this->assertEquals($products, $this->model->getDhlProducts($docType));
+    }
+
+    /**
+     * @return array
+     */
+    public function dhlProductsDataProvider() : array
+    {
+        return [
+            'doc' => [
+                'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_DOC,
+                'products' => [
+                    '2' => 'Easy shop',
+                    '5' => 'Sprintline',
+                    '6' => 'Secureline',
+                    '7' => 'Express easy',
+                    '9' => 'Europack',
+                    'B' => 'Break bulk express',
+                    'C' => 'Medical express',
+                    'D' => 'Express worldwide',
+                    'U' => 'Express worldwide',
+                    'K' => 'Express 9:00',
+                    'L' => 'Express 10:30',
+                    'G' => 'Domestic economy select',
+                    'W' => 'Economy select',
+                    'I' => 'Domestic express 9:00',
+                    'N' => 'Domestic express',
+                    'O' => 'Others',
+                    'R' => 'Globalmail business',
+                    'S' => 'Same day',
+                    'T' => 'Express 12:00',
+                    'X' => 'Express envelope',
+                ]
+            ],
+            'non-doc' => [
+                'docType' => \Magento\Dhl\Model\Carrier::DHL_CONTENT_TYPE_NON_DOC,
+                'products' => [
+                    '1' => 'Domestic express 12:00',
+                    '3' => 'Easy shop',
+                    '4' => 'Jetline',
+                    '8' => 'Express easy',
+                    'P' => 'Express worldwide',
+                    'Q' => 'Medical express',
+                    'E' => 'Express 9:00',
+                    'F' => 'Freight worldwide',
+                    'H' => 'Economy select',
+                    'J' => 'Jumbo box',
+                    'M' => 'Express 10:30',
+                    'V' => 'Europack',
+                    'Y' => 'Express 12:00',
+                ]
+            ]
+        ];
+    }
 }
diff --git a/app/code/Magento/Dhl/i18n/en_US.csv b/app/code/Magento/Dhl/i18n/en_US.csv
index 90ec8b5f17a2256b5c4e627760950d8104b9fa55..a5532c2cea963905bc33517bf432d91b04a13001 100644
--- a/app/code/Magento/Dhl/i18n/en_US.csv
+++ b/app/code/Magento/Dhl/i18n/en_US.csv
@@ -23,14 +23,12 @@ Europack,Europack
 "Express 10:30","Express 10:30"
 "Domestic economy select","Domestic economy select"
 "Economy select","Economy select"
-"Break bulk economy","Break bulk economy"
 "Domestic express","Domestic express"
 Others,Others
 "Globalmail business","Globalmail business"
 "Same day","Same day"
 "Express 12:00","Express 12:00"
 "Express envelope","Express envelope"
-"Customer services","Customer services"
 Jetline,Jetline
 "Freight worldwide","Freight worldwide"
 "Jumbo box","Jumbo box"
@@ -81,3 +79,5 @@ Size,Size
 "Show Method if Not Applicable","Show Method if Not Applicable"
 "Sort Order","Sort Order"
 Debug,Debug
+"Domestic express 9:00","Domestic express 9:00"
+"Domestic express 12:00","Domestic express 12:00"
diff --git a/app/code/Magento/Quote/Model/CouponManagement.php b/app/code/Magento/Quote/Model/CouponManagement.php
index 7701e41e0b55ac7c8e500db3091c8617ccf3a060..87398ad36cfab28fb4dc330da7a60dd34bccb3bb 100644
--- a/app/code/Magento/Quote/Model/CouponManagement.php
+++ b/app/code/Magento/Quote/Model/CouponManagement.php
@@ -50,6 +50,7 @@ class CouponManagement implements CouponManagementInterface
      */
     public function set($cartId, $couponCode)
     {
+        $couponCode = trim($couponCode);
         /** @var  \Magento\Quote\Model\Quote $quote */
         $quote = $this->quoteRepository->getActive($cartId);
         if (!$quote->getItemsCount()) {
diff --git a/app/code/Magento/Search/Block/Term.php b/app/code/Magento/Search/Block/Term.php
index d92ba03bfcff80814a4aab2b054f7794034ada2c..ee62129051b9791362b9876eb65ee411413eddcb 100644
--- a/app/code/Magento/Search/Block/Term.php
+++ b/app/code/Magento/Search/Block/Term.php
@@ -95,8 +95,8 @@ class Term extends Template
                     continue;
                 }
                 $term->setRatio(($term->getPopularity() - $this->_minPopularity) / $range);
-                $temp[$term->getName()] = $term;
-                $termKeys[] = $term->getName();
+                $temp[$term->getData('query_text')] = $term;
+                $termKeys[] = $term->getData('query_text');
             }
             natcasesort($termKeys);
 
@@ -128,7 +128,7 @@ class Term extends Template
          * url encoding will be done in Url.php http_build_query
          * so no need to explicitly called urlencode for the text
          */
-        $url->setQueryParam('q', $obj->getName());
+        $url->setQueryParam('q', $obj->getData('query_text'));
         return $url->getUrl('catalogsearch/result');
     }
 
diff --git a/app/code/Magento/Search/view/frontend/templates/term.phtml b/app/code/Magento/Search/view/frontend/templates/term.phtml
index 4285b42fa0329bb8a7f0713d335a0a0494b9facd..8acee0cf3d408b2743acb56702a9b6c49ca4c2e5 100644
--- a/app/code/Magento/Search/view/frontend/templates/term.phtml
+++ b/app/code/Magento/Search/view/frontend/templates/term.phtml
@@ -13,7 +13,7 @@
             <li class="item">
                 <a href="<?= /* @escapeNotVerified */ $block->getSearchUrl($_term) ?>"
                    style="font-size:<?= /* @escapeNotVerified */ $_term->getRatio()*70+75 ?>%;">
-                    <?= $block->escapeHtml($_term->getName()) ?>
+                    <?= $block->escapeHtml($_term->getData('query_text')) ?>
                 </a>
             </li>
         <?php endforeach; ?>
diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php
index f50276fd6ce60e917a2becc111edc6df30cfa5f5..c58b5c16544705c945b9f7662ab56a001706195e 100644
--- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php
@@ -297,4 +297,46 @@ class CouponManagementTest extends WebapiAbstract
 
         $this->assertEquals($quoteWithCoupon->getCouponCode(), $couponCode);
     }
+
+    /**
+     * @magentoApiDataFixture Magento/Sales/_files/quote.php
+     * @magentoApiDataFixture Magento/Checkout/_files/discount_10percent.php
+     */
+    public function testSetCouponWihSpaces()
+    {
+        /** @var \Magento\Quote\Model\Quote $quote */
+        $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class);
+        $quote->load('test01', 'reserved_order_id');
+        $cartId = $quote->getId();
+        /** @var \Magento\SalesRule\Model\Rule $salesRule */
+        $salesRule = $this->objectManager->create(\Magento\SalesRule\Model\Rule::class);
+        $salesRuleId = $this->objectManager->get(\Magento\Framework\Registry::class)
+            ->registry('Magento/Checkout/_file/discount_10percent');
+        $salesRule->load($salesRuleId);
+        $couponCode = $salesRule->getPrimaryCoupon()->getCode() ;
+        $serviceInfo = [
+            'rest' => [
+                'resourcePath' => self::RESOURCE_PATH . $cartId . '/coupons/'
+                    . rawurlencode(' ') . $couponCode . rawurlencode(' '),
+                'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT,
+            ],
+            'soap' => [
+                'service' => self::SERVICE_NAME,
+                'serviceVersion' => self::SERVICE_VERSION,
+                'operation' => self::SERVICE_NAME . 'Set',
+            ],
+        ];
+
+        $requestData = [
+            "cartId" => $cartId,
+            "couponCode" => $couponCode,
+        ];
+
+        $this->assertTrue($this->_webApiCall($serviceInfo, $requestData));
+
+        $quoteWithCoupon = $this->objectManager->create(\Magento\Quote\Model\Quote::class);
+        $quoteWithCoupon->load('test01', 'reserved_order_id');
+
+        $this->assertEquals($quoteWithCoupon->getCouponCode(), $couponCode);
+    }
 }
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_existing_images.csv b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_existing_images.csv
index a3e8f8e47ab08967bc128030b64def02b6232c78..1e7303d9b73086bdc93619bfb4db2e022dbb6559 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_existing_images.csv
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_media_existing_images.csv
@@ -1,2 +1,2 @@
 sku,store_view_code,attribute_set_code,product_type,categories,product_websites,name,description,short_description,weight,product_online,tax_class_name,visibility,price,special_price,special_price_from_date,special_price_to_date,url_key,meta_title,meta_keywords,meta_description,base_image,base_image_label,small_image,small_image_label,thumbnail_image,thumbnail_image_label,swatch_image,swatch_image_label1,created_at,updated_at,new_from_date,new_to_date,display_product_options_in,map_price,msrp_price,map_enabled,gift_message_available,custom_design,custom_design_from,custom_design_to,custom_layout_update,page_layout,product_options_container,msrp_display_actual_price_type,country_of_manufacture,additional_attributes,qty,out_of_stock_qty,use_config_min_qty,is_qty_decimal,allow_backorders,use_config_backorders,min_cart_qty,use_config_min_sale_qty,max_cart_qty,use_config_max_sale_qty,is_in_stock,notify_on_stock_below,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,related_skus,crosssell_skus,upsell_skus,additional_images,additional_image_labels,hide_from_product_page,custom_options,bundle_price_type,bundle_sku_type,bundle_price_view,bundle_weight_type,bundle_values,associated_skus
-simple_new,,Default,simple,,base,New Product,,,,1,Taxable Goods,"Catalog, Search",10,,,,new-product,New Product,New Product,New Product ,magento_image.jpg,Image Label,magento_small_image.jpg,Small Image Label,magento_thumbnail.jpg,Thumbnail Label,magento_image.jpg,Image Label,10/20/15 07:05,10/20/15 07:05,,,Block after Info Column,,,,,,,,,,,,,"has_options=1,quantity_and_stock_status=In Stock,required_options=1",100,0,1,0,0,1,1,1,10000,1,1,1,1,1,0,1,1,0,0,0,1,,,,"magento_additional_image_one.jpg, magento_additional_image_two.jpg","Additional Image Label One,Additional Image Label Two",,,,,,,,
+simple_new,,Default,simple,,base,New Product,,,,1,Taxable Goods,"Catalog, Search",10,,,,new-product,New Product,New Product,New Product ,magento_image(1).jpg,Image Label,magento_small_image.jpg,Small Image Label,magento_thumbnail.jpg,Thumbnail Label,magento_image(1).jpg,Image Label,10/20/15 07:05,10/20/15 07:05,,,Block after Info Column,,,,,,,,,,,,,"has_options=1,quantity_and_stock_status=In Stock,required_options=1",100,0,1,0,0,1,1,1,10000,1,1,1,1,1,0,1,1,0,0,0,1,,,,"magento_additional_image_one.jpg, magento_additional_image_two.jpg","Additional Image Label One,Additional Image Label Two",,,,,,,,
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_with_filesystem_images.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_with_filesystem_images.php
index 04b3092c8fa8ae1afec3b7bfd83cb31ef0f57059..23e8fbd5d0f3d120fd2091c515632bb2277fb945 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_with_filesystem_images.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/import_with_filesystem_images.php
@@ -20,7 +20,7 @@ $dirPath = $mediaDirectory->getAbsolutePath($path);
 $items = [
     [
         'source' => __DIR__ . '/../../../../../Magento/Catalog/_files/magento_image.jpg',
-        'dest' => $dirPath . '/magento_image.jpg',
+        'dest' => $dirPath . '/magento_image(1).jpg',
     ],
     [
         'source' => __DIR__ . '/../../../../../Magento/Catalog/_files/magento_small_image.jpg',
diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php
index a6b0fcc463e1df3f39d3373d7dad876fdfb96d94..bc1bc3a79688b28c174020a966a916b11cfe2f38 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/TermTest.php
@@ -24,7 +24,7 @@ class TermTest extends \PHPUnit\Framework\TestCase
     public function testGetSearchUrl()
     {
         $query = uniqid();
-        $obj = new \Magento\Framework\DataObject(['name' => $query]);
+        $obj = new \Magento\Framework\DataObject(['query_text' => $query]);
         $this->assertStringEndsWith("/catalogsearch/result/?q={$query}", $this->_block->getSearchUrl($obj));
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Search/Block/TermTest.php b/dev/tests/integration/testsuite/Magento/Search/Block/TermTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..c1b3b6062faadaeac23c01b69f9a5539b8cbac7e
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Search/Block/TermTest.php
@@ -0,0 +1,119 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Search\Block;
+
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\View\LayoutInterface;
+
+/**
+ * Tests Magento\Search\Block\Term.
+ *
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
+ */
+class TermTest extends \PHPUnit\Framework\TestCase
+{
+    /**
+     * @var ObjectManagerInterface
+     */
+    private $objectManager;
+
+    /**
+     * @var Term
+     */
+    private $term;
+
+    /**
+     * Tests Magento\Search\Block\Term::GetTerms.
+     *
+     * @magentoDataFixture Magento/Search/_files/query.php
+     * @dataProvider getTermsDataProvider
+     * @param array $expected
+     */
+    public function testGetTerms(array $expected)
+    {
+        $result = $this->term->getTerms();
+        $actual = array_map(
+            function ($object) {
+                return $object->setUpdatedAt(null)->getData();
+            },
+            $result
+        );
+
+        self::assertEquals(
+            $expected,
+            $actual
+        );
+    }
+
+    /**
+     * Data provider for testGetTerms.
+     *
+     * @return array
+     */
+    public function getTermsDataProvider()
+    {
+        return [
+            [
+                [
+                    '1st query' =>
+                        [
+                            'query_id' => '1',
+                            'query_text' => '1st query',
+                            'num_results' => '1',
+                            'popularity' => '5',
+                            'redirect' => null,
+                            'store_id' => '1',
+                            'display_in_terms' => '1',
+                            'is_active' => '1',
+                            'is_processed' => '1',
+                            'updated_at' => null,
+                            'ratio' => 0.44444444444444,
+                        ],
+                    '2nd query' =>
+                        [
+                            'query_id' => '2',
+                            'query_text' => '2nd query',
+                            'num_results' => '1',
+                            'popularity' => '10',
+                            'redirect' => null,
+                            'store_id' => '1',
+                            'display_in_terms' => '1',
+                            'is_active' => '1',
+                            'is_processed' => '1',
+                            'updated_at' => null,
+                            'ratio' => 1,
+                        ],
+                    '3rd query' =>
+                        [
+                            'query_id' => '3',
+                            'query_text' => '3rd query',
+                            'num_results' => '1',
+                            'popularity' => '1',
+                            'redirect' => null,
+                            'store_id' => '1',
+                            'display_in_terms' => '1',
+                            'is_active' => '1',
+                            'is_processed' => '1',
+                            'updated_at' => null,
+                            'ratio' => 0,
+                        ],
+                ],
+            ],
+        ];
+    }
+
+    protected function setUp()
+    {
+        $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+        $this->term = $this->objectManager->get(
+            LayoutInterface::class
+        )->createBlock(
+            Term::class
+        );
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Search/_files/query.php b/dev/tests/integration/testsuite/Magento/Search/_files/query.php
new file mode 100644
index 0000000000000000000000000000000000000000..f088da0e83a57b48d491b0685af387c80399aebf
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Search/_files/query.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+$queries = [
+    [
+        'text' => '1st query',
+        'results' => 1,
+        'popularity' => 5,
+        'display' => 1,
+        'active' => 1,
+        'processed' => 1
+    ],
+    [
+        'text' => '2nd query',
+        'results' => 1,
+        'popularity' => 10,
+        'display' => 1,
+        'active' => 1,
+        'processed' => 1
+    ],
+    [
+        'text' => '3rd query',
+        'results' => 1,
+        'popularity' => 1,
+        'display' => 1,
+        'active' => 1,
+        'processed' => 1
+    ],
+    [
+        'text' => '4th query',
+        'results' => 0,
+        'popularity' => 1,
+        'display' => 1,
+        'active' => 1,
+        'processed' => 1
+    ],
+];
+
+foreach ($queries as $queryData) {
+    /** @var $queryData \Magento\Search\Model\Query */
+    $query = $objectManager->create(\Magento\Search\Model\Query::class);
+    $query->setStoreId(1);
+    $query->setQueryText(
+        $queryData['text']
+    )->setNumResults(
+        $queryData['results']
+    )->setPopularity(
+        $queryData['popularity']
+    )->setDisplayInTerms(
+        $queryData['display']
+    )->setIsActive(
+        $queryData['active']
+    )->setIsProcessed(
+        $queryData['processed']
+    );
+    $query->save();
+}
diff --git a/dev/tests/integration/testsuite/Magento/Search/_files/query_rollback.php b/dev/tests/integration/testsuite/Magento/Search/_files/query_rollback.php
new file mode 100644
index 0000000000000000000000000000000000000000..87b2d112220ff379a9c5a6bb2cf7bbbd4c683695
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Search/_files/query_rollback.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+/** @var $query \Magento\Search\Model\Query */
+$query = $objectManager->get(\Magento\Search\Model\Query::class);
+
+$queries = [
+    '1st query',
+    '2nd query',
+    '3rd query',
+    '4th query',
+];
+
+foreach ($queries as $queryText) {
+    try {
+        $query->loadByQueryText($queryText);
+        $query->delete();
+    } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
+    }
+}