Example #1
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     $this->configWriter->save('sales/msrp/enabled', 1);
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             $productId = $this->getProductIdBySku($row['sku']);
             if (!$productId) {
                 continue;
             }
             /** @var \Magento\Catalog\Model\Product $product */
             $product = $this->productCollection->getItemById($productId);
             $product->setMsrpDisplayActualPriceType(Type::TYPE_ON_GESTURE);
             if (!empty($row['msrp'])) {
                 $price = $row['msrp'];
             } else {
                 $price = $product->getPrice() * 1.1;
             }
             $product->setMsrp($price);
             $product->save();
         }
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             /** @var \Magento\Customer\Model\Customer $customer */
             $customer = $this->helper->getCustomerByEmail($row['customer_email']);
             if (!$customer) {
                 continue;
             }
             /** @var \Magento\Wishlist\Model\Wishlist $wishlist */
             $wishlist = $this->wishlistFactory->create();
             $wishlist->loadByCustomerId($customer->getId(), true);
             if (!$wishlist->getId()) {
                 continue;
             }
             $productSkuList = explode("\n", $row['product_list']);
             $this->helper->addProductsToWishlist($wishlist, $productSkuList);
         }
     }
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
     $adapter = $this->resource->getConnection('core_write');
     $regions = $this->loadDirectoryRegions();
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
             try {
                 $adapter->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsite()->getId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
             } catch (\Zend_Db_Statement_Exception $e) {
                 if ($e->getCode() == self::ERROR_CODE_DUPLICATE_ENTRY) {
                     // In case if Sample data was already installed we just skip duplicated records installation
                     continue;
                 } else {
                     throw $e;
                 }
             }
         }
     }
     $this->configWriter->save('carriers/tablerate/active', 1);
     $this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
     $this->cacheTypeList->cleanType('config');
 }
Example #4
0
 /**
  * @param array $fixtures
  * @throws \Exception
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             $row['customer_group_ids'] = $this->getGroupIds();
             $row['website_ids'] = $this->getWebsiteIds();
             $row['conditions_serialized'] = $this->convertSerializedData($row['conditions_serialized']);
             $row['actions_serialized'] = $this->convertSerializedData($row['actions_serialized']);
             $ruleModel = $this->ruleFactory->create();
             $ruleModel->loadPost($row);
             $ruleModel->save();
         }
     }
     $ruleJob = $this->jobFactory->create();
     $ruleJob->applyAll();
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $file) {
         $fileName = $this->fixtureManager->getFixture($file);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         $isFirst = true;
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             if ($isFirst) {
                 $customer = $this->customerRepository->get($row['customer_email']);
                 if (!$customer->getId()) {
                     continue;
                 }
                 /** @var \Magento\Sales\Model\ResourceModel\Collection $orderCollection */
                 $orderCollection = $this->orderCollectionFactory->create();
                 $orderCollection->addFilter('customer_id', $customer->getId());
                 if ($orderCollection->count() > 0) {
                     break;
                 }
             }
             $isFirst = false;
             $orderData = $this->converter->convertRow($row);
             $this->orderProcessor->createOrder($orderData);
         }
     }
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function install($fixtures)
 {
     foreach ($fixtures as $fixture) {
         $filePath = $this->fixtureManager->getFixture($fixture);
         $rows = $this->csvReader->getData($filePath);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             // Collect customer profile and addresses data
             $customerData['profile'] = $this->convertRowData($row, $this->getDefaultCustomerProfile());
             if (!$this->accountManagement->isEmailAvailable($customerData['profile']['email'])) {
                 continue;
             }
             $customerData['address'] = $this->convertRowData($row, $this->getDefaultCustomerAddress());
             $customerData['address']['region_id'] = $this->getRegionId($customerData['address']);
             $address = $customerData['address'];
             $regionData = [RegionInterface::REGION_ID => $address['region_id'], RegionInterface::REGION => !empty($address['region']) ? $address['region'] : null, RegionInterface::REGION_CODE => !empty($address['region_code']) ? $address['region_code'] : null];
             $region = $this->regionFactory->create();
             $this->dataObjectHelper->populateWithArray($region, $regionData, '\\Magento\\Customer\\Api\\Data\\RegionInterface');
             $addresses = $this->addressFactory->create();
             unset($customerData['address']['region']);
             $this->dataObjectHelper->populateWithArray($addresses, $customerData['address'], '\\Magento\\Customer\\Api\\Data\\AddressInterface');
             $addresses->setRegion($region)->setIsDefaultBilling(true)->setIsDefaultShipping(true);
             $customer = $this->customerFactory->create();
             $this->dataObjectHelper->populateWithArray($customer, $customerData['profile'], '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
             $customer->setAddresses([$addresses]);
             $this->appState->emulateAreaCode('frontend', [$this->accountManagement, 'createAccount'], [$customer, $row['password']]);
         }
     }
 }
