6 declare(strict_types=1);
31 private $storeManager;
36 private $coreRegistry;
45 $this->storeManager = $this->getMockBuilder(StoreManager::class)
46 ->disableOriginalConstructor()
47 ->setMethods([
'getStore'])
48 ->getMockForAbstractClass();
49 $this->coreRegistry = $this->getMockBuilder(Registry::class)
50 ->disableOriginalConstructor()
51 ->setMethods([
'registry'])
59 'storeManager' => $this->storeManager,
60 'coreRegistry' => $this->coreRegistry,
75 $attributeMock = $this->getMockBuilder(AttributeAdapter::class)
76 ->disableOriginalConstructor()
77 ->setMethods([
'getAttributeCode'])
79 $attributeMock->expects($this->any())
80 ->method(
'getAttributeCode')
82 $store = $this->getMockBuilder(StoreInterface::class)
83 ->disableOriginalConstructor()
84 ->setMethods([
'getRootCategoryId'])
85 ->getMockForAbstractClass();
86 $store->expects($this->any())
87 ->method(
'getRootCategoryId')
89 $this->storeManager->expects($this->any())
94 $category = $this->getMockBuilder(CategoryInterface::class)
95 ->disableOriginalConstructor()
96 ->setMethods([
'getId'])
97 ->getMockForAbstractClass();
102 $this->coreRegistry->expects($this->any())
108 $this->resolver->getFieldName($attributeMock, $context)
118 [
'category_name', [],
true,
'name_category_1'],
119 [
'category_name', [],
false,
'name_category_2'],
120 [
'category_name', [
'categoryId' => 3],
false,
'name_category_3'],
121 [
'price', [
'categoryId' => 3],
false,
''],
testGetFieldName($attributeCode, $context, $fromRegistry, $expected)