6 declare(strict_types=1);
30 private $storeManager;
35 private $coreRegistry;
44 $this->storeManager = $this->getMockBuilder(StoreManager::class)
45 ->disableOriginalConstructor()
46 ->setMethods([
'getStore'])
47 ->getMockForAbstractClass();
48 $this->coreRegistry = $this->getMockBuilder(Registry::class)
49 ->disableOriginalConstructor()
50 ->setMethods([
'registry'])
56 \
Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldName\Resolver\Position::class,
58 'storeManager' => $this->storeManager,
59 'coreRegistry' => $this->coreRegistry,
74 $attributeMock = $this->getMockBuilder(AttributeAdapter::class)
75 ->disableOriginalConstructor()
76 ->setMethods([
'getAttributeCode'])
78 $attributeMock->expects($this->any())
79 ->method(
'getAttributeCode')
81 $store = $this->getMockBuilder(StoreInterface::class)
82 ->disableOriginalConstructor()
83 ->setMethods([
'getRootCategoryId'])
84 ->getMockForAbstractClass();
85 $store->expects($this->any())
86 ->method(
'getRootCategoryId')
88 $this->storeManager->expects($this->any())
93 $category = $this->getMockBuilder(CategoryInterface::class)
94 ->disableOriginalConstructor()
95 ->setMethods([
'getId'])
96 ->getMockForAbstractClass();
101 $this->coreRegistry->expects($this->any())
107 $this->resolver->getFieldName($attributeMock, $context)
117 [
'position', [],
true,
'position_category_1'],
118 [
'position', [],
false,
'position_category_2'],
119 [
'position', [
'categoryId' => 2],
false,
'position_category_2'],
120 [
'price', [
'categoryId' => 2],
false,
''],
testGetFieldName($attributeCode, $context, $fromRegistry, $expected)