예제 #1
0
 /**
  * @dataProvider integrationSettingFieldsProvider
  *
  * @param string $fieldName
  */
 public function testIntegrationSettings($fieldName)
 {
     $accessor = PropertyAccess::createPropertyAccessor();
     $referenceGetter = Inflector::camelize('get_' . $fieldName . '_reference');
     $this->assertTrue(method_exists($this->entity, $referenceGetter));
     $value = $accessor->getValue($this->entity, $fieldName);
     $this->assertNotEmpty($value);
     $this->assertInstanceOf('Oro\\Bundle\\DataGridBundle\\Common\\Object', $value);
     $newValue = Object::create([]);
     $accessor->setValue($this->entity, $fieldName, $newValue);
     $this->assertNotSame($value, $this->entity->{$referenceGetter}());
     $this->assertEquals($newValue, $accessor->getValue($this->entity, $fieldName));
     $this->assertNotSame($newValue, $accessor->getValue($this->entity, $fieldName));
     $this->assertSame($newValue, $this->entity->{$referenceGetter}());
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function doExecute(LoggerInterface $logger, $dryRun = false)
 {
     $values = $this->getOldValues($logger);
     $organizationId = $this->getDefaultOrganizationId($logger);
     $updateSql = 'UPDATE oro_integration_channel SET ' . 'synchronization_settings = :syncSettings, ' . 'mapping_settings = :mappingSettings, ' . 'enabled = :enabled ' . ($organizationId ? ', organization_id = :organizationId ' : '') . 'WHERE id = :id';
     foreach ($values as $row) {
         $params = ['syncSettings' => ConfigObject::create(['isTwoWaySyncEnabled' => (bool) $row['is_two_way_sync_enabled'], 'syncPriority' => $row['sync_priority']]), 'mappingSettings' => ConfigObject::create([]), 'enabled' => 1, 'id' => $row['id']];
         $types = ['syncSettings' => 'object', 'mappingSettings' => 'object', 'enabled' => 'integer', 'id' => 'integer'];
         if ($organizationId) {
             $params['organizationId'] = $organizationId;
             $types['organizationId'] = 'integer';
         }
         $this->logQuery($logger, $updateSql, $params, $types);
         if (!$dryRun) {
             $this->connection->executeUpdate($updateSql, $params, $types);
         }
     }
 }
예제 #3
0
 public function __construct()
 {
     $this->statuses = new ArrayCollection();
     $this->synchronizationSettings = ConfigObject::create([]);
     $this->mappingSettings = ConfigObject::create([]);
     $this->enabled = true;
     $this->editMode = self::EDIT_MODE_ALLOW;
 }
예제 #4
0
 /**
  * @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;
 }
예제 #5
0
 /**
  * @param bool $isEnabled
  * @param bool $isTwoWaySyncEnabled
  * @param bool $isSupportedExtensionVersion
  * @param int $channelId
  *
  * @return Channel|\PHPUnit_Framework_MockObject_MockObject
  */
 protected function getChannel($isEnabled = false, $isTwoWaySyncEnabled = false, $isSupportedExtensionVersion = false, $channelId = null)
 {
     $channel = $this->getMock('Oro\\Bundle\\IntegrationBundle\\Entity\\Channel');
     $settings = [];
     if (null !== $isTwoWaySyncEnabled) {
         $settings['isTwoWaySyncEnabled'] = $isTwoWaySyncEnabled;
     }
     $transport = $this->getMock('OroCRM\\Bundle\\MagentoBundle\\Entity\\MagentoSoapTransport');
     $transport->expects($this->any())->method('isSupportedExtensionVersion')->willReturn($isSupportedExtensionVersion);
     $settings = Object::create($settings);
     $channel->expects($this->any())->method('getSynchronizationSettings')->will($this->returnValue($settings));
     $channel->expects($this->any())->method('isEnabled')->will($this->returnValue($isEnabled));
     if ($channelId) {
         $channel->expects($this->any())->method('getId')->will($this->returnValue($channelId));
     }
     $channel->expects($this->any())->method('getTransport')->will($this->returnValue($transport));
     return $channel;
 }
예제 #6
0
 /**
  * @param array $params
  * @param string $path
  * @param bool $expected
  * @dataProvider getOffsetGetByPathDataProvider
  */
 public function testOffsetGetByPath(array $params, $path, $expected)
 {
     $object = Object::create($params);
     $this->assertEquals($expected, $object->offsetExistByPath($path));
 }