/** * @expectedException \Magento\Framework\Exception\IntegrationException * @expectedExceptionMessage Integration with name 'Integration Name' exists. */ public function testCreateIntegrationAlreadyExistsException() { $this->_integrationMock->expects($this->any())->method('getId')->will($this->returnValue(self::VALUE_INTEGRATION_ID)); $this->_integrationMock->expects($this->any())->method('getData')->will($this->returnValue($this->_integrationData)); $this->_integrationMock->expects($this->any())->method('load')->with(self::VALUE_INTEGRATION_NAME, 'name')->will($this->returnValue($this->_integrationMock)); $this->_integrationMock->expects($this->never())->method('save')->will($this->returnSelf()); $this->_service->create($this->_integrationData); }
/** * {@inheritdoc} */ public function create(array $integrationData) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'create'); if (!$pluginInfo) { return parent::create($integrationData); } else { return $this->___callPlugins('create', func_get_args(), $pluginInfo); } }