Example #7
0
 /**
  * @param array $productFixtures
  * @param array $galleryFixtures
  * @throws \Exception
  */
 public function install(array $productFixtures, array $galleryFixtures)
 {
     $this->eavConfig->clear();
     $this->setGalleryFixtures($galleryFixtures);
     $product = $this->productFactory->create();
     foreach ($productFixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             $attributeSetId = $this->catalogConfig->getAttributeSetId(4, $row['attribute_set']);
             $this->converter->setAttributeSetId($attributeSetId);
             $data = $this->converter->convertRow($row);
             $product->unsetData();
             $product->setData($data);
             $product->setTypeId($this->productType)->setAttributeSetId($attributeSetId)->setWebsiteIds([$this->storeManager->getDefaultStoreView()->getWebsiteId()])->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)->setStockData(['is_in_stock' => 1, 'manage_stock' => 0])->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
             if (empty($data['visibility'])) {
                 $product->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH);
             }
             $this->prepareProduct($product, $data);
             $product->save();
             $this->installGallery($product);
         }
     }
 }
Example #8
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             if ($this->rateFactory->create()->loadByCode($data['code'])->getId()) {
                 continue;
             }
             $taxRate = $this->rateFactory->create();
             $taxRate->setCode($data['code'])->setTaxCountryId($data['tax_country_id'])->setTaxRegionId($data['tax_region_id'])->setTaxPostcode($data['tax_postcode'])->setRate($data['rate']);
             $this->taxRateRepository->save($taxRate);
         }
         $fixtureFile = 'Magento_TaxSampleData::fixtures/tax_rule.csv';
         $fixtureFileName = $this->fixtureManager->getFixture($fixtureFile);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fixtureFileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $filter = $this->filterBuilder->setField('code')->setConditionType('=')->setValue($data['code'])->create();
             $criteria = $this->criteriaBuilder->addFilters([$filter])->create();
             $existingRates = $this->taxRuleRepository->getList($criteria)->getItems();
             if (!empty($existingRates)) {
                 continue;
             }
             $taxRate = $this->taxRateFactory->create()->loadByCode($data['tax_rate']);
             $taxRule = $this->ruleFactory->create();
             $taxRule->setCode($data['code'])->setTaxRateIds([$taxRate->getId()])->setCustomerTaxClassIds([$data['tax_customer_class']])->setProductTaxClassIds([$data['tax_product_class']])->setPriority($data['priority'])->setCalculateSubtotal($data['calculate_subtotal'])->setPosition($data['position']);
             $this->taxRuleRepository->save($taxRule);
         }
     }
 }
Example #9
0
 /**
  * @param array $fixtures
  * @throws \Exception
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $this->createCategory($data);
         }
     }
 }
Example #10
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     $pageGroupConfig = ['pages' => ['block' => '', 'for' => 'all', 'layout_handle' => 'default', 'template' => 'widget/static_block/default.phtml', 'page_id' => ''], 'all_pages' => ['block' => '', 'for' => 'all', 'layout_handle' => 'default', 'template' => 'widget/static_block/default.phtml', 'page_id' => ''], 'anchor_categories' => ['entities' => '', 'block' => '', 'for' => 'all', 'is_anchor_only' => 0, 'layout_handle' => 'catalog_category_view_type_layered', 'template' => 'widget/static_block/default.phtml', 'page_id' => '']];
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             /** @var \Magento\Widget\Model\ResourceModel\Widget\Instance\Collection $instanceCollection */
             $instanceCollection = $this->appCollectionFactory->create();
             $instanceCollection->addFilter('title', $row['title']);
             if ($instanceCollection->count() > 0) {
                 continue;
             }
             /** @var \Magento\Cms\Model\Block $block */
             $block = $this->cmsBlockFactory->create()->load($row['block_identifier'], 'identifier');
             if (!$block) {
                 continue;
             }
             $widgetInstance = $this->widgetFactory->create();
             $code = $row['type_code'];
             $themeId = $this->themeCollectionFactory->create()->getThemeByFullPath($row['theme_path'])->getId();
             $type = $widgetInstance->getWidgetReference('code', $code, 'type');
             $pageGroup = [];
             $group = $row['page_group'];
             $pageGroup['page_group'] = $group;
             $pageGroup[$group] = array_merge($pageGroupConfig[$group], unserialize($row['group_data']));
             if (!empty($pageGroup[$group]['entities'])) {
                 $pageGroup[$group]['entities'] = $this->getCategoryByUrlKey($pageGroup[$group]['entities'])->getId();
             }
             $widgetInstance->setType($type)->setCode($code)->setThemeId($themeId);
             $widgetInstance->setTitle($row['title'])->setStoreIds([\Magento\Store\Model\Store::DEFAULT_STORE_ID])->setWidgetParameters(['block_id' => $block->getId()])->setPageGroups([$pageGroup]);
             $widgetInstance->save();
         }
     }
 }
Example #11
0
 /**
  * Set fixtures
  *
  * @param array $fixtures
  * @return void
  */
 public function setFixtures(array $fixtures)
 {
     $this->images = [];
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $this->images[$data['sku']][] = $data['image'];
         }
     }
 }
Example #12
0
 /**
  * @param array $fixtures
  * @throws \Exception
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             $this->pageFactory->create()->load($row['identifier'], 'identifier')->addData($row)->setStores([\Magento\Store\Model\Store::DEFAULT_STORE_ID])->save();
         }
     }
 }
Example #13
0
 public function install(array $fixtures)
 {
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             $data = $this->converter->convertRow($row);
             $cmsBlock = $this->saveCmsBlock($data['block']);
             $cmsBlock->unsetData();
         }
     }
 }
 /**
  * Import Tax Rates from CSV file
  *
  * @param array $file file info retrieved from $_FILES array
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function importFromCsvFile($file)
 {
     if (!isset($file['tmp_name'])) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Invalid file upload attempt.'));
     }
     $ratesRawData = $this->csvProcessor->getData($file['tmp_name']);
     // first row of file represents headers
     $fileFields = $ratesRawData[0];
     $validFields = $this->_filterFileFields($fileFields);
     $invalidFields = array_diff_key($fileFields, $validFields);
     $ratesData = $this->_filterRateData($ratesRawData, $invalidFields, $validFields);
     // store cache array is used to quickly retrieve store ID when handling locale-specific tax rate titles
     $storesCache = $this->_composeStoreCache($validFields);
     $regionsCache = [];
     foreach ($ratesData as $rowIndex => $dataRow) {
         // skip headers
         if ($rowIndex == 0) {
             continue;
         }
         $regionsCache = $this->_importRate($dataRow, $regionsCache, $storesCache);
     }
 }
Example #15
0
 /**
  * @param array $fixtures
  * @throws \Exception
  */
 public function install(array $fixtures)
 {
     $attributeCount = 0;
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $data['attribute_set'] = explode("\n", $data['attribute_set']);
             /** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
             $attribute = $this->eavConfig->getAttribute('catalog_product', $data['attribute_code']);
             if (!$attribute) {
                 $attribute = $this->attributeFactory->create();
             }
             $frontendLabel = explode("\n", $data['frontend_label']);
             if (count($frontendLabel) > 1) {
                 $data['frontend_label'] = [];
                 $data['frontend_label'][\Magento\Store\Model\Store::DEFAULT_STORE_ID] = $frontendLabel[0];
                 $data['frontend_label'][$this->storeManager->getDefaultStoreView()->getStoreId()] = $frontendLabel[1];
             }
             $data['option'] = $this->getOption($attribute, $data);
             $data['source_model'] = $this->productHelper->getAttributeSourceModelByInputType($data['frontend_input']);
             $data['backend_model'] = $this->productHelper->getAttributeBackendModelByInputType($data['frontend_input']);
             $data += ['is_filterable' => 0, 'is_filterable_in_search' => 0, 'apply_to' => []];
             $data['backend_type'] = $attribute->getBackendTypeByInput($data['frontend_input']);
             $attribute->addData($data);
             $attribute->setIsUserDefined(1);
             $attribute->setEntityTypeId($this->getEntityTypeId());
             $attribute->save();
             $attributeId = $attribute->getId();
             if (is_array($data['attribute_set'])) {
                 foreach ($data['attribute_set'] as $setName) {
                     $setName = trim($setName);
                     $attributeCount++;
                     $attributeSet = $this->processAttributeSet($setName);
                     $attributeGroupId = $attributeSet->getDefaultGroupId();
                     $attribute = $this->attributeFactory->create();
                     $attribute->setId($attributeId)->setAttributeGroupId($attributeGroupId)->setAttributeSetId($attributeSet->getId())->setEntityTypeId($this->getEntityTypeId())->setSortOrder($attributeCount + 999)->save();
                 }
             }
         }
     }
     $this->eavConfig->clear();
 }
Example #16
0
 /**
  * {@inheritdoc}
  */
 public function install(array $related, array $upsell, array $crosssell)
 {
     $linkTypes = ['related' => $related, 'upsell' => $upsell, 'crosssell' => $crosssell];
     foreach ($linkTypes as $linkType => $fixtures) {
         foreach ($fixtures as $fileName) {
             $fileName = $this->fixtureManager->getFixture($fileName);
             if (!file_exists($fileName)) {
                 continue;
             }
             $rows = $this->csvReader->getData($fileName);
             $header = array_shift($rows);
             foreach ($rows as $row) {
                 $data = [];
                 foreach ($row as $key => $value) {
                     $data[$header[$key]] = $value;
                 }
                 $row = $data;
                 /** @var \Magento\Catalog\Model\Product $product */
                 $product = $this->productFactory->create();
                 $productId = $product->getIdBySku($row['sku']);
                 if (!$productId) {
                     continue;
                 }
                 $product->setId($productId);
                 $links = [$linkType => []];
                 foreach (explode("\n", $row['linked_sku']) as $linkedProductSku) {
                     $linkedProductId = $product->getIdBySku($linkedProductSku);
                     if ($linkedProductId) {
                         $links[$linkType][$linkedProductId] = [];
                     }
                 }
                 $this->linksInitializer->initializeLinks($product, $links);
                 $product->getLinkInstance()->saveProductRelations($product);
             }
         }
     }
 }
Example #17
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     $attribute = $this->eavConfig->getAttribute('catalog_product', 'sku');
     if ($attribute->getIsUsedForPromoRules() == 0) {
         $attribute->setIsUsedForPromoRules('1')->save();
     }
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             /** @var \Magento\SalesRule\Model\ResourceModel\Rule\Collection $ruleCollection */
             $ruleCollection = $this->ruleCollectionFactory->create();
             $ruleCollection->addFilter('name', $row['name']);
             if ($ruleCollection->count() > 0) {
                 continue;
             }
             $row['customer_group_ids'] = $this->catalogRule->getGroupIds();
             $row['website_ids'] = $this->catalogRule->getWebsiteIds();
             $row['conditions_serialized'] = $this->catalogRule->convertSerializedData($row['conditions_serialized']);
             $row['actions_serialized'] = $this->catalogRule->convertSerializedData($row['actions_serialized']);
             /** @var \Magento\SalesRule\Model\Rule $rule */
             $rule = $this->ruleFactory->create();
             $rule->loadPost($row);
             $rule->save();
         }
     }
 }
Example #18
0
 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $row = $data;
             $storeId = [$this->storeManager->getDefaultStoreView()->getStoreId()];
             $review = $this->prepareReview($row);
             $this->createRating($row['rating_code'], $storeId);
             $productId = $this->getProductIdBySku($row['sku']);
             if (empty($productId)) {
                 continue;
             }
             /** @var \Magento\Review\Model\ResourceModel\Review\Collection $reviewCollection */
             $reviewCollection = $this->reviewCollectionFactory->create();
             $reviewCollection->addFilter('entity_pk_value', $productId)->addFilter('entity_id', $this->getReviewEntityId())->addFieldToFilter('detail.title', ['eq' => $row['title']]);
             if ($reviewCollection->getSize() > 0) {
                 continue;
             }
             if (!empty($row['email']) && $this->getCustomerIdByEmail($row['email']) != null) {
                 $review->setCustomerId($this->getCustomerIdByEmail($row['email']));
             }
             $review->save();
             $this->setReviewRating($review, $row);
         }
     }
 }
Example #19
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage File "FileNameThatShouldNotExist" does not exist
  */
 public function testGetDataFileNonExistent()
 {
     $file = 'FileNameThatShouldNotExist';
     $this->_model->getData($file);
 }