12 class SetTest extends \PHPUnit\Framework\TestCase
22 $attrGroupFactory = $this->createMock(\
Magento\Eav\Model\Entity\
Attribute\GroupFactory::class);
23 $attrFactory = $this->createMock(\
Magento\Eav\Model\Entity\AttributeFactory::class);
25 'attrGroupFactory' => $attrGroupFactory,
26 'attributeFactory' => $attrFactory,
29 $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
45 $this->_model->getResource()->expects($this->any())->method(
'validate')->will($this->returnValue(
false));
47 $this->expectException(\
Magento\Framework\
Exception\LocalizedException::class);
48 $this->expectExceptionMessage($exceptionMessage);
49 $this->_model->setAttributeSetName($attributeSetName);
50 $this->_model->validate();
55 $this->_model->getResource()->expects($this->any())->method(
'validate')->will($this->returnValue(
true));
57 $this->_model->setAttributeSetName(
'nonexistent_name');
58 $this->assertTrue($this->_model->validate());
69 [
'',
'The attribute set name is empty. Enter the name and try again.'],
70 [
'existing_name',
'A "existing_name" attribute set name already exists. Create a new name and try again.']
invalidAttributeSetDataProvider()
testValidateWithExistingName($attributeSetName, $exceptionMessage)
testValidateWithNonexistentValidName()