26 $this->attributeMock = $this->getMockBuilder(\
Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class)
27 ->setMethods([
'getId'])
28 ->disableOriginalConstructor()
31 $registryMock = $this->getMockBuilder(\
Magento\Framework\Registry::class)
32 ->setMethods([
'registry'])
33 ->disableOriginalConstructor()
35 $registryMock->expects($this->atLeastOnce())->method(
'registry')->willReturn($this->attributeMock);
37 $this->attributeConfigMock = $this->getMockBuilder(\
Magento\Eav\Model\Entity\Attribute\Config::class)
38 ->setMethods([
'getLockedFields'])
39 ->disableOriginalConstructor()
42 $this->formMock = $this->getMockBuilder(\
Magento\Framework\Data\Form::class)
43 ->setMethods([
'getElement'])
44 ->disableOriginalConstructor()
47 $this->
object =
new PropertyLocker($registryMock, $this->attributeConfigMock);
56 'is_searchable' =>
'is_searchable',
57 'is_filterable' =>
'is_filterable' 59 $this->attributeMock->expects($this->once())->method(
'getId')->willReturn(1);
60 $this->attributeConfigMock->expects($this->once())->method(
'getLockedFields')->willReturn($lockedFields);
62 $elementMock = $this->getMockBuilder(\
Magento\Framework\Data\Form\Element\AbstractElement::class)
63 ->setMethods([
'setDisabled',
'setReadonly'])
64 ->disableOriginalConstructor()
65 ->getMockForAbstractClass();
66 $elementMock->expects($this->exactly(2))->method(
'setDisabled');
67 $elementMock->expects($this->exactly(2))->method(
'setReadonly');
68 $this->formMock->expects($this->exactly(2))->method(
'getElement')->willReturn($elementMock);
69 $this->
object->lock($this->formMock);