Пример #1
0
 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']);
 }
 public function testProcessIntegrationConfigSuccess()
 {
     $this->configMock->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 = $this->getMockBuilder('Magento\\Integration\\Model\\Integration')->disableOriginalConstructor()->setMethods([])->getMock();
     $intLookupData1->expects($this->any())->method('getId')->willReturn(1);
     $intLookupData2 = $this->getMockBuilder('Magento\\Integration\\Model\\Integration')->disableOriginalConstructor()->setMethods([])->getMock();
     $intLookupData1->expects($this->any())->method('getId')->willReturn(false);
     $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($intLookupData2));
     $this->integrationServiceMock->expects($this->at(1))->method('update')->with($intUpdateData1);
     $this->integrationManager->processIntegrationConfig(['TestIntegration1', 'TestIntegration2']);
 }