public function transformDataProvider() { $integration = new Integration(); $integration->setType(self::TEST_TYPE); $integration->setName(self::TEST_NAME); return ['should return null if empty data given' => ['$data' => null, '$expectedResult' => null], 'should return null if bad data given' => ['$data' => ['testBadData'], '$expectedResult' => null], 'should convert to expected array' => ['$data' => $integration, '$expectedResult' => ['type' => self::TEST_TYPE, 'data' => null, 'identifier' => $integration, 'name' => self::TEST_NAME]]]; }
/** * @Route("/create/{type}/{channelName}", requirements={"type"="\w+"}, name="orocrm_channel_integration_create") * @AclAncestor("oro_integration_create") * @Template("OroCRMChannelBundle:ChannelIntegration:update.html.twig") */ public function createAction($type, $channelName = null) { $translator = $this->get('translator'); $integrationName = urldecode($channelName) . ' ' . $translator->trans('orocrm.channel.data_source.label'); $integration = new Integration(); $integration->setType(urldecode($type)); $integration->setName(trim($integrationName)); return $this->update($integration); }
/** * {@inheritdoc} */ public function load(ObjectManager $manager) { $userManager = $this->container->get('oro_user.manager'); $admin = $userManager->findUserByEmail(LoadAdminUserData::DEFAULT_ADMIN_EMAIL); foreach ($this->data as $data) { $integration = new Integration(); $integration->setName($data['name']); $integration->setType($data['type']); $integration->setEnabled($data['enabled']); $integration->setDefaultUserOwner($admin); $integration->setOrganization($admin->getOrganization()); $this->setReference($data['reference'], $integration); $manager->persist($integration); } $manager->flush(); }
/** * {@inheritDoc} */ public function load(ObjectManager $om) { $this->organization = $this->getReference('default_organization'); $this->users = $om->getRepository('OroUserBundle:User')->findAll(); $website = new Website(); $website->setCode('admin')->setName('Admin'); $om->persist($website); $store = new Store(); $store->setCode('admin')->setName('Admin')->setWebsite($website); $om->persist($store); $transport = new MagentoSoapTransport(); $transport->setApiUser('api_user'); $transport->setApiKey('api_key'); $transport->setExtensionVersion(SoapTransport::REQUIRED_EXTENSION_VERSION); $transport->setIsExtensionInstalled(true); $transport->setMagentoVersion('1.9.1.0'); $transport->setWsdlUrl('http://magento.domain'); $om->persist($transport); $integration = new Integration(); $integration->setType('magento'); $integration->setConnectors(['customer', 'cart', 'order', 'newsletter_subscriber']); $integration->setName(self::INTEGRATION_NAME); $integration->setTransport($transport); $integration->setOrganization($this->organization); $om->persist($integration); $builder = $this->factory->createBuilderForIntegration($integration); $builder->setOwner($integration->getOrganization()); $builder->setDataSource($integration); $builder->setStatus($integration->isEnabled() ? Channel::STATUS_ACTIVE : Channel::STATUS_INACTIVE); $this->dataChannel = $builder->getChannel(); $om->persist($this->dataChannel); $group = new CustomerGroup(); $group->setName('General'); $group->setOriginId(15000); $group->setChannel($integration); $om->persist($group); $om->flush(); $this->persistDemoCustomers($om, $website, $store, $group, $integration); $om->flush(); $this->persistDemoCarts($om, $store, $integration); $om->flush(); $this->persistDemoOrders($om, $store, $integration); $om->flush(); $this->persistDemoRFM($om); $om->flush(); }
/** * @return $this */ protected function createIntegration() { $integration = new Integration(); $integration->setName('Demo Web store'); $integration->setType('magento'); $integration->setConnectors(["customer", "order", "cart", "region"]); $integration->setTransport($this->transport); $integration->setOrganization($this->organization); $this->em->persist($integration); $this->integration = $integration; return $this; }
protected function prepareEmMock() { $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $metadata = $this->getMockBuilder('Doctrine\\ORM\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock(); $repo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock(); $entity = new Integration(); $entity->setName(self::TEST_NAME); $entity->setType(self::TEST_TYPE); $this->registry->expects($this->once())->method('getManagerForClass')->with($this->equalTo($this->testEntityName))->will($this->returnValue($em)); $em->expects($this->once())->method('getClassMetadata')->with($this->equalTo($this->testEntityName))->will($this->returnValue($metadata)); $metadata->expects($this->once())->method('getSingleIdentifierFieldName')->will($this->returnValue(self::TEST_ID_FIELD_NAME)); $em->expects($this->once())->method('getRepository')->with($this->equalTo($this->testEntityName))->will($this->returnValue($repo)); $repo->expects($this->once())->method('find')->with($this->equalTo(self::TEST_ID))->will($this->returnValue($entity)); }
/** * @return $this */ protected function createIntegration() { $integration = new Integration(); $integration->setName('Demo Web store'); $integration->setType('magento'); $integration->setConnectors(['customer', 'order', 'cart']); $integration->setTransport($this->transport); $integration->setOrganization($this->organization); $synchronizationSettings = Object::create(['isTwoWaySyncEnabled' => true]); $integration->setSynchronizationSettings($synchronizationSettings); $this->em->persist($integration); $this->integration = $integration; return $this; }
public function dataTest() { $testContact = new ExtendContact(); $testContactAddress = new ContactAddress(); $testContactEmail = new ContactEmail(); $testContactPhone = new ContactPhone(); $testContactAddress->setOwner($testContact); $testContactEmail->setOwner($testContact); $testContactPhone->setOwner($testContact); $testMagentoCustomer = new ExtendCustomer(); $channel = new Channel(); $channel->getSynchronizationSettingsReference()->offsetSet('isTwoWaySyncEnabled', true); $channel->setName('test'); $channel->setEnabled(true); $testMagentoCustomer->setChannel($channel); return ['Updated contact' => [$testContact, $testMagentoCustomer, $channel, [], [$testContact], [], true, true, true, true, true], 'Inserted contact' => [$testContact, $testMagentoCustomer, $channel, [$testContact], [], [], true, false, false, true, false], 'Deleted contact' => [$testContact, $testMagentoCustomer, $channel, [], [], [$testContact], true, true, true, false, true], 'Updated contact with testContactAddress' => [$testContact, $testMagentoCustomer, $channel, [], [$testContact, $testContactAddress], [], true, true, true, true, true], 'Test process Contact Address' => [$testContact, $testMagentoCustomer, $channel, [], [$testContactAddress], [], true, true, true, false, true], 'Test deleted Contact Address' => [$testContact, $testMagentoCustomer, $channel, [], [], [$testContactAddress], true, true, true, false, true]]; }