コード例 #1
0
ファイル: Builder.php プロジェクト: Doability/magento2dev
 private function saveAttributeSet()
 {
     if ($this->attributeSetObj->getId()) {
         return array('result' => true, 'obj' => $this->attributeSetObj);
     }
     $this->attributeSetObj->setEntityTypeId($this->entityTypeId)->setAttributeSetName($this->setName);
     try {
         $this->attributeSetObj->validate();
         $this->attributeSetObj->save();
         $this->attributeSetObj->initFromSkeleton($this->skeletonId)->save();
     } catch (\Exception $e) {
         return array('result' => false, 'error' => $e->getMessage());
     }
     return array('result' => true, 'obj' => $this->attributeSetObj);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function validate()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'validate');
     if (!$pluginInfo) {
         return parent::validate();
     } else {
         return $this->___callPlugins('validate', func_get_args(), $pluginInfo);
     }
 }
コード例 #3
0
 public function testValidateWithNonexistentValidName()
 {
     $this->_model->getResource()->expects($this->any())->method('validate')->will($this->returnValue(true));
     $this->_model->setAttributeSetName('nonexistent_name');
     $this->assertTrue($this->_model->validate());
 }