protected function setUp()
 {
     parent::setUp();
     $this->attributeSetCollectionFactoryMock = $this->getMockBuilder(CollectionFactory::class)->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->attributeSetCollectionMock = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->getMock();
     $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->disableOriginalConstructor()->getMock();
     $this->productResourceMock = $this->getMockBuilder(ProductResource::class)->disableOriginalConstructor()->getMock();
     $this->attributeSetCollectionFactoryMock->expects($this->any())->method('create')->willReturn($this->attributeSetCollectionMock);
     $this->productMock->expects($this->any())->method('getResource')->willReturn($this->productResourceMock);
     $this->attributeSetCollectionMock->expects($this->any())->method('setEntityTypeFilter')->willReturnSelf();
     $this->attributeSetCollectionMock->expects($this->any())->method('addFieldToSelect')->willReturnSelf();
 }
Example #2
0
 /**
  * @return $this
  */
 protected function _initAttributeSets()
 {
     $attributeSetOne = $this->getMockBuilder('\\Magento\\Eav\\Model\\Entity\\Attribute\\Set')->disableOriginalConstructor()->getMock();
     $attributeSetOne->expects($this->any())->method('getAttributeSetName')->willReturn('attributeSet1');
     $attributeSetOne->expects($this->any())->method('getId')->willReturn('1');
     $attributeSetTwo = $this->getMockBuilder('\\Magento\\Eav\\Model\\Entity\\Attribute\\Set')->disableOriginalConstructor()->getMock();
     $attributeSetTwo->expects($this->any())->method('getAttributeSetName')->willReturn('attributeSet2');
     $attributeSetTwo->expects($this->any())->method('getId')->willReturn('2');
     $attributeSetCol = [$attributeSetOne, $attributeSetTwo];
     $collection = $this->getMockBuilder('\\Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection')->disableOriginalConstructor()->getMock();
     $collection->expects($this->once())->method('setEntityTypeFilter')->with(self::ENTITY_TYPE_ID)->willReturn($attributeSetCol);
     $this->_setColFactory->expects($this->once())->method('create')->willReturn($collection);
     return $this;
 }