public function testProcessIntegrationConfigSuccess() { $this->_integrationConfigMock->expects($this->once())->method('getIntegrations')->will($this->returnValue(['TestIntegration1' => ['email' => '*****@*****.**', 'endpoint_url' => 'http://endpoint.com', 'identity_link_url' => 'http://www.example.com/identity'], 'TestIntegration2' => ['email' => '*****@*****.**']])); $intLookupData1 = new \Magento\Framework\Object(['id' => 1, Integration::NAME => 'TestIntegration1', Integration::SETUP_TYPE => 1]); $intUpdateData1 = [Integration::ID => 1, Integration::NAME => 'TestIntegration1', Integration::EMAIL => '*****@*****.**', Integration::ENDPOINT => 'http://endpoint.com', Integration::IDENTITY_LINK_URL => 'http://www.example.com/identity', Integration::SETUP_TYPE => 1]; $integrationsData2 = [Integration::NAME => 'TestIntegration2', Integration::EMAIL => '*****@*****.**', Integration::SETUP_TYPE => 1]; $this->_integrationServiceMock->expects($this->at(0))->method('findByName')->with('TestIntegration1')->will($this->returnValue($intLookupData1)); $this->_integrationServiceMock->expects($this->once())->method('create')->with($integrationsData2); $this->_integrationServiceMock->expects($this->at(2))->method('findByName')->with('TestIntegration2')->will($this->returnValue(new \Magento\Framework\Object([]))); $this->_integrationServiceMock->expects($this->once())->method('update')->with($intUpdateData1); $this->_integrationManager->processIntegrationConfig(['TestIntegration1', 'TestIntegration2']); }
/** * Initiate integration processing * * @param array $integrationNames * @return array of integration names sent to the next invocation */ public function initIntegrationProcessing(array $integrationNames) { $this->_integrationManager->processIntegrationConfig($integrationNames); return $integrationNames; }