public function testProcessConfigBasedIntegrationsCreateNewIntegrations() { $integrations = ['TestIntegration1' => [Integration::EMAIL => '*****@*****.**', Integration::ENDPOINT => 'http://endpoint.com', Integration::IDENTITY_LINK_URL => 'http://www.example.com/identity', 'resources' => ['Magento_Customer::manage', 'Magento_Customer::customer']], 'TestIntegration2' => [Integration::EMAIL => '*****@*****.**', Integration::ENDPOINT => 'http://endpoint.com', Integration::IDENTITY_LINK_URL => 'http://www.example.com/identity']]; $integrationObject = $this->getMockBuilder('Magento\\Integration\\Model\\Integration')->disableOriginalConstructor()->setMethods([])->getMock(); // Integration1 does not exist, so create it $this->integrationServiceMock->expects($this->at(0))->method('findByName')->with('TestIntegration1')->will($this->returnValue($integrationObject)); $integrationObject->expects($this->any())->method('getId')->willReturn(false); $this->integrationServiceMock->expects($this->any())->method('create'); // Integration2 does not exist, so create it $this->integrationServiceMock->expects($this->at(2))->method('findByName')->with('TestIntegration2')->will($this->returnValue($integrationObject)); $this->integrationManager->processConfigBasedIntegrations($integrations); }
/** * {@inheritdoc} */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $this->integrationManager->processConfigBasedIntegrations($this->integrationConfig->getIntegrations()); }