Skip to content

Commit 07d75d2

Browse files
author
Prabhu Ram
committed
MC-21228: Support partial word search in Elasticsearch
- Added fixtures for api tests
1 parent 46e60ff commit 07d75d2

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var $product \Magento\Catalog\Model\Product */
8+
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
9+
$product->isObjectNew(true);
10+
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
11+
->setId(10)
12+
->setAttributeSetId(4)
13+
->setName('Simple Product1')
14+
->setSku('prd1sku')
15+
->setTaxClassId('none')
16+
->setDescription('description')
17+
->setShortDescription('short description')
18+
->setOptionsContainer('container1')
19+
->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_IN_CART)
20+
->setPrice(10)
21+
->setWeight(1)
22+
->setMetaTitle('meta title')
23+
->setMetaKeyword('meta keyword')
24+
->setMetaDescription('meta description')
25+
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
26+
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
27+
->setWebsiteIds([1])
28+
->setCategoryIds([])
29+
->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1])
30+
->setSpecialPrice('5.99')
31+
->save();
32+
33+
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
34+
$product->isObjectNew(true);
35+
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
36+
->setId(11)
37+
->setAttributeSetId(4)
38+
->setName('Simple Product2')
39+
->setSku('prd2-sku2')
40+
->setTaxClassId('none')
41+
->setDescription('description')
42+
->setShortDescription('short description')
43+
->setOptionsContainer('container1')
44+
->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_ON_GESTURE)
45+
->setPrice(20)
46+
->setWeight(1)
47+
->setMetaTitle('meta title')
48+
->setMetaKeyword('meta keyword')
49+
->setMetaDescription('meta description')
50+
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG)
51+
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
52+
->setWebsiteIds([1])
53+
->setCategoryIds([])
54+
->setStockData(['use_config_manage_stock' => 1, 'qty' => 50, 'is_qty_decimal' => 0, 'is_in_stock' => 1])
55+
->setSpecialPrice('15.99')
56+
->save();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
8+
9+
/** @var \Magento\Framework\Registry $registry */
10+
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
11+
12+
$registry->unregister('isSecureArea');
13+
$registry->register('isSecureArea', true);
14+
15+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
16+
$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
17+
18+
foreach (['prd1sku', 'prd2-sku2'] as $sku) {
19+
try {
20+
$product = $productRepository->get($sku, false, null, true);
21+
$productRepository->delete($product);
22+
} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
23+
//Product already removed
24+
}
25+
}
26+
27+
$registry->unregister('isSecureArea');
28+
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)