Пример #1
0
 public function testDeleteDocumentBackup()
 {
     $docName = 'somename';
     $this->adapter->expects($this->once())->method('deleteBackup')->with('pfx_' . $docName);
     $this->config->expects($this->once())->method('getOption')->with('dest_prefix')->will($this->returnValue('pfx_'));
     $this->resourceDestination->deleteDocumentBackup($docName);
 }
Пример #2
0
 public function testGetRecords()
 {
     $resourceName = 'core_config_data';
     $pageNumber = 2;
     $this->config->expects($this->at(0))->method('getOption')->with('bulk_size')->will($this->returnValue(100));
     $this->config->expects($this->at(1))->method('getOption')->with('dest_prefix')->will($this->returnValue(100));
     $this->adapter->expects($this->once())->method('loadPage');
     $this->resourceDestination->getRecords($resourceName, $pageNumber);
 }
Пример #3
0
 /**
  * @param string $sourceDocument
  * @return \Magento\Framework\DB\Select
  */
 protected function getConfigurablePrice($sourceDocument)
 {
     $sourceDocumentName = $this->source->addDocumentPrefix($sourceDocument);
     $fields = ['store_id' => 'website_id', 'value' => 'pricing_value', 'entity_id' => 'l.product_id', 'attribute_id' => 'cpsa.attribute_id'];
     /** @var \Magento\Framework\DB\Select $select */
     $select = $this->sourceAdapter->getSelect();
     $select->from($sourceDocumentName, $fields)->joinInner(['cpsa' => $this->source->addDocumentPrefix('catalog_product_super_attribute')], 'cpsa.product_super_attribute_id = ' . $sourceDocumentName . '.product_super_attribute_id', [])->joinInner(['l' => $this->source->addDocumentPrefix('catalog_product_super_link')], 'cpsa.product_id = l.parent_id', [])->joinInner(['a' => $this->source->addDocumentPrefix('catalog_product_super_attribute')], 'l.parent_id = a.product_id', [])->joinInner(['cp' => $this->source->addDocumentPrefix('catalog_product_entity_int')], 'l.product_id = cp.entity_id AND cp.attribute_id = a.attribute_id AND cp.store_id = ' . $sourceDocumentName . '.website_id', [])->joinInner(['apd' => $this->source->addDocumentPrefix('catalog_product_super_attribute_pricing')], 'a.product_super_attribute_id = apd.product_super_attribute_id AND apd.pricing_value = ' . $sourceDocumentName . '.pricing_value AND cp.value = apd.value_index', [])->joinInner(['le' => $this->source->addDocumentPrefix('catalog_product_entity')], 'le.entity_id = l.product_id', []);
     return $select;
 }
Пример #4
0
 /**
  * @param array $columns
  * @param array $entityIds
  * @return \Magento\Framework\DB\Select
  */
 public function getSelectSalesCreditmemoGrid(array $columns, $entityIds = [])
 {
     foreach ($columns as $key => $value) {
         $columns[$key] = new \Zend_Db_Expr($value);
     }
     /** @var \Magento\Framework\DB\Select $select */
     $select = $this->destinationAdapter->getSelect();
     $select->from(['sales_creditmemo' => $this->destination->addDocumentPrefix('sales_creditmemo')], [])->joinLeft(['sales_order' => $this->destination->addDocumentPrefix('sales_order')], 'sales_creditmemo.order_id = sales_order.entity_id', [])->joinLeft(['sales_shipping_address' => $this->destination->addDocumentPrefix('sales_order_address')], 'sales_creditmemo.shipping_address_id = sales_shipping_address.entity_id', [])->joinLeft(['sales_billing_address' => $this->destination->addDocumentPrefix('sales_order_address')], 'sales_creditmemo.billing_address_id = sales_billing_address.entity_id', [])->where('sales_creditmemo.entity_id in (?)', $entityIds);
     $select->columns($columns);
     return $select;
 }
Пример #5
0
 public function testVolumeCheckFailed()
 {
     $this->ratings = new Ratings($this->destination, $this->logger, $this->progress, 'volume');
     $this->progress->expects($this->once())->method('start')->with(1);
     $this->progress->expects($this->once())->method('advance');
     $this->progress->expects($this->once())->method('finish');
     $this->destination->expects($this->once())->method('getAdapter')->willReturn($this->adapter);
     $this->adapter->expects($this->exactly(2))->method('getSelect')->willReturn($this->select);
     $this->select->expects($this->at(0))->method('from')->with('rating_store', ['rating_id'])->will($this->returnSelf());
     $this->select->expects($this->at(1))->method('where')->with('store_id > 0')->will($this->returnSelf());
     $this->adapter->expects($this->at(1))->method('loadDataFromSelect')->with($this->select)->willReturn([['rating_id' => 1]]);
     $this->adapter->expects($this->at(3))->method('loadDataFromSelect')->with($this->select)->willReturn([['rating_id' => 2]]);
     $this->select->expects($this->at(2))->method('from')->with('rating', ['rating_id'])->will($this->returnSelf());
     $this->select->expects($this->at(3))->method('where')->with('is_active = ?', 1)->will($this->returnSelf());
     $this->logger->expects($this->once())->method('warning')->with('Mismatch of entities in the documents: rating, rating_store');
     $this->assertFalse($this->ratings->perform());
 }
 public function testGetDeletedRecords()
 {
     $this->adapter->expects($this->once())->method('loadDeletedRecords')->with('m2_cl_document', 'key_field', 0, 100);
     $this->resourceSource->getDeletedRecords('document', 'key_field');
 }
Пример #7
0
 public function testDeleteBackup()
 {
     $this->pdoMysql->expects($this->once())->method('isTableExists')->willReturn(true);
     $this->pdoMysql->expects($this->once())->method('dropTable')->with('migration_backup_document_name');
     $this->adapterMysql->deleteBackup('document_name');
 }
 /**
  * Fulfill temporary table with redirects
  *
  * @param \Migration\Resource\Adapter\Mysql $adapter
  * @return void
  */
 protected function collectRedirects(\Migration\Resource\Adapter\Mysql $adapter)
 {
     $select = $adapter->getSelect();
     $select->from(['r' => $this->source->addDocumentPrefix('enterprise_url_rewrite')], ['id' => 'IFNULL(NULL, NULL)', 'request_path' => 'r.request_path', 'target_path' => 'r.target_path', 'is_system' => 'r.is_system', 'store_id' => "s.store_id", 'entity_type' => "trim('custom')", 'redirect_type' => "(SELECT CASE eurr.options WHEN 'RP' THEN 301 WHEN 'R' THEN 302 ELSE 0 END)", 'product_id' => "trim('0')", 'category_id' => "trim('0')", 'priority' => "trim('2')"]);
     $select->join(['eurrr' => $this->source->addDocumentPrefix('enterprise_url_rewrite_redirect_rewrite')], 'eurrr.url_rewrite_id = r.url_rewrite_id', []);
     $select->join(['eurr' => $this->source->addDocumentPrefix('enterprise_url_rewrite_redirect')], 'eurrr.redirect_id = eurr.redirect_id', []);
     $select->join(['s' => $this->source->addDocumentPrefix('core_store')], 's.store_id > 0', []);
     $query = $select->insertFromSelect($this->source->addDocumentPrefix($this->tableName));
     $select->getAdapter()->query($query);
 }
Пример #9
0
 public function testGetDeletedRecords()
 {
     $this->adapter->expects($this->once())->method('loadDeletedRecords')->with('m2_cl_document', 'key_field', 0, 100);
     $this->config->expects($this->any())->method('getOption')->willReturnMap([['source_prefix', ''], ['bulk_size', 100]]);
     $this->resourceSource->getDeletedRecords('document', 'key_field');
 }