diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php
index 17653dfb665d7..2d7ba877fcc27 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php
@@ -480,9 +480,9 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
protected $dateTime;
/**
- * @var \Magento\Indexer\Model\IndexerFactory
+ * @var \Magento\Indexer\Model\IndexerRegistry
*/
- protected $indexerFactory;
+ protected $indexerRegistry;
/**
* @var \Magento\Framework\Logger
@@ -506,24 +506,25 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
* @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService
* @param \Magento\Catalog\Helper\Data $catalogData
* @param \Magento\ImportExport\Model\Import\Config $importConfig
- * @param \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceFactory $resourceFactory
- * @param \Magento\CatalogImportExport\Model\Import\Product\OptionFactory $optionFactory
+ * @param Proxy\Product\ResourceFactory $resourceFactory
+ * @param Product\OptionFactory $optionFactory
* @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setColFactory
* @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryColFactory
* @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService
* @param \Magento\Catalog\Model\ProductFactory $productFactory
* @param \Magento\Framework\StoreManagerInterface $storeManager
- * @param \Magento\CatalogImportExport\Model\Import\Product\Type\Factory $productTypeFactory
+ * @param Product\Type\Factory $productTypeFactory
* @param \Magento\Catalog\Model\Resource\Product\LinkFactory $linkFactory
- * @param \Magento\CatalogImportExport\Model\Import\Proxy\ProductFactory $proxyProdFactory
- * @param \Magento\CatalogImportExport\Model\Import\UploaderFactory $uploaderFactory
+ * @param Proxy\ProductFactory $proxyProdFactory
+ * @param UploaderFactory $uploaderFactory
* @param \Magento\Framework\Filesystem $filesystem
* @param \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param \Magento\Framework\Logger $logger
- * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory
+ * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
* @param array $data
+ * @throws \Magento\Framework\Model\Exception
*/
public function __construct(
\Magento\Core\Helper\Data $coreData,
@@ -553,7 +554,7 @@ public function __construct(
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Framework\Stdlib\DateTime $dateTime,
\Magento\Framework\Logger $logger,
- \Magento\Indexer\Model\IndexerFactory $indexerFactory,
+ \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
array $data = array()
) {
$this->_eventManager = $eventManager;
@@ -574,7 +575,7 @@ public function __construct(
$this->_stockResItemFac = $stockResItemFac;
$this->_localeDate = $localeDate;
$this->dateTime = $dateTime;
- $this->indexerFactory = $indexerFactory;
+ $this->indexerRegistry = $indexerRegistry;
$this->_logger = $logger;
parent::__construct($coreData, $importExportData, $importData, $config, $resource, $resourceHelper, $string);
$this->_optionEntity = isset(
@@ -1759,7 +1760,7 @@ protected function _saveProductWebsites(array $websiteData)
*/
protected function _saveStockItem()
{
- $indexer = $this->indexerFactory->create()->load('catalog_product_category');
+ $indexer = $this->indexerRegistry->get('catalog_product_category');
/** @var $stockResource \Magento\CatalogInventory\Model\Resource\Stock\Item */
$stockResource = $this->_stockResItemFac->create();
$entityTable = $stockResource->getMainTable();
diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json
index 7d98b3c2e297d..ce67e7ed78037 100644
--- a/app/code/Magento/CatalogImportExport/composer.json
+++ b/app/code/Magento/CatalogImportExport/composer.json
@@ -3,20 +3,20 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-import-export": "0.1.0-alpha103",
- "magento/module-indexer": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-import-export": "0.1.0-alpha104",
+ "magento/module-indexer": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"ext-ctype": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
index 7a3adacfc8aa8..68634b33f621e 100644
--- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
+++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
@@ -87,7 +87,7 @@ public function executeFull()
*
* @return void
*/
- public function executeList($ids)
+ public function executeList(array $ids)
{
$this->_productStockIndexerRows->execute($ids);
}
diff --git a/app/code/Magento/CatalogInventory/Model/Observer.php b/app/code/Magento/CatalogInventory/Model/Observer.php
index d063a61a260f1..42f82adafc319 100644
--- a/app/code/Magento/CatalogInventory/Model/Observer.php
+++ b/app/code/Magento/CatalogInventory/Model/Observer.php
@@ -290,6 +290,7 @@ protected function saveStockItemData($product)
$stockItemDo = $this->stockItemService->getStockItem($product->getId());
$this->stockItemService->saveStockItem(
$this->stockItemBuilder->mergeDataObjectWithArray($stockItemDo, $stockItemData)
+ ->create()
);
return $this;
diff --git a/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php b/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php
index 33297adae80ad..33e1d8f1f6af5 100644
--- a/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php
+++ b/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php
@@ -134,7 +134,7 @@ public function saveStockItemBySku($productSku, Data\StockItemDetails $stockItem
$dataToSave = $this->stockItemBuilder->mergeDataObjectWithArray(
$stockItemDo,
$stockItemDetailsDo->__toArray()
- )->__toArray();
+ )->create()->__toArray();
return $stockItem->setData($dataToSave)->save()->getId();
}
diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json
index 859be9a5e016b..44c2b081b7ceb 100644
--- a/app/code/Magento/CatalogInventory/composer.json
+++ b/app/code/Magento/CatalogInventory/composer.json
@@ -3,19 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-indexer": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-indexer": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/CatalogRule/CatalogRuleException.php
similarity index 75%
rename from app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php
rename to app/code/Magento/CatalogRule/CatalogRuleException.php
index 3e25238187764..fa78a502e1c57 100644
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php
+++ b/app/code/Magento/CatalogRule/CatalogRuleException.php
@@ -21,13 +21,8 @@
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+namespace Magento\CatalogRule;
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$connection = $installer->getConnection();
-$connection->createTable(
- $connection->createTableByDdl(
- $installer->getTable('coupon_aggregated'),
- $installer->getTable('coupon_aggregated_updated')
- )
-);
+class CatalogRuleException extends \Exception
+{
+}
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php
index 84bd532607d09..85e47ce124c8f 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php
@@ -48,6 +48,7 @@ public function execute()
$this->messageManager->addError($errorMessage . ' ' . $ruleJob->getError());
}
} catch (\Exception $e) {
+ $this->_objectManager->create('Magento\Framework\Logger')->logException($e);
$this->messageManager->addError($errorMessage);
}
$this->_redirect('catalog_rule/*');
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php
index d750748978eef..c3506013ccfb8 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php
@@ -36,6 +36,7 @@ public function execute()
$id = $this->getRequest()->getParam('id');
if ($id) {
try {
+ /** @var \Magento\CatalogRule\Model\Rule $model */
$model = $this->_objectManager->create('Magento\CatalogRule\Model\Rule');
$model->load($id);
$model->delete();
diff --git a/app/code/Magento/CatalogRule/Model/Cron.php b/app/code/Magento/CatalogRule/Model/Cron.php
new file mode 100644
index 0000000000000..bb8a302d8ea79
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Model/Cron.php
@@ -0,0 +1,54 @@
+ruleProductProcessor = $ruleProductProcessor;
+ }
+
+ /**
+ * Daily update catalog price rule by cron
+ * Update include interval 3 days - current day - 1 days before + 1 days after
+ * This method is called from cron process, cron is working in UTC time and
+ * we should generate data for interval -1 day ... +1 day
+ *
+ * @return void
+ */
+ public function dailyCatalogUpdate()
+ {
+ $this->ruleProductProcessor->markIndexerAsInvalid();
+ }
+}
diff --git a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php
new file mode 100644
index 0000000000000..ff6f88d3ae78d
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php
@@ -0,0 +1,112 @@
+indexBuilder = $indexBuilder;
+ }
+
+ /**
+ * Execute materialization on ids entities
+ *
+ * @param int[] $ids
+ * @return void
+ */
+ public function execute($ids)
+ {
+ $this->executeList($ids);
+ }
+
+ /**
+ * Execute full indexation
+ *
+ * @return void
+ */
+ public function executeFull()
+ {
+ $this->indexBuilder->reindexFull();
+ }
+
+ /**
+ * Execute partial indexation by ID list
+ *
+ * @param int[] $ids
+ * @throws CatalogRuleException
+ * @return void
+ */
+ public function executeList(array $ids)
+ {
+ if (!$ids) {
+ throw new CatalogRuleException(__('Could not rebuild index for empty products array'));
+ }
+ $this->doExecuteList($ids);
+ }
+
+ /**
+ * Execute partial indexation by ID list. Template method
+ *
+ * @param int[] $ids
+ * @return void
+ */
+ abstract protected function doExecuteList($ids);
+
+ /**
+ * Execute partial indexation by ID
+ *
+ * @param int $id
+ * @throws CatalogRuleException
+ * @return void
+ */
+ public function executeRow($id)
+ {
+ if (!$id) {
+ throw new CatalogRuleException(__('Could not rebuild index for undefined product'));
+ }
+ $this->doExecuteRow($id);
+ }
+
+ /**
+ * Execute partial indexation by ID. Template method
+ *
+ * @param int $id
+ * @throws \Magento\CatalogRule\CatalogRuleException
+ * @return void
+ */
+ abstract protected function doExecuteRow($id);
+}
diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php
new file mode 100644
index 0000000000000..ed866920526a2
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php
@@ -0,0 +1,706 @@
+resource = $resource;
+ $this->storeManager = $storeManager;
+ $this->ruleCollectionFactory = $ruleCollectionFactory;
+ $this->logger = $logger;
+ $this->priceCurrency = $priceCurrency;
+ $this->eavConfig = $eavConfig;
+ $this->dateFormat = $dateFormat;
+ $this->dateTime = $dateTime;
+ $this->productFactory = $productFactory;
+ }
+
+ /**
+ * Reindex by id
+ *
+ * @param int $id
+ * @return void
+ */
+ public function reindexById($id)
+ {
+ $this->reindexByIds([$id]);
+ }
+
+ /**
+ * Reindex by ids
+ *
+ * @param array $ids
+ * @throws \Magento\CatalogRule\CatalogRuleException
+ * @return void
+ */
+ public function reindexByIds(array $ids)
+ {
+ try {
+ $this->doReindexByIds($ids);
+ } catch (\Exception $e) {
+ $this->logException($e);
+ throw new CatalogRuleException($e->getMessage(), $e->getCode(), $e);
+ }
+ }
+
+ /**
+ * Reindex by ids. Template method
+ *
+ * @param array $ids
+ * @return void
+ */
+ protected function doReindexByIds($ids)
+ {
+ $this->cleanByIds($ids);
+
+ foreach ($this->getActiveRules() as $rule) {
+ foreach ($ids as $productId) {
+ $this->applyRule($rule, $this->getProduct($productId));
+ }
+ }
+ }
+
+ /**
+ * Full reindex
+ *
+ * @throws CatalogRuleException
+ * @return void
+ */
+ public function reindexFull()
+ {
+ try {
+ $this->doReindexFull();
+ } catch (\Exception $e) {
+ $this->logException($e);
+ throw new CatalogRuleException($e->getMessage(), $e->getCode(), $e);
+ }
+ }
+
+ /**
+ * Full reindex Template method
+ *
+ * @return void
+ */
+ protected function doReindexFull()
+ {
+ foreach ($this->getAllRules() as $rule) {
+ $this->updateRuleProductData($rule);
+ }
+ $this->applyAllRules();
+ }
+
+ /**
+ * Clean by product ids
+ *
+ * @param array $productIds
+ * @return void
+ */
+ protected function cleanByIds($productIds)
+ {
+ $this->getWriteAdapter()->deleteFromSelect(
+ $this->getWriteAdapter()
+ ->select($this->resource->getTableName('catalogrule_product'), 'product_id')
+ ->distinct()
+ ->where('product_id IN (?)', $productIds),
+ $this->resource->getTableName('catalogrule_product')
+ );
+
+ $this->getWriteAdapter()->deleteFromSelect(
+ $this->getWriteAdapter()->select($this->resource->getTableName('catalogrule_product_price'), 'product_id')
+ ->distinct()
+ ->where('product_id IN (?)', $productIds),
+ $this->resource->getTableName('catalogrule_product_price')
+ );
+ }
+
+ /**
+ * @param Rule $rule
+ * @param Product $product
+ * @return $this
+ * @throws \Exception
+ */
+ protected function applyRule(Rule $rule, $product)
+ {
+ $ruleId = $rule->getId();
+ $productId = $product->getId();
+ $websiteIds = array_intersect($product->getWebsiteIds(), $rule->getWebsiteIds());
+
+ $write = $this->getWriteAdapter();
+
+ $write->delete(
+ $this->resource->getTableName('catalogrule_product'),
+ array($write->quoteInto('rule_id = ?', $ruleId), $write->quoteInto('product_id = ?', $productId))
+ );
+
+ if (!$rule->getConditions()->validate($product)) {
+ $write->delete(
+ $this->resource->getTableName('catalogrule_product_price'),
+ array($write->quoteInto('product_id = ?', $productId))
+ );
+ return $this;
+ }
+
+ $customerGroupIds = $rule->getCustomerGroupIds();
+ $fromTime = strtotime($rule->getFromDate());
+ $toTime = strtotime($rule->getToDate());
+ $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
+ $sortOrder = (int)$rule->getSortOrder();
+ $actionOperator = $rule->getSimpleAction();
+ $actionAmount = $rule->getDiscountAmount();
+ $actionStop = $rule->getStopRulesProcessing();
+ $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
+ $subActionAmount = $rule->getSubDiscountAmount();
+
+ $rows = array();
+ try {
+ foreach ($websiteIds as $websiteId) {
+ foreach ($customerGroupIds as $customerGroupId) {
+ $rows[] = array(
+ 'rule_id' => $ruleId,
+ 'from_time' => $fromTime,
+ 'to_time' => $toTime,
+ 'website_id' => $websiteId,
+ 'customer_group_id' => $customerGroupId,
+ 'product_id' => $productId,
+ 'action_operator' => $actionOperator,
+ 'action_amount' => $actionAmount,
+ 'action_stop' => $actionStop,
+ 'sort_order' => $sortOrder,
+ 'sub_simple_action' => $subActionOperator,
+ 'sub_discount_amount' => $subActionAmount
+ );
+
+ if (count($rows) == 1000) {
+ $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
+ $rows = array();
+ }
+ }
+ }
+
+ if (!empty($rows)) {
+ $write->insertMultiple($this->resource->getTableName('catalogrule_product'), $rows);
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+
+ $this->applyAllRules($product);
+
+ return $this;
+ }
+
+ /**
+ * Retrieve connection for read data
+ *
+ * @return \Magento\Framework\DB\Adapter\AdapterInterface
+ */
+ protected function getReadAdapter()
+ {
+ $writeAdapter = $this->getWriteAdapter();
+ if ($writeAdapter && $writeAdapter->getTransactionLevel() > 0) {
+ // if transaction is started we should use write connection for reading
+ return $writeAdapter;
+ }
+ return $this->resource->getConnection('read');
+ }
+
+ /**
+ * Retrieve connection for write data
+ *
+ * @return \Magento\Framework\DB\Adapter\AdapterInterface
+ */
+ protected function getWriteAdapter()
+ {
+ return $this->resource->getConnection('write');
+ }
+
+ /**
+ * @param string $tableName
+ * @return string
+ */
+ protected function getTable($tableName)
+ {
+ return $this->resource->getTableName($tableName);
+ }
+
+ /**
+ * @param Rule $rule
+ * @return $this
+ */
+ protected function updateRuleProductData(Rule $rule)
+ {
+ $ruleId = $rule->getId();
+ $write = $this->getWriteAdapter();
+ if ($rule->getProductsFilter()) {
+ $write->delete(
+ $this->getTable('catalogrule_product'),
+ array('rule_id=?' => $ruleId, 'product_id IN (?)' => $rule->getProductsFilter())
+ );
+ } else {
+ $write->delete($this->getTable('catalogrule_product'), $write->quoteInto('rule_id=?', $ruleId));
+ }
+
+ if (!$rule->getIsActive()) {
+ return $this;
+ }
+
+ $websiteIds = $rule->getWebsiteIds();
+ if (!is_array($websiteIds)) {
+ $websiteIds = explode(',', $websiteIds);
+ }
+ if (empty($websiteIds)) {
+ return $this;
+ }
+
+ \Magento\Framework\Profiler::start('__MATCH_PRODUCTS__');
+ $productIds = $rule->getMatchingProductIds();
+ \Magento\Framework\Profiler::stop('__MATCH_PRODUCTS__');
+
+ $customerGroupIds = $rule->getCustomerGroupIds();
+ $fromTime = strtotime($rule->getFromDate());
+ $toTime = strtotime($rule->getToDate());
+ $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
+ $sortOrder = (int)$rule->getSortOrder();
+ $actionOperator = $rule->getSimpleAction();
+ $actionAmount = $rule->getDiscountAmount();
+ $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
+ $subActionAmount = $rule->getSubDiscountAmount();
+ $actionStop = $rule->getStopRulesProcessing();
+
+ $rows = array();
+
+ foreach ($productIds as $productId => $validationByWebsite) {
+ foreach ($websiteIds as $websiteId) {
+ if (empty($validationByWebsite[$websiteId])) {
+ continue;
+ }
+ foreach ($customerGroupIds as $customerGroupId) {
+ $rows[] = array(
+ 'rule_id' => $ruleId,
+ 'from_time' => $fromTime,
+ 'to_time' => $toTime,
+ 'website_id' => $websiteId,
+ 'customer_group_id' => $customerGroupId,
+ 'product_id' => $productId,
+ 'action_operator' => $actionOperator,
+ 'action_amount' => $actionAmount,
+ 'action_stop' => $actionStop,
+ 'sort_order' => $sortOrder,
+ 'sub_simple_action' => $subActionOperator,
+ 'sub_discount_amount' => $subActionAmount
+ );
+
+ if (count($rows) == 1000) {
+ $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
+ $rows = array();
+ }
+ }
+ }
+ }
+ if (!empty($rows)) {
+ $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @return $this
+ * @throws \Exception
+ */
+ protected function applyAllRules()
+ {
+ $write = $this->getWriteAdapter();
+
+ $fromDate = mktime(0, 0, 0, date('m'), date('d') - 1);
+ $toDate = mktime(0, 0, 0, date('m'), date('d') + 1);
+
+ $this->deleteOldData();
+
+ $dayPrices = array();
+
+ /**
+ * Update products rules prices per each website separately
+ * because of max join limit in mysql
+ */
+ foreach ($this->storeManager->getWebsites(false) as $website) {
+ $productsStmt = $this->getRuleProductsStmt($website->getId());
+
+ $dayPrices = array();
+ $stopFlags = array();
+ $prevKey = null;
+
+ while ($ruleData = $productsStmt->fetch()) {
+ $ruleProductId = $ruleData['product_id'];
+ $productKey = $ruleProductId .
+ '_' .
+ $ruleData['website_id'] .
+ '_' .
+ $ruleData['customer_group_id'];
+
+ if ($prevKey && $prevKey != $productKey) {
+ $stopFlags = array();
+ }
+
+ /**
+ * Build prices for each day
+ */
+ for ($time = $fromDate; $time <= $toDate; $time += self::SECONDS_IN_DAY) {
+ if (($ruleData['from_time'] == 0 ||
+ $time >= $ruleData['from_time']) && ($ruleData['to_time'] == 0 ||
+ $time <= $ruleData['to_time'])
+ ) {
+ $priceKey = $time . '_' . $productKey;
+
+ if (isset($stopFlags[$priceKey])) {
+ continue;
+ }
+
+ if (!isset($dayPrices[$priceKey])) {
+ $dayPrices[$priceKey] = array(
+ 'rule_date' => $time,
+ 'website_id' => $ruleData['website_id'],
+ 'customer_group_id' => $ruleData['customer_group_id'],
+ 'product_id' => $ruleProductId,
+ 'rule_price' => $this->calcRuleProductPrice($ruleData),
+ 'latest_start_date' => $ruleData['from_time'],
+ 'earliest_end_date' => $ruleData['to_time']
+ );
+ } else {
+ $dayPrices[$priceKey]['rule_price'] = $this->calcRuleProductPrice(
+ $ruleData,
+ $dayPrices[$priceKey]
+ );
+ $dayPrices[$priceKey]['latest_start_date'] = max(
+ $dayPrices[$priceKey]['latest_start_date'],
+ $ruleData['from_time']
+ );
+ $dayPrices[$priceKey]['earliest_end_date'] = min(
+ $dayPrices[$priceKey]['earliest_end_date'],
+ $ruleData['to_time']
+ );
+ }
+
+ if ($ruleData['action_stop']) {
+ $stopFlags[$priceKey] = true;
+ }
+ }
+ }
+
+ $prevKey = $productKey;
+ if (count($dayPrices) > 1000) {
+ $this->saveRuleProductPrices($dayPrices);
+ $dayPrices = array();
+ }
+ }
+ $this->saveRuleProductPrices($dayPrices);
+ }
+ $this->saveRuleProductPrices($dayPrices);
+
+ $write->delete($this->getTable('catalogrule_group_website'), array());
+
+ $timestamp = $this->dateTime->gmtTimestamp();
+
+ $select = $write->select()->distinct(
+ true
+ )->from(
+ $this->getTable('catalogrule_product'),
+ array('rule_id', 'customer_group_id', 'website_id')
+ )->where(
+ "{$timestamp} >= from_time AND (({$timestamp} <= to_time AND to_time > 0) OR to_time = 0)"
+ );
+ $query = $select->insertFromSelect($this->getTable('catalogrule_group_website'));
+ $write->query($query);
+
+ return $this;
+ }
+
+ /**
+ * Clean rule price index
+ *
+ * @return $this
+ */
+ protected function deleteOldData()
+ {
+ $this->getWriteAdapter()->delete($this->getTable('catalogrule_product_price'));
+ return $this;
+ }
+
+ /**
+ * @param array $ruleData
+ * @param null $productData
+ * @return float
+ */
+ protected function calcRuleProductPrice($ruleData, $productData = null)
+ {
+ if ($productData !== null && isset($productData['rule_price'])) {
+ $productPrice = $productData['rule_price'];
+ } else {
+ $productPrice = $ruleData['default_price'];
+ }
+
+ switch ($ruleData['action_operator']) {
+ case 'to_fixed':
+ $productPrice = min($ruleData['action_amount'], $productPrice);
+ break;
+ case 'to_percent':
+ $productPrice = $productPrice * $ruleData['action_amount'] / 100;
+ break;
+ case 'by_fixed':
+ $productPrice = max(0, $productPrice - $ruleData['action_amount']);
+ break;
+ case 'by_percent':
+ $productPrice = $productPrice * (1 - $ruleData['action_amount'] / 100);
+ break;
+ default:
+ $productPrice = 0;
+ }
+
+ return $this->priceCurrency->round($productPrice);
+ }
+
+ /**
+ * @param int $websiteId
+ * @return \Zend\Db\Adapter\Driver\StatementInterface|\Zend_Db_Statement_Interface
+ * @throws \Magento\Eav\Exception
+ */
+ protected function getRuleProductsStmt($websiteId)
+ {
+ $read = $this->getReadAdapter();
+ /**
+ * Sort order is important
+ * It used for check stop price rule condition.
+ * website_id customer_group_id product_id sort_order
+ * 1 1 1 0
+ * 1 1 1 1
+ * 1 1 1 2
+ * if row with sort order 1 will have stop flag we should exclude
+ * all next rows for same product id from price calculation
+ */
+ $select = $read->select()->from(
+ array('rp' => $this->getTable('catalogrule_product'))
+ )->order(
+ array('rp.website_id', 'rp.customer_group_id', 'rp.product_id', 'rp.sort_order', 'rp.rule_id')
+ );
+
+ /**
+ * Join default price and websites prices to result
+ */
+ $priceAttr = $this->eavConfig->getAttribute(Product::ENTITY, 'price');
+ $priceTable = $priceAttr->getBackend()->getTable();
+ $attributeId = $priceAttr->getId();
+
+ $joinCondition = '%1$s.entity_id=rp.product_id AND (%1$s.attribute_id='
+ . $attributeId
+ . ') and %1$s.store_id=%2$s';
+
+ $select->join(
+ array('pp_default' => $priceTable),
+ sprintf($joinCondition, 'pp_default', \Magento\Store\Model\Store::DEFAULT_STORE_ID),
+ array()
+ );
+
+ $website = $this->storeManager->getWebsite($websiteId);
+ $defaultGroup = $website->getDefaultGroup();
+ if ($defaultGroup instanceof \Magento\Store\Model\Group) {
+ $storeId = $defaultGroup->getDefaultStoreId();
+ } else {
+ $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
+ }
+
+ $select->joinInner(
+ array('product_website' => $this->getTable('catalog_product_website')),
+ 'product_website.product_id=rp.product_id '
+ . 'AND product_website.website_id = rp.website_id '
+ . 'AND product_website.website_id='
+ . $websiteId,
+ array()
+ );
+
+ $tableAlias = 'pp' . $websiteId;
+ $select->joinLeft(
+ array($tableAlias => $priceTable),
+ sprintf($joinCondition, $tableAlias, $storeId),
+ array()
+ );
+ $select->columns([
+ 'default_price' => $this->getReadAdapter()->getIfNullSql($tableAlias . '.value', 'pp_default.value'),
+ ]);
+
+ return $read->query($select);
+ }
+
+ /**
+ * @param array $arrData
+ * @return $this
+ * @throws \Exception
+ */
+ protected function saveRuleProductPrices($arrData)
+ {
+ if (empty($arrData)) {
+ return $this;
+ }
+
+ $adapter = $this->getWriteAdapter();
+ $productIds = array();
+
+ try {
+ foreach ($arrData as $key => $data) {
+ $productIds['product_id'] = $data['product_id'];
+ $arrData[$key]['rule_date'] = $this->dateFormat->formatDate($data['rule_date'], false);
+ $arrData[$key]['latest_start_date'] = $this->dateFormat->formatDate($data['latest_start_date'], false);
+ $arrData[$key]['earliest_end_date'] = $this->dateFormat->formatDate($data['earliest_end_date'], false);
+ }
+ $adapter->insertOnDuplicate($this->getTable('catalogrule_affected_product'), array_unique($productIds));
+ $adapter->insertOnDuplicate($this->getTable('catalogrule_product_price'), $arrData);
+ } catch (\Exception $e) {
+ throw $e;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get active rules
+ *
+ * @return array
+ */
+ protected function getActiveRules()
+ {
+ return $this->ruleCollectionFactory->create()
+ ->addFieldToFilter('is_active', 1);
+ }
+
+ /**
+ * Get active rules
+ *
+ * @return array
+ */
+ protected function getAllRules()
+ {
+ return $this->ruleCollectionFactory->create();
+ }
+
+ /**
+ * @param int $productId
+ * @return Product
+ */
+ protected function getProduct($productId)
+ {
+ if (!isset($this->loadedProducts[$productId])) {
+ $this->loadedProducts[$productId] = $this->productFactory->create()->load($productId);
+ }
+ return $this->loadedProducts[$productId];
+ }
+
+ /**
+ * @param \Exception $e
+ * @return void
+ */
+ protected function logException($e)
+ {
+ $this->logger->logException($e);
+ }
+}
diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version/Generator/Timestamp.php b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexer.php
similarity index 70%
rename from lib/internal/Magento/Framework/App/View/Deployment/Version/Generator/Timestamp.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexer.php
index 830a001c74e65..8753fb9eb7ab3 100644
--- a/lib/internal/Magento/Framework/App/View/Deployment/Version/Generator/Timestamp.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexer.php
@@ -21,19 +21,25 @@
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+namespace Magento\CatalogRule\Model\Indexer\Product;
-namespace Magento\Framework\App\View\Deployment\Version\Generator;
+use Magento\CatalogRule\Model\Indexer\AbstractIndexer;
-/**
- * Generation of deployment version of static files using the timestamp
- */
-class Timestamp implements \Magento\Framework\App\View\Deployment\Version\GeneratorInterface
+class ProductRuleIndexer extends AbstractIndexer
{
/**
* {@inheritdoc}
*/
- public function generate()
+ protected function doExecuteList($ids)
+ {
+ $this->indexBuilder->reindexByIds(array_unique($ids));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function doExecuteRow($id)
{
- return (string)time();
+ $this->indexBuilder->reindexById($id);
}
}
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleProcessor.php
similarity index 74%
rename from app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.2-1.6.0.3.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleProcessor.php
index 0f31627236011..c026b66b2f320 100644
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.2-1.6.0.3.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleProcessor.php
@@ -21,11 +21,14 @@
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+namespace Magento\CatalogRule\Model\Indexer\Product;
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_shipment'),
- 'shipping_label',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY, 'comment' => 'Shipping Label Content', 'length' => '2m')
-);
+use Magento\Indexer\Model\Indexer\AbstractProcessor;
+
+class ProductRuleProcessor extends AbstractProcessor
+{
+ /**
+ * Indexer id
+ */
+ const INDEXER_ID = 'catalogrule_product';
+}
diff --git a/lib/internal/Magento/Framework/Api/AttributeValueBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexer.php
similarity index 65%
rename from lib/internal/Magento/Framework/Api/AttributeValueBuilder.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexer.php
index e4113082c82c2..5036adebaf53d 100644
--- a/lib/internal/Magento/Framework/Api/AttributeValueBuilder.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexer.php
@@ -21,32 +21,29 @@
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-namespace Magento\Framework\Api;
+namespace Magento\CatalogRule\Model\Indexer\Rule;
-/**
- * Custom Attribute Data object builder
- */
-class AttributeValueBuilder extends AbstractSimpleObjectBuilder
+use Magento\CatalogRule\Model\Indexer\AbstractIndexer;
+
+class RuleProductIndexer extends AbstractIndexer
{
/**
- * Set attribute code
+ * {@inheritdoc}
*
- * @param string $attributeCode
- * @return $this
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- public function setAttributeCode($attributeCode)
+ protected function doExecuteList($ids)
{
- return $this->_set(AttributeValue::ATTRIBUTE_CODE, $attributeCode);
+ $this->indexBuilder->reindexFull();
}
/**
- * Set attribute value
+ * {@inheritdoc}
*
- * @param string $value
- * @return $this
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- public function setValue($value)
+ protected function doExecuteRow($id)
{
- return $this->_set(AttributeValue::VALUE, $value);
+ $this->indexBuilder->reindexFull();
}
}
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductProcessor.php
similarity index 73%
rename from app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductProcessor.php
index 96281ede42f6d..87dee29c5ca38 100644
--- a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductProcessor.php
@@ -21,12 +21,14 @@
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+namespace Magento\CatalogRule\Model\Indexer\Rule;
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
+use Magento\Indexer\Model\Indexer\AbstractProcessor;
-$installer->getConnection()->addColumn(
- $installer->getTable('paypal_settlement_report_row'),
- 'payment_tracking_id',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'comment' => 'Payment Tracking ID', 'length' => '255')
-);
+class RuleProductProcessor extends AbstractProcessor
+{
+ /**
+ * Indexer id
+ */
+ const INDEXER_ID = 'catalogrule_rule';
+}
diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php
index 57eb2b22bc201..fa99c32fb1757 100644
--- a/app/code/Magento/CatalogRule/Model/Observer.php
+++ b/app/code/Magento/CatalogRule/Model/Observer.php
@@ -30,9 +30,7 @@
use Magento\Backend\Model\Session as BackendModelSession;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Resource\Product\Collection as ProductCollection;
-use Magento\CatalogRule\Model\Rule\Condition\Combine;
use Magento\CatalogRule\Model\Rule;
-use Magento\CatalogRule\Model\Resource\Rule\Collection;
use Magento\CatalogRule\Model\Rule\Product\Price;
use Magento\Framework\Registry;
use Magento\Framework\StoreManagerInterface;
@@ -40,8 +38,6 @@
use Magento\Customer\Service\V1\CustomerGroupServiceInterface as Group;
use Magento\Customer\Model\Session as CustomerModelSession;
use Magento\Framework\Event\Observer as EventObserver;
-use Magento\Framework\Message\ManagerInterface;
-use Magento\Rule\Model\Condition\Product\AbstractProduct;
use Magento\Framework\Stdlib\DateTime;
class Observer
@@ -71,21 +67,6 @@ class Observer
*/
protected $_productPrice;
- /**
- * @var BackendModelSession
- */
- protected $_backendSession;
-
- /**
- * @var \Magento\CatalogRule\Model\RuleFactory
- */
- protected $_ruleFactory;
-
- /**
- * @var \Magento\CatalogRule\Model\FlagFactory
- */
- protected $_flagFactory;
-
/**
* @var \Magento\CatalogRule\Model\Resource\Rule\CollectionFactory
*/
@@ -111,25 +92,16 @@ class Observer
*/
protected $_resourceRule;
- /**
- * @var \Magento\Framework\Message\ManagerInterface
- */
- protected $messageManager;
-
/**
* @param Resource\RuleFactory $resourceRuleFactory
* @param Resource\Rule $resourceRule
* @param Resource\Rule\CollectionFactory $ruleCollectionFactory
- * @param Rule\Product\Price $productPrice
- * @param RuleFactory $ruleFactory
- * @param FlagFactory $flagFactory
+ * @param Price $productPrice
* @param StoreManagerInterface $storeManager
* @param TimezoneInterface $localeDate
* @param CustomerModelSession $customerSession
- * @param BackendModelSession $backendSession
* @param Registry $coreRegistry
* @param DateTime $dateTime
- * @param ManagerInterface $messageManager
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
@@ -138,87 +110,22 @@ public function __construct(
Resource\Rule $resourceRule,
Resource\Rule\CollectionFactory $ruleCollectionFactory,
Rule\Product\Price $productPrice,
- RuleFactory $ruleFactory,
- FlagFactory $flagFactory,
StoreManagerInterface $storeManager,
TimezoneInterface $localeDate,
CustomerModelSession $customerSession,
- BackendModelSession $backendSession,
Registry $coreRegistry,
- DateTime $dateTime,
- ManagerInterface $messageManager
+ DateTime $dateTime
) {
$this->_resourceRuleFactory = $resourceRuleFactory;
$this->_resourceRule = $resourceRule;
$this->_ruleCollectionFactory = $ruleCollectionFactory;
$this->_productPrice = $productPrice;
- $this->_ruleFactory = $ruleFactory;
- $this->_flagFactory = $flagFactory;
$this->_storeManager = $storeManager;
$this->_localeDate = $localeDate;
$this->_customerSession = $customerSession;
- $this->_backendSession = $backendSession;
$this->_coreRegistry = $coreRegistry;
$this->dateTime = $dateTime;
- $this->messageManager = $messageManager;
- }
-
- /**
- * Apply all catalog price rules for specific product
- *
- * @param EventObserver $observer
- * @return $this|void
- */
- public function applyAllRulesOnProduct($observer)
- {
- $product = $observer->getEvent()->getProduct();
- if ($product->getIsMassupdate()) {
- return;
- }
-
- $productWebsiteIds = $product->getWebsiteIds();
-
- $rules = $this->_ruleCollectionFactory->create()->addFieldToFilter('is_active', 1);
-
- foreach ($rules as $rule) {
- $websiteIds = array_intersect($productWebsiteIds, $rule->getWebsiteIds());
- $rule->applyToProduct($product, $websiteIds);
- }
-
- return $this;
}
-
- /**
- * Apply all price rules for current date.
- * Handle cataolg_product_import_after event
- *
- * @param EventObserver $observer
- * @return $this
- */
- public function applyAllRules($observer)
- {
- $this->_resourceRule->applyAllRulesForDateRange($this->dateTime->formatDate(mktime(0, 0, 0)));
- $this->_flagFactory->create()->loadSelf()->setState(0)->save();
-
- return $this;
- }
-
- /**
- * Apply all catalog price rules
- *
- * Fire the same name process as catalog rule model
- * Event name "apply_catalog_price_rules"
- *
- * @param EventObserver $observer
- * @return $this
- */
- public function processApplyAll(EventObserver $observer)
- {
- $this->_ruleFactory->create()->applyAll();
- $this->_flagFactory->create()->loadSelf()->setState(0)->save();
- return $this;
- }
-
/**
* Apply catalog price rules to product on frontend
*
@@ -304,22 +211,6 @@ public function processAdminFinalPrice($observer)
return $this;
}
- /**
- * Daily update catalog price rule by cron
- * Update include interval 3 days - current day - 1 days before + 1 days after
- * This method is called from cron process, cron is working in UTC time and
- * we should generate data for interval -1 day ... +1 day
- *
- * @param EventObserver $observer
- * @return $this
- */
- public function dailyCatalogUpdate($observer)
- {
- $this->_resourceRule->applyAllRulesForDateRange();
-
- return $this;
- }
-
/**
* Clean out calculated catalog rule prices for products
*
@@ -360,98 +251,6 @@ public function prepareCatalogProductPriceIndexTable(EventObserver $observer)
return $this;
}
- /**
- * Check rules that contains affected attribute
- * If rules were found they will be set to inactive and notice will be add to admin session
- *
- * @param string $attributeCode
- * @return $this
- */
- protected function _checkCatalogRulesAvailability($attributeCode)
- {
- /* @var $collection Collection */
- $collection = $this->_ruleCollectionFactory->create()->addAttributeInConditionFilter($attributeCode);
-
- $disabledRulesCount = 0;
- foreach ($collection as $rule) {
- /* @var $rule Rule */
- $rule->setIsActive(0);
- /* @var $rule->getConditions() Combine */
- $this->_removeAttributeFromConditions($rule->getConditions(), $attributeCode);
- $rule->save();
-
- $disabledRulesCount++;
- }
-
- if ($disabledRulesCount) {
- $this->_ruleFactory->create()->applyAll();
- $this->messageManager->addWarning(
- __(
- '%1 Catalog Price Rules based on "%2" attribute have been disabled.',
- $disabledRulesCount,
- $attributeCode
- )
- );
- }
-
- return $this;
- }
-
- /**
- * Remove catalog attribute condition by attribute code from rule conditions
- *
- * @param Combine $combine
- * @param string $attributeCode
- * @return void
- */
- protected function _removeAttributeFromConditions($combine, $attributeCode)
- {
- $conditions = $combine->getConditions();
- foreach ($conditions as $conditionId => $condition) {
- if ($condition instanceof Combine) {
- $this->_removeAttributeFromConditions($condition, $attributeCode);
- }
- if ($condition instanceof AbstractProduct) {
- if ($condition->getAttribute() == $attributeCode) {
- unset($conditions[$conditionId]);
- }
- }
- }
- $combine->setConditions($conditions);
- }
-
- /**
- * After save attribute if it is not used for promo rules already check rules for containing this attribute
- *
- * @param EventObserver $observer
- * @return $this
- */
- public function catalogAttributeSaveAfter(EventObserver $observer)
- {
- $attribute = $observer->getEvent()->getAttribute();
- if ($attribute->dataHasChangedFor('is_used_for_promo_rules') && !$attribute->getIsUsedForPromoRules()) {
- $this->_checkCatalogRulesAvailability($attribute->getAttributeCode());
- }
-
- return $this;
- }
-
- /**
- * After delete attribute check rules that contains deleted attribute
- *
- * @param EventObserver $observer
- * @return $this
- */
- public function catalogAttributeDeleteAfter(EventObserver $observer)
- {
- $attribute = $observer->getEvent()->getAttribute();
- if ($attribute->getIsUsedForPromoRules()) {
- $this->_checkCatalogRulesAvailability($attribute->getAttributeCode());
- }
-
- return $this;
- }
-
/**
* @param EventObserver $observer
* @return $this
@@ -501,27 +300,4 @@ public function prepareCatalogProductCollectionPrices(EventObserver $observer)
return $this;
}
-
- /**
- * Create catalog rule relations for imported products
- *
- * @param EventObserver $observer
- * @return void
- */
- public function createCatalogRulesRelations(EventObserver $observer)
- {
- $adapter = $observer->getEvent()->getAdapter();
- $affectedEntityIds = $adapter->getAffectedEntityIds();
-
- if (empty($affectedEntityIds)) {
- return;
- }
-
- $rules = $this->_ruleCollectionFactory->create()->addFieldToFilter('is_active', 1);
-
- foreach ($rules as $rule) {
- $rule->setProductsFilter($affectedEntityIds);
- $this->_resourceRule->updateRuleProductData($rule);
- }
- }
}
diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule.php b/app/code/Magento/CatalogRule/Model/Resource/Rule.php
index 4640667f03982..73334bc096c55 100644
--- a/app/code/Magento/CatalogRule/Model/Resource/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Resource/Rule.php
@@ -199,514 +199,25 @@ protected function _afterSave(AbstractModel $object)
}
/**
- * Update products which are matched for rule
- *
- * @param ModelRule $rule
+ * @param \Magento\Framework\Model\AbstractModel $rule
* @return $this
- * @throws \Exception
*/
- public function updateRuleProductData(ModelRule $rule)
+ protected function _afterDelete(\Magento\Framework\Model\AbstractModel $rule)
{
- $ruleId = $rule->getId();
$write = $this->_getWriteAdapter();
- $write->beginTransaction();
- if ($rule->getProductsFilter()) {
- $write->delete(
- $this->getTable('catalogrule_product'),
- array('rule_id=?' => $ruleId, 'product_id IN (?)' => $rule->getProductsFilter())
- );
- } else {
- $write->delete($this->getTable('catalogrule_product'), $write->quoteInto('rule_id=?', $ruleId));
- }
-
- if (!$rule->getIsActive()) {
- $write->commit();
- return $this;
- }
-
- $websiteIds = $rule->getWebsiteIds();
- if (!is_array($websiteIds)) {
- $websiteIds = explode(',', $websiteIds);
- }
- if (empty($websiteIds)) {
- return $this;
- }
-
- \Magento\Framework\Profiler::start('__MATCH_PRODUCTS__');
- $productIds = $rule->getMatchingProductIds();
- \Magento\Framework\Profiler::stop('__MATCH_PRODUCTS__');
-
- $customerGroupIds = $rule->getCustomerGroupIds();
- $fromTime = strtotime($rule->getFromDate());
- $toTime = strtotime($rule->getToDate());
- $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
- $sortOrder = (int)$rule->getSortOrder();
- $actionOperator = $rule->getSimpleAction();
- $actionAmount = $rule->getDiscountAmount();
- $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
- $subActionAmount = $rule->getSubDiscountAmount();
- $actionStop = $rule->getStopRulesProcessing();
-
- $rows = array();
-
- try {
- foreach ($productIds as $productId => $validationByWebsite) {
- foreach ($websiteIds as $websiteId) {
- foreach ($customerGroupIds as $customerGroupId) {
- if (empty($validationByWebsite[$websiteId])) {
- continue;
- }
- $rows[] = array(
- 'rule_id' => $ruleId,
- 'from_time' => $fromTime,
- 'to_time' => $toTime,
- 'website_id' => $websiteId,
- 'customer_group_id' => $customerGroupId,
- 'product_id' => $productId,
- 'action_operator' => $actionOperator,
- 'action_amount' => $actionAmount,
- 'action_stop' => $actionStop,
- 'sort_order' => $sortOrder,
- 'sub_simple_action' => $subActionOperator,
- 'sub_discount_amount' => $subActionAmount
- );
-
- if (count($rows) == 1000) {
- $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
- $rows = array();
- }
- }
- }
- }
- if (!empty($rows)) {
- $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
- }
-
- $write->commit();
- } catch (\Exception $e) {
- $write->rollback();
- throw $e;
- }
-
-
- return $this;
- }
-
- /**
- * Get all product ids matched for rule
- *
- * @param int $ruleId
- * @return array
- */
- public function getRuleProductIds($ruleId)
- {
- $read = $this->_getReadAdapter();
- $select = $read->select()->from(
+ $write->delete(
$this->getTable('catalogrule_product'),
- 'product_id'
- )->where(
- 'rule_id=?',
- $ruleId
- );
-
- return $read->fetchCol($select);
- }
-
- /**
- * Remove catalog rules product prices for specified date range and product
- *
- * @param int|string $fromDate
- * @param int|string $toDate
- * @param int|null $productId
- * @return $this
- */
- public function removeCatalogPricesForDateRange($fromDate, $toDate, $productId = null)
- {
- $write = $this->_getWriteAdapter();
- $conds = array();
- $cond = $write->quoteInto('rule_date between ?', $this->dateTime->formatDate($fromDate));
- $cond = $write->quoteInto($cond . ' and ?', $this->dateTime->formatDate($toDate));
- $conds[] = $cond;
- if (!is_null($productId)) {
- $conds[] = $write->quoteInto('product_id=?', $productId);
- }
-
- /**
- * Add information about affected products
- * It can be used in processes which related with product price (like catalog index)
- */
- $select = $this->_getWriteAdapter()->select()->from(
- $this->getTable('catalogrule_product_price'),
- 'product_id'
- )->where(
- implode(' AND ', $conds)
- )->group(
- 'product_id'
- );
-
- $replace = $write->insertFromSelect(
- $select,
- $this->getTable('catalogrule_affected_product'),
- array('product_id'),
- true
- );
- $write->query($replace);
- $write->delete($this->getTable('catalogrule_product_price'), $conds);
- return $this;
- }
-
- /**
- * Delete old price rules data
- *
- * @param string $date
- * @param int|null $productId
- * @return $this
- */
- public function deleteOldData($date, $productId = null)
- {
- $write = $this->_getWriteAdapter();
- $conds = array();
- $conds[] = $write->quoteInto('rule_date', $this->dateTime->formatDate($date));
- if (!is_null($productId)) {
- $conds[] = $write->quoteInto('product_id=?', $productId);
- }
- $write->delete($this->getTable('catalogrule_product_price'), $conds);
- return $this;
- }
-
- /**
- * Get DB resource statement for processing query result
- *
- * @param int $fromDate
- * @param int $toDate
- * @param int|null $productId
- * @param int|null $websiteId
- * @return \Zend_Db_Statement_Interface
- */
- protected function _getRuleProductsStmt($fromDate, $toDate, $productId = null, $websiteId = null)
- {
- $read = $this->_getReadAdapter();
- /**
- * Sort order is important
- * It used for check stop price rule condition.
- * website_id customer_group_id product_id sort_order
- * 1 1 1 0
- * 1 1 1 1
- * 1 1 1 2
- * if row with sort order 1 will have stop flag we should exclude
- * all next rows for same product id from price calculation
- */
- $select = $read->select()->from(
- array('rp' => $this->getTable('catalogrule_product'))
- )->where(
- $read->quoteInto(
- 'rp.from_time = 0 or rp.from_time <= ?',
- $toDate
- ) . ' OR ' . $read->quoteInto(
- 'rp.to_time = 0 or rp.to_time >= ?',
- $fromDate
- )
- )->order(
- array('rp.website_id', 'rp.customer_group_id', 'rp.product_id', 'rp.sort_order', 'rp.rule_id')
- );
-
- if (!is_null($productId)) {
- $select->where('rp.product_id=?', $productId);
- }
-
- /**
- * Join default price and websites prices to result
- */
- $priceAttr = $this->_eavConfig->getAttribute(Product::ENTITY, 'price');
- $priceTable = $priceAttr->getBackend()->getTable();
- $attributeId = $priceAttr->getId();
-
- $joinCondition = '%1$s.entity_id=rp.product_id AND (%1$s.attribute_id=' .
- $attributeId .
- ') and %1$s.store_id=%2$s';
-
- $select->join(
- array('pp_default' => $priceTable),
- sprintf($joinCondition, 'pp_default', \Magento\Store\Model\Store::DEFAULT_STORE_ID),
- array('default_price' => 'pp_default.value')
+ array('rule_id=?' => $rule->getId())
);
-
- if ($websiteId !== null) {
- $website = $this->_storeManager->getWebsite($websiteId);
- $defaultGroup = $website->getDefaultGroup();
- if ($defaultGroup instanceof \Magento\Store\Model\Group) {
- $storeId = $defaultGroup->getDefaultStoreId();
- } else {
- $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
- }
-
- $select->joinInner(
- array('product_website' => $this->getTable('catalog_product_website')),
- 'product_website.product_id=rp.product_id ' .
- 'AND rp.website_id=product_website.website_id ' .
- 'AND product_website.website_id=' .
- $websiteId,
- array()
- );
-
- $tableAlias = 'pp' . $websiteId;
- $fieldAlias = 'website_' . $websiteId . '_price';
- $select->joinLeft(
- array($tableAlias => $priceTable),
- sprintf($joinCondition, $tableAlias, $storeId),
- array($fieldAlias => $tableAlias . '.value')
- );
- } else {
- foreach ($this->_storeManager->getWebsites() as $website) {
- $websiteId = $website->getId();
- $defaultGroup = $website->getDefaultGroup();
- if ($defaultGroup instanceof \Magento\Store\Model\Group) {
- $storeId = $defaultGroup->getDefaultStoreId();
- } else {
- $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
- }
-
- $tableAlias = 'pp' . $websiteId;
- $fieldAlias = 'website_' . $websiteId . '_price';
- $select->joinLeft(
- array($tableAlias => $priceTable),
- sprintf($joinCondition, $tableAlias, $storeId),
- array($fieldAlias => $tableAlias . '.value')
- );
- }
- }
-
- return $read->query($select);
- }
-
- /**
- * Generate catalog price rules prices for specified date range
- * If from date is not defined - will be used previous day by UTC
- * If to date is not defined - will be used next day by UTC
- *
- * @param int|string|null $fromDate
- * @param int|string|null $toDate
- * @param int $productId
- * @return $this
- * @throws \Exception
- */
- public function applyAllRulesForDateRange($fromDate = null, $toDate = null, $productId = null)
- {
- $write = $this->_getWriteAdapter();
- $write->beginTransaction();
-
- $this->_eventManager->dispatch('catalogrule_before_apply', array('resource' => $this));
-
- $clearOldData = false;
- if ($fromDate === null) {
- $fromDate = mktime(0, 0, 0, date('m'), date('d') - 1);
- /**
- * If fromDate not specified we can delete all data oldest than 1 day
- * We have run it for clear table in case when cron was not installed
- * and old data exist in table
- */
- $clearOldData = true;
- }
- if (is_string($fromDate)) {
- $fromDate = strtotime($fromDate);
- }
- if ($toDate === null) {
- $toDate = mktime(0, 0, 0, date('m'), date('d') + 1);
- }
- if (is_string($toDate)) {
- $toDate = strtotime($toDate);
- }
-
- $product = null;
- if ($productId instanceof Product) {
- $product = $productId;
- $productId = $productId->getId();
- }
-
- $this->removeCatalogPricesForDateRange($fromDate, $toDate, $productId);
- if ($clearOldData) {
- $this->deleteOldData($fromDate, $productId);
- }
-
- $dayPrices = array();
-
- try {
- /**
- * Update products rules prices per each website separately
- * because of max join limit in mysql
- */
- foreach ($this->_storeManager->getWebsites(false) as $website) {
- $productsStmt = $this->_getRuleProductsStmt($fromDate, $toDate, $productId, $website->getId());
-
- $dayPrices = array();
- $stopFlags = array();
- $prevKey = null;
-
- while ($ruleData = $productsStmt->fetch()) {
- $ruleProductId = $ruleData['product_id'];
- $productKey = $ruleProductId .
- '_' .
- $ruleData['website_id'] .
- '_' .
- $ruleData['customer_group_id'];
-
- if ($prevKey && $prevKey != $productKey) {
- $stopFlags = array();
- }
-
- /**
- * Build prices for each day
- */
- for ($time = $fromDate; $time <= $toDate; $time += self::SECONDS_IN_DAY) {
- if (($ruleData['from_time'] == 0 ||
- $time >= $ruleData['from_time']) && ($ruleData['to_time'] == 0 ||
- $time <= $ruleData['to_time'])
- ) {
- $priceKey = $time . '_' . $productKey;
-
- if (isset($stopFlags[$priceKey])) {
- continue;
- }
-
- if (!isset($dayPrices[$priceKey])) {
- $dayPrices[$priceKey] = array(
- 'rule_date' => $time,
- 'website_id' => $ruleData['website_id'],
- 'customer_group_id' => $ruleData['customer_group_id'],
- 'product_id' => $ruleProductId,
- 'rule_price' => $this->_calcRuleProductPrice($ruleData),
- 'latest_start_date' => $ruleData['from_time'],
- 'earliest_end_date' => $ruleData['to_time']
- );
- } else {
- $dayPrices[$priceKey]['rule_price'] = $this->_calcRuleProductPrice(
- $ruleData,
- $dayPrices[$priceKey]
- );
- $dayPrices[$priceKey]['latest_start_date'] = max(
- $dayPrices[$priceKey]['latest_start_date'],
- $ruleData['from_time']
- );
- $dayPrices[$priceKey]['earliest_end_date'] = min(
- $dayPrices[$priceKey]['earliest_end_date'],
- $ruleData['to_time']
- );
- }
-
- if ($ruleData['action_stop']) {
- $stopFlags[$priceKey] = true;
- }
- }
- }
-
- $prevKey = $productKey;
- if (count($dayPrices) > 1000) {
- $this->_saveRuleProductPrices($dayPrices);
- $dayPrices = array();
- }
- }
- $this->_saveRuleProductPrices($dayPrices);
- }
- $this->_saveRuleProductPrices($dayPrices);
-
- $write->delete($this->getTable('catalogrule_group_website'), array());
-
- $timestamp = $this->_coreDate->gmtTimestamp();
-
- $select = $write->select()->distinct(
- true
- )->from(
- $this->getTable('catalogrule_product'),
- array('rule_id', 'customer_group_id', 'website_id')
- )->where(
- "{$timestamp} >= from_time AND (({$timestamp} <= to_time AND to_time > 0) OR to_time = 0)"
- );
- $query = $select->insertFromSelect($this->getTable('catalogrule_group_website'));
- $write->query($query);
-
- $write->commit();
- } catch (\Exception $e) {
- $this->_logger->logException($e);
- $write->rollback();
- throw $e;
- }
-
- $productCondition = $this->_conditionFactory->create()->setTable(
- $this->getTable('catalogrule_affected_product')
- )->setPkFieldName(
- 'product_id'
- );
- $this->_eventManager->dispatch(
- 'catalogrule_after_apply',
- array('product' => $product, 'product_condition' => $productCondition)
+ $write->delete(
+ $this->getTable('catalogrule_customer_group'),
+ array('rule_id=?' => $rule->getId())
);
- $write->delete($this->getTable('catalogrule_affected_product'));
-
- return $this;
- }
-
- /**
- * Calculate product price based on price rule data and previous information
- *
- * @param array $ruleData
- * @param null|array $productData
- * @return float
- */
- protected function _calcRuleProductPrice($ruleData, $productData = null)
- {
- if ($productData !== null && isset($productData['rule_price'])) {
- $productPrice = $productData['rule_price'];
- } else {
- $websiteId = $ruleData['website_id'];
- if (isset($ruleData['website_' . $websiteId . '_price'])) {
- $productPrice = $ruleData['website_' . $websiteId . '_price'];
- } else {
- $productPrice = $ruleData['default_price'];
- }
- }
-
- $productPrice = $this->_catalogRuleData->calcPriceRule(
- $ruleData['action_operator'],
- $ruleData['action_amount'],
- $productPrice
+ $write->delete(
+ $this->getTable('catalogrule_group_website'),
+ array('rule_id=?' => $rule->getId())
);
-
- return $this->priceCurrency->round($productPrice);
- }
-
- /**
- * Save rule prices for products to DB
- *
- * @param array $arrData
- * @return $this
- * @throws \Exception
- */
- protected function _saveRuleProductPrices($arrData)
- {
- if (empty($arrData)) {
- return $this;
- }
-
- $adapter = $this->_getWriteAdapter();
- $productIds = array();
-
- $adapter->beginTransaction();
- try {
- foreach ($arrData as $key => $data) {
- $productIds['product_id'] = $data['product_id'];
- $arrData[$key]['rule_date'] = $this->dateTime->formatDate($data['rule_date'], false);
- $arrData[$key]['latest_start_date'] = $this->dateTime->formatDate($data['latest_start_date'], false);
- $arrData[$key]['earliest_end_date'] = $this->dateTime->formatDate($data['earliest_end_date'], false);
- }
- $adapter->insertOnDuplicate($this->getTable('catalogrule_affected_product'), array_unique($productIds));
- $adapter->insertOnDuplicate($this->getTable('catalogrule_product_price'), $arrData);
- } catch (\Exception $e) {
- $adapter->rollback();
- throw $e;
- }
- $adapter->commit();
-
- return $this;
+ return parent::_afterDelete($rule);
}
/**
@@ -797,119 +308,4 @@ public function getRulesFromProduct($date, $websiteId, $customerGroupId, $produc
return $adapter->fetchAll($select);
}
-
- /**
- * Retrieve product price data for all customer groups
- *
- * @param int|string $date
- * @param int $wId
- * @param int $pId
- * @return array
- */
- public function getRulesForProduct($date, $wId, $pId)
- {
- $read = $this->_getReadAdapter();
- $select = $read->select()->from(
- $this->getTable('catalogrule_product_price'),
- '*'
- )->where(
- 'rule_date=?',
- $this->dateTime->formatDate($date, false)
- )->where(
- 'website_id=?',
- $wId
- )->where(
- 'product_id=?',
- $pId
- );
-
- return $read->fetchAll($select);
- }
-
- /**
- * Apply catalog rule to product
- *
- * @param ModelRule $rule
- * @param Product $product
- * @param array $websiteIds
- * @return $this
- * @throws \Exception
- */
- public function applyToProduct($rule, $product, $websiteIds)
- {
- if (!$rule->getIsActive()) {
- return $this;
- }
-
- $ruleId = $rule->getId();
- $productId = $product->getId();
-
- $write = $this->_getWriteAdapter();
- $write->beginTransaction();
-
- $write->delete(
- $this->getTable('catalogrule_product'),
- array($write->quoteInto('rule_id=?', $ruleId), $write->quoteInto('product_id=?', $productId))
- );
-
- if (!$rule->getConditions()->validate($product)) {
- $write->delete(
- $this->getTable('catalogrule_product_price'),
- array($write->quoteInto('product_id=?', $productId))
- );
- $write->commit();
- return $this;
- }
-
- $customerGroupIds = $rule->getCustomerGroupIds();
- $fromTime = strtotime($rule->getFromDate());
- $toTime = strtotime($rule->getToDate());
- $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
- $sortOrder = (int)$rule->getSortOrder();
- $actionOperator = $rule->getSimpleAction();
- $actionAmount = $rule->getDiscountAmount();
- $actionStop = $rule->getStopRulesProcessing();
- $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
- $subActionAmount = $rule->getSubDiscountAmount();
-
- $rows = array();
- try {
- foreach ($websiteIds as $websiteId) {
- foreach ($customerGroupIds as $customerGroupId) {
- $rows[] = array(
- 'rule_id' => $ruleId,
- 'from_time' => $fromTime,
- 'to_time' => $toTime,
- 'website_id' => $websiteId,
- 'customer_group_id' => $customerGroupId,
- 'product_id' => $productId,
- 'action_operator' => $actionOperator,
- 'action_amount' => $actionAmount,
- 'action_stop' => $actionStop,
- 'sort_order' => $sortOrder,
- 'sub_simple_action' => $subActionOperator,
- 'sub_discount_amount' => $subActionAmount
- );
-
- if (count($rows) == 1000) {
- $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
- $rows = array();
- }
- }
- }
-
- if (!empty($rows)) {
- $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
- }
- } catch (\Exception $e) {
- $write->rollback();
- throw $e;
- }
-
- $this->applyAllRulesForDateRange(null, null, $product);
-
- $write->commit();
-
- return $this;
- }
}
diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php
index 9de825124395b..e3cf9fef46c97 100644
--- a/app/code/Magento/CatalogRule/Model/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Rule.php
@@ -353,49 +353,6 @@ protected function _getWebsitesMap()
return $map;
}
- /**
- * Apply rule to product
- *
- * @param int|Product $product
- * @param array|null $websiteIds
- *
- * @return void
- */
- public function applyToProduct($product, $websiteIds = null)
- {
- if (is_numeric($product)) {
- $product = $this->_productFactory->create()->load($product);
- }
- if (is_null($websiteIds)) {
- $websiteIds = $this->getWebsiteIds();
- }
- $this->getResource()->applyToProduct($this, $product, $websiteIds);
- }
-
- /**
- * Apply all price rules, invalidate related cache and refresh price index
- *
- * @return void
- */
- public function applyAll()
- {
- $this->getResourceCollection()->walk(array($this->_getResource(), 'updateRuleProductData'));
- $this->_getResource()->applyAllRulesForDateRange();
- $this->_invalidateCache();
- }
-
- /**
- * Apply all price rules to product
- *
- * @param int|Product $product
- * @return void
- */
- public function applyAllRulesToProduct($product)
- {
- $this->_getResource()->applyAllRulesForDateRange(null, null, $product);
- $this->_invalidateCache();
- }
-
/**
* Calculate price using catalog price rule of product
*
diff --git a/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php b/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php
index 4bbb44aeb16a3..a2aba9530c09e 100644
--- a/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php
+++ b/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php
@@ -83,6 +83,7 @@ public function getNewChildSelectOptions()
public function collectValidatedAttributes($productCollection)
{
foreach ($this->getConditions() as $condition) {
+ /** @var Product|Combine $condition */
$condition->collectValidatedAttributes($productCollection);
}
return $this;
diff --git a/app/code/Magento/CatalogRule/Model/Rule/Job.php b/app/code/Magento/CatalogRule/Model/Rule/Job.php
index fa1609f4c96ba..98201f457b966 100644
--- a/app/code/Magento/CatalogRule/Model/Rule/Job.php
+++ b/app/code/Magento/CatalogRule/Model/Rule/Job.php
@@ -40,23 +40,23 @@
*/
namespace Magento\CatalogRule\Model\Rule;
+use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
+
class Job extends \Magento\Framework\Object
{
/**
- * Instance of event manager model
- *
- * @var \Magento\Framework\Event\ManagerInterface
+ * @var RuleProductProcessor
*/
- protected $_eventManager;
+ protected $ruleProcessor;
/**
* Basic object initialization
*
- * @param \Magento\Framework\Event\ManagerInterface $eventManager
+ * @param RuleProductProcessor $ruleProcessor
*/
- public function __construct(\Magento\Framework\Event\ManagerInterface $eventManager)
+ public function __construct(RuleProductProcessor $ruleProcessor)
{
- $this->_eventManager = $eventManager;
+ $this->ruleProcessor = $ruleProcessor;
}
/**
@@ -67,8 +67,8 @@ public function __construct(\Magento\Framework\Event\ManagerInterface $eventMana
public function applyAll()
{
try {
- $this->_eventManager->dispatch('catalogrule_apply_all');
- $this->setSuccess(__('The rules have been applied.'));
+ $this->ruleProcessor->markIndexerAsInvalid();
+ $this->setSuccess(__('Updated rules applied.'));
} catch (\Magento\Framework\Model\Exception $e) {
$this->setError($e->getMessage());
}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Category.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Category.php
new file mode 100644
index 0000000000000..68cd1451cec16
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Category.php
@@ -0,0 +1,77 @@
+productRuleProcessor = $productRuleProcessor;
+ }
+
+ /**
+ * @param \Magento\Catalog\Model\Category $subject
+ * @param \Magento\Catalog\Model\Category $result
+ * @return \Magento\Catalog\Model\Category
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterSave(
+ \Magento\Catalog\Model\Category $subject,
+ \Magento\Catalog\Model\Category $result
+ ) {
+ /** @var \Magento\Catalog\Model\Category $result */
+ $productIds = $result->getAffectedProductIds();
+ if ($productIds) {
+ $this->productRuleProcessor->reindexList($productIds);
+ }
+ return $result;
+ }
+
+ /**
+ * @param \Magento\Catalog\Model\Category $subject
+ * @param \Magento\Catalog\Model\Category $result
+ * @return \Magento\Catalog\Model\Category
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterDelete(
+ \Magento\Catalog\Model\Category $subject,
+ \Magento\Catalog\Model\Category $result
+ ) {
+ $this->productRuleProcessor->markIndexerAsInvalid();
+ return $result;
+ }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/CustomerGroup.php b/app/code/Magento/CatalogRule/Plugin/Indexer/CustomerGroup.php
new file mode 100644
index 0000000000000..9d6624cfb0626
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/CustomerGroup.php
@@ -0,0 +1,58 @@
+ruleProductProcessor = $ruleProductProcessor;
+ }
+
+ /**
+ * @param Group $subject
+ * @param Group $result
+ * @return Group
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterDelete(
+ Group $subject,
+ Group $result
+ ) {
+ $this->ruleProductProcessor->markIndexerAsInvalid();
+ return $result;
+ }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/ImportExport.php b/app/code/Magento/CatalogRule/Plugin/Indexer/ImportExport.php
new file mode 100644
index 0000000000000..ee191b2bf5552
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/ImportExport.php
@@ -0,0 +1,58 @@
+ruleProductProcessor = $ruleProductProcessor;
+ }
+
+ /**
+ * Invalidate catalog price rule indexer
+ *
+ * @param Import $subject
+ * @param bool $result
+ * @return bool
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterImportSource(Import $subject, $result)
+ {
+ $this->ruleProductProcessor->markIndexerAsInvalid();
+ return $result;
+ }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Attribute.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Attribute.php
new file mode 100644
index 0000000000000..38a192a211299
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Attribute.php
@@ -0,0 +1,158 @@
+ruleCollectionFactory = $ruleCollectionFactory;
+ $this->ruleProductProcessor = $ruleProductProcessor;
+ $this->messageManager = $messageManager;
+ }
+
+ /**
+ * @param \Magento\Catalog\Model\Resource\Eav\Attribute $subject
+ * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+ * @return \Magento\Catalog\Model\Resource\Eav\Attribute
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterSave(
+ \Magento\Catalog\Model\Resource\Eav\Attribute $subject,
+ \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+ ) {
+ if ($attribute->dataHasChangedFor('is_used_for_promo_rules') && !$attribute->getIsUsedForPromoRules()) {
+ $this->checkCatalogRulesAvailability($attribute->getAttributeCode());
+ }
+ return $attribute;
+ }
+
+ /**
+ * @param \Magento\Catalog\Model\Resource\Eav\Attribute $subject
+ * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+ * @return \Magento\Catalog\Model\Resource\Eav\Attribute
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterDelete(
+ \Magento\Catalog\Model\Resource\Eav\Attribute $subject,
+ \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+ ) {
+ if ($attribute->getIsUsedForPromoRules()) {
+ $this->checkCatalogRulesAvailability($attribute->getAttributeCode());
+ }
+ return $attribute;
+ }
+
+ /**
+ * Check rules that contains affected attribute
+ * If rules were found they will be set to inactive and notice will be add to admin session
+ *
+ * @param string $attributeCode
+ * @return $this
+ */
+ protected function checkCatalogRulesAvailability($attributeCode)
+ {
+ /* @var $collection RuleCollectionFactory */
+ $collection = $this->ruleCollectionFactory->create()->addAttributeInConditionFilter($attributeCode);
+
+ $disabledRulesCount = 0;
+ foreach ($collection as $rule) {
+ /* @var $rule Rule */
+ $rule->setIsActive(0);
+ /* @var $rule->getConditions() Combine */
+ $this->removeAttributeFromConditions($rule->getConditions(), $attributeCode);
+ $rule->save();
+
+ $disabledRulesCount++;
+ }
+
+ if ($disabledRulesCount) {
+ $this->ruleProductProcessor->markIndexerAsInvalid();
+ $this->messageManager->addWarning(
+ __(
+ '%1 Catalog Price Rules based on "%2" attribute have been disabled.',
+ $disabledRulesCount,
+ $attributeCode
+ )
+ );
+ }
+
+ return $this;
+ }
+
+ /**
+ * Remove catalog attribute condition by attribute code from rule conditions
+ *
+ * @param Combine $combine
+ * @param string $attributeCode
+ * @return void
+ */
+ protected function removeAttributeFromConditions(Combine $combine, $attributeCode)
+ {
+ $conditions = $combine->getConditions();
+ foreach ($conditions as $conditionId => $condition) {
+ if ($condition instanceof Combine) {
+ $this->removeAttributeFromConditions($condition, $attributeCode);
+ }
+ if ($condition instanceof AbstractProduct) {
+ if ($condition->getAttribute() == $attributeCode) {
+ unset($conditions[$conditionId]);
+ }
+ }
+ }
+ $combine->setConditions($conditions);
+ }
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexer.php
similarity index 50%
rename from app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php
rename to app/code/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexer.php
index 24ca0a08bcc97..8c5464a76ce70 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexer.php
@@ -17,94 +17,72 @@
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
- *
+ *
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin;
-class CatalogRule
+namespace Magento\CatalogRule\Plugin\Indexer\Product;
+
+class PriceIndexer
{
/**
* @var \Magento\Catalog\Model\Indexer\Product\Price\Processor
*/
- protected $_processor;
+ protected $priceProcessor;
/**
- * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor
+ * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceProcessor
*/
- public function __construct(
- \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor
- ) {
- $this->_processor = $processor;
+ public function __construct(\Magento\Catalog\Model\Indexer\Product\Price\Processor $priceProcessor)
+ {
+ $this->priceProcessor = $priceProcessor;
}
/**
* Invalidate price indexer
*
- * @param \Magento\CatalogRule\Model\Rule $subject
- *
+ * @param \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- public function afterApplyAll(\Magento\CatalogRule\Model\Rule $subject)
+ public function afterReindexFull(\Magento\CatalogRule\Model\Indexer\IndexBuilder $subject)
{
- $this->_processor->markIndexerAsInvalid();
+ $this->priceProcessor->markIndexerAsInvalid();
}
/**
- * Reindex price for affected product
- *
- * @param \Magento\CatalogRule\Model\Rule $subject
+ * @param \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject
* @param callable $proceed
- * @param int|\Magento\Catalog\Model\Product $product
- * @param null|array $websiteIds
- *
+ * @param array $productIds
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- public function aroundApplyToProduct(
- \Magento\CatalogRule\Model\Rule $subject,
+ public function aroundReindexByIds(
+ \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject,
\Closure $proceed,
- $product,
- $websiteIds = null
+ array $productIds
) {
- $proceed($product, $websiteIds);
- $this->_reindexProduct($product);
+ $proceed($productIds);
+ $this->priceProcessor->reindexList($productIds);
}
/**
- * Reindex price for affected product
- *
- * @param \Magento\CatalogRule\Model\Rule $subject
+ * @param \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject
* @param callable $proceed
- * @param int|\Magento\Catalog\Model\Product $product
- *
+ * @param int $productId
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- public function aroundApplyAllRulesToProduct(
- \Magento\CatalogRule\Model\Rule $subject,
+ public function aroundReindexById(
+ \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject,
\Closure $proceed,
- $product
+ $productId
) {
- $proceed($product);
- $this->_reindexProduct($product);
- }
-
- /**
- * Reindex product price
- *
- * @param int|\Magento\Catalog\Model\Product $product
- *
- * @return void
- */
- protected function _reindexProduct($product)
- {
- $productId = is_numeric($product) ? $product : $product->getId();
- $this->_processor->reindexRow($productId);
+ $proceed($productId);
+ $this->priceProcessor->reindexRow($productId);
}
}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRules.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRules.php
new file mode 100644
index 0000000000000..1cc389f020069
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRules.php
@@ -0,0 +1,62 @@
+productRuleProcessor = $productRuleProcessor;
+ }
+
+ /**
+ * Apply catalog rules after product save
+ *
+ * @param Product $subject
+ * @param Product $result
+ * @return Product
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterSave(
+ Product $subject,
+ Product $result
+ ) {
+ if (!$result->getIsMassupdate()) {
+ $this->productRuleProcessor->reindexRow($result->getId());
+ }
+ return $result;
+ }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Website.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Website.php
new file mode 100644
index 0000000000000..14c2f42bd7a7e
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Website.php
@@ -0,0 +1,59 @@
+ruleProductProcessor = $ruleProductProcessor;
+ }
+
+ /**
+ * Invalidate catalog price rule indexer
+ *
+ * @param \Magento\Store\Model\Website $subject
+ * @param \Magento\Store\Model\Website $result
+ * @return \Magento\Store\Model\Website
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterDelete(
+ \Magento\Store\Model\Website $subject,
+ \Magento\Store\Model\Website $result
+ ) {
+ $this->ruleProductProcessor->markIndexerAsInvalid();
+ return $result;
+ }
+}
diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json
index 653131508c7d3..b27dd420171c0 100644
--- a/app/code/Magento/CatalogRule/composer.json
+++ b/app/code/Magento/CatalogRule/composer.json
@@ -3,17 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-rule": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-rule": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-indexer": "0.1.0-alpha104",
+ "magento/module-import-export": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
index 2951c5c618a84..2d40215117091 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
@@ -32,4 +32,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
index 1f8dc132df6c6..dbfa51c8e1c4d 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
@@ -27,19 +27,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/CatalogRule/etc/crontab.xml b/app/code/Magento/CatalogRule/etc/crontab.xml
index c727ac11d8fca..0210d925dbfa7 100644
--- a/app/code/Magento/CatalogRule/etc/crontab.xml
+++ b/app/code/Magento/CatalogRule/etc/crontab.xml
@@ -25,7 +25,7 @@
-->
-
+
0 1 * * *
diff --git a/app/code/Magento/CatalogRule/etc/di.xml b/app/code/Magento/CatalogRule/etc/di.xml
index 6bab83ce4c4eb..07960de9e68b1 100644
--- a/app/code/Magento/CatalogRule/etc/di.xml
+++ b/app/code/Magento/CatalogRule/etc/di.xml
@@ -51,7 +51,6 @@
-
@@ -59,5 +58,7 @@
-
+
+
+
diff --git a/app/code/Magento/CatalogRule/etc/events.xml b/app/code/Magento/CatalogRule/etc/events.xml
index 939092ebfea77..28c5e57be048d 100644
--- a/app/code/Magento/CatalogRule/etc/events.xml
+++ b/app/code/Magento/CatalogRule/etc/events.xml
@@ -27,7 +27,4 @@
-
-
-
diff --git a/app/code/Magento/CatalogRule/etc/indexer.xml b/app/code/Magento/CatalogRule/etc/indexer.xml
new file mode 100644
index 0000000000000..cc9b494a20f85
--- /dev/null
+++ b/app/code/Magento/CatalogRule/etc/indexer.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ Catalog Rule Product
+ Indexed rule/product association
+
+
+ Catalog Product Rule
+ Indexed product/rule association
+
+
diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml
index 5fda9f6e40ce4..ca42e637d3a24 100644
--- a/app/code/Magento/CatalogRule/etc/module.xml
+++ b/app/code/Magento/CatalogRule/etc/module.xml
@@ -37,6 +37,8 @@
+
+
diff --git a/app/code/Magento/CatalogRule/etc/mview.xml b/app/code/Magento/CatalogRule/etc/mview.xml
new file mode 100644
index 0000000000000..db09195083aee
--- /dev/null
+++ b/app/code/Magento/CatalogRule/etc/mview.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.3-1.6.0.4.php
new file mode 100644
index 0000000000000..c749227b35ef6
--- /dev/null
+++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.3-1.6.0.4.php
@@ -0,0 +1,57 @@
+startSetup();
+
+$table = $installer->getTable('catalogrule_product_price');
+$installer->getConnection()->dropForeignKey(
+ $table,
+ $installer->getFkName('catalogrule_product_price', 'product_id', 'catalog_product_entity', 'entity_id')
+)->dropForeignKey(
+ $table,
+ $installer->getFkName('catalogrule_product_price', 'customer_group_id', 'customer_group', 'customer_group_id')
+)->dropForeignKey(
+ $table,
+ $installer->getFkName('catalogrule_product_price', 'website_id', 'store_website', 'website_id')
+);
+
+$table = $installer->getTable('catalogrule_product');
+$installer->getConnection()->dropForeignKey(
+ $table,
+ $installer->getFkName('catalogrule_product', 'product_id', 'catalog_product_entity', 'entity_id')
+)->dropForeignKey(
+ $table,
+ $installer->getFkName('catalogrule_product', 'customer_group_id', 'customer_group', 'customer_group_id')
+)->dropForeignKey(
+ $table,
+ $installer->getFkName('catalogrule_product', 'website_id', 'store_website', 'website_id')
+)->dropForeignKey(
+ $table,
+ $installer->getFkName('catalogrule_product', 'rule_id', 'catalogrule', 'rule_id')
+);
+
+$installer->endSetup();
diff --git a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
index 5764354f7a8fb..778b32adc3687 100644
--- a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
+++ b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
@@ -38,7 +38,7 @@
use Magento\Framework\Registry;
use Magento\Framework\Model\Resource\AbstractResource;
use Magento\Framework\Data\Collection\Db;
-use Magento\Indexer\Model\IndexerFactory;
+use Magento\Indexer\Model\IndexerRegistry;
class Type extends Value
{
@@ -49,17 +49,15 @@ class Type extends Value
*/
protected $_catalogSearchFulltext;
- /**
- * @var \Magento\Indexer\Model\IndexerFactory
- */
- protected $indexerFactory;
+ /** @var IndexerRegistry */
+ protected $indexerRegistry;
/**
* @param Context $context
* @param Registry $registry
* @param ScopeConfigInterface $config
* @param Fulltext $catalogSearchFulltext
- * @param IndexerFactory $indexerFactory
+ * @param IndexerRegistry $indexerRegistry
* @param AbstractResource $resource
* @param Db $resourceCollection
* @param array $data
@@ -69,13 +67,13 @@ public function __construct(
Registry $registry,
ScopeConfigInterface $config,
Fulltext $catalogSearchFulltext,
- IndexerFactory $indexerFactory,
+ IndexerRegistry $indexerRegistry,
AbstractResource $resource = null,
Db $resourceCollection = null,
array $data = array()
) {
$this->_catalogSearchFulltext = $catalogSearchFulltext;
- $this->indexerFactory = $indexerFactory;
+ $this->indexerRegistry = $indexerRegistry;
parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data);
}
@@ -94,12 +92,8 @@ protected function _afterSave()
);
if ($newValue != $oldValue) {
$this->_catalogSearchFulltext->resetSearchResults();
-
- $indexer = $this->indexerFactory->create();
- $indexer->load(FulltextIndexer::INDEXER_ID);
- $indexer->invalidate();
+ $this->indexerRegistry->get(FulltextIndexer::INDEXER_ID)->invalidate();
}
-
return $this;
}
}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
index b3e8547a1a0b1..57c05e7571153 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
@@ -40,24 +40,22 @@ class Fulltext implements \Magento\Indexer\Model\ActionInterface, \Magento\Frame
*/
protected $rowsActionFactory;
- /**
- * @var \Magento\Indexer\Model\IndexerInterface
- */
- protected $indexer;
+ /** @var \Magento\Indexer\Model\IndexerRegistry */
+ protected $indexerRegistry;
/**
* @param Fulltext\Action\FullFactory $fullActionFactory
* @param Fulltext\Action\RowsFactory $rowsActionFactory
- * @param \Magento\Indexer\Model\IndexerInterface $indexer
+ * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
*/
public function __construct(
Fulltext\Action\FullFactory $fullActionFactory,
Fulltext\Action\RowsFactory $rowsActionFactory,
- \Magento\Indexer\Model\IndexerInterface $indexer
+ \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
) {
$this->fullActionFactory = $fullActionFactory;
$this->rowsActionFactory = $rowsActionFactory;
- $this->indexer = $indexer;
+ $this->indexerRegistry = $indexerRegistry;
}
/**
@@ -68,7 +66,7 @@ public function __construct(
*/
public function execute($ids)
{
- $this->indexer->load(self::INDEXER_ID);
+ $this->indexerRegistry->get(self::INDEXER_ID);
/** @var Fulltext\Action\Rows $action */
$action = $this->rowsActionFactory->create();
@@ -91,7 +89,7 @@ public function executeFull()
* @param int[] $ids
* @return void
*/
- public function executeList($ids)
+ public function executeList(array $ids)
{
$this->execute($ids);
}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php
index 5f1a512b4ca57..47e19697662a6 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php
@@ -27,31 +27,16 @@
abstract class AbstractPlugin
{
- /**
- * @var \Magento\Indexer\Model\IndexerInterface
- */
- protected $indexer;
+ /** @var \Magento\Indexer\Model\IndexerRegistry */
+ protected $indexerRegistry;
/**
- * @param \Magento\Indexer\Model\IndexerInterface $indexer
+ * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
*/
public function __construct(
- \Magento\Indexer\Model\IndexerInterface $indexer
+ \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
) {
- $this->indexer = $indexer;
- }
-
- /**
- * Return own indexer object
- *
- * @return \Magento\Indexer\Model\IndexerInterface
- */
- protected function getIndexer()
- {
- if (!$this->indexer->getId()) {
- $this->indexer->load(Fulltext::INDEXER_ID);
- }
- return $this->indexer;
+ $this->indexerRegistry = $indexerRegistry;
}
/**
@@ -62,8 +47,9 @@ protected function getIndexer()
*/
protected function reindexRow($productId)
{
- if (!$this->getIndexer()->isScheduled()) {
- $this->getIndexer()->reindexRow($productId);
+ $indexer = $this->indexerRegistry->get(Fulltext::INDEXER_ID);
+ if (!$indexer->isScheduled()) {
+ $indexer->reindexRow($productId);
}
}
@@ -75,8 +61,9 @@ protected function reindexRow($productId)
*/
protected function reindexList(array $productIds)
{
- if (!$this->getIndexer()->isScheduled()) {
- $this->getIndexer()->reindexList($productIds);
+ $indexer = $this->indexerRegistry->get(Fulltext::INDEXER_ID);
+ if (!$indexer->isScheduled()) {
+ $indexer->reindexList($productIds);
}
}
}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php
index 20200e4e6814d..3bc0e00bf5141 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php
@@ -23,6 +23,8 @@
*/
namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin;
+use Magento\CatalogSearch\Model\Indexer\Fulltext;
+
class Attribute extends AbstractPlugin
{
/**
@@ -43,7 +45,7 @@ public function aroundSave(
$needInvalidation = !$attribute->isObjectNew() && $attribute->dataHasChangedFor('is_searchable');
$result = $proceed($attribute);
if ($needInvalidation) {
- $this->getIndexer()->invalidate();
+ $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
}
return $result;
@@ -67,7 +69,7 @@ public function aroundDelete(
$needInvalidation = !$attribute->isObjectNew() && $attribute->getIsSearchable();
$result = $proceed($attribute);
if ($needInvalidation) {
- $this->getIndexer()->invalidate();
+ $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
}
return $result;
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php
index 7222e6826f515..51cd5afed0186 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php
@@ -24,6 +24,7 @@
namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Store;
use Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\AbstractPlugin;
+use Magento\CatalogSearch\Model\Indexer\Fulltext;
class Group extends AbstractPlugin
{
@@ -45,7 +46,7 @@ public function aroundSave(
$needInvalidation = !$group->isObjectNew() && $group->dataHasChangedFor('website_id');
$result = $proceed($group);
if ($needInvalidation) {
- $this->getIndexer()->invalidate();
+ $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
}
return $result;
@@ -64,8 +65,7 @@ public function afterDelete(
\Magento\Store\Model\Resource\Group $subject,
\Magento\Store\Model\Resource\Group $result
) {
- $this->getIndexer()->invalidate();
-
+ $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
return $result;
}
}
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php
index 6757ba73a85c6..7c7eca701a78f 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php
@@ -24,6 +24,7 @@
namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Store;
use Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\AbstractPlugin;
+use Magento\CatalogSearch\Model\Indexer\Fulltext;
class View extends AbstractPlugin
{
@@ -45,9 +46,8 @@ public function aroundSave(
$needInvalidation = $store->isObjectNew();
$result = $proceed($store);
if ($needInvalidation) {
- $this->getIndexer()->invalidate();
+ $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
}
-
return $result;
}
@@ -64,8 +64,7 @@ public function afterDelete(
\Magento\Store\Model\Resource\Store $subject,
\Magento\Store\Model\Resource\Store $result
) {
- $this->getIndexer()->invalidate();
-
+ $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
return $result;
}
}
diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json
index f5caacd09782f..be48aeb8f502b 100644
--- a/app/code/Magento/CatalogSearch/composer.json
+++ b/app/code/Magento/CatalogSearch/composer.json
@@ -3,21 +3,21 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-search": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-indexer": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-search": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-indexer": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/CatalogSearch/etc/di.xml b/app/code/Magento/CatalogSearch/etc/di.xml
index 52a3239ecf428..b3710d4628e55 100644
--- a/app/code/Magento/CatalogSearch/etc/di.xml
+++ b/app/code/Magento/CatalogSearch/etc/di.xml
@@ -66,11 +66,6 @@
-
-
- Magento\Indexer\Model\IndexerInterface
-
-
diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json
index 3333a8d3f81b1..1a9acf737b475 100644
--- a/app/code/Magento/CatalogUrlRewrite/composer.json
+++ b/app/code/Magento/CatalogUrlRewrite/composer.json
@@ -3,18 +3,18 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-catalog-import-export": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-import-export": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-url-rewrite": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-catalog-import-export": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-import-export": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-url-rewrite": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json
index d5b7d880aa014..ed2ea7642a2c3 100644
--- a/app/code/Magento/Centinel/composer.json
+++ b/app/code/Magento/Centinel/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Centinel/etc/module.xml b/app/code/Magento/Centinel/etc/module.xml
index 6a55692bb7023..6c4062ae0fc4c 100644
--- a/app/code/Magento/Centinel/etc/module.xml
+++ b/app/code/Magento/Centinel/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Checkout/Model/Resource/Cart.php b/app/code/Magento/Checkout/Model/Resource/Cart.php
index 0f7e22bafe4fc..fc62f303dbf96 100644
--- a/app/code/Magento/Checkout/Model/Resource/Cart.php
+++ b/app/code/Magento/Checkout/Model/Resource/Cart.php
@@ -37,7 +37,7 @@ class Cart extends \Magento\Framework\Model\Resource\Db\AbstractDb
*/
protected function _construct()
{
- $this->_init('sales_flat_quote', 'entity_id');
+ $this->_init('sales_quote', 'entity_id');
}
/**
@@ -50,7 +50,7 @@ public function fetchItemsSummary($quoteId)
{
$read = $this->_getReadAdapter();
$select = $read->select()->from(
- array('q' => $this->getTable('sales_flat_quote')),
+ array('q' => $this->getTable('sales_quote')),
array('items_qty', 'items_count')
)->where(
'q.entity_id = :quote_id'
@@ -70,7 +70,7 @@ public function fetchItems($quoteId)
{
$read = $this->_getReadAdapter();
$select = $read->select()->from(
- array('qi' => $this->getTable('sales_flat_quote_item')),
+ array('qi' => $this->getTable('sales_quote_item')),
array('id' => 'item_id', 'product_id', 'super_product_id', 'qty', 'created_at')
)->where(
'qi.quote_id = :quote_id'
@@ -90,7 +90,7 @@ public function addExcludeProductFilter($collection, $quoteId)
{
$adapter = $this->_getReadAdapter();
$exclusionSelect = $adapter->select()->from(
- $this->getTable('sales_flat_quote_item'),
+ $this->getTable('sales_quote_item'),
array('product_id')
)->where(
'quote_id = ?',
diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php
index 8ffe5fbcac0b0..2e0fef9d01309 100644
--- a/app/code/Magento/Checkout/Model/Type/Onepage.php
+++ b/app/code/Magento/Checkout/Model/Type/Onepage.php
@@ -480,7 +480,7 @@ public function saveBilling($data, $customerAddressId)
}
}
- $address->save();
+ $this->getQuote()->save();
$this->getCheckout()->setStepData(
'billing',
@@ -700,11 +700,6 @@ public function savePayment($data)
}
$quote = $this->getQuote();
- // shipping totals may be affected by payment method
- if (!$quote->isVirtual() && $quote->getShippingAddress()) {
- $quote->getShippingAddress()->setCollectShippingRates(true);
- }
-
$data['checks'] = array(
\Magento\Payment\Model\Method\AbstractMethod::CHECK_USE_CHECKOUT,
\Magento\Payment\Model\Method\AbstractMethod::CHECK_USE_FOR_COUNTRY,
@@ -810,7 +805,8 @@ protected function _prepareNewCustomerQuote()
$billing->setCustomerAddressData($customerBillingData);
$dataArray = $this->_objectCopyService->getDataFromFieldset('checkout_onepage_quote', 'to_customer', $quote);
- $customerData = $this->_customerBuilder->mergeDataObjectWithArray($customerData, $dataArray);
+ $customerData = $this->_customerBuilder->mergeDataObjectWithArray($customerData, $dataArray)
+ ->create();
$quote->setCustomerData($customerData)->setCustomerId(true);
// TODO : Eventually need to remove this legacy hack
// Add billing address to quote since customer Data Object does not hold address information
diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php
index 59fe4b3af21fc..8e1305904c589 100644
--- a/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php
+++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php
@@ -27,7 +27,7 @@
use Magento\Checkout\Service\V1\Data\Cart\Address\RegionBuilder;
use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
/**
* Quote address data object builder
@@ -45,13 +45,13 @@ class AddressBuilder extends ExtensibleObjectBuilder
/**
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param CustomerMetadataServiceInterface $metadataService
* @param RegionBuilder $regionBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
CustomerMetadataServiceInterface $metadataService,
RegionBuilder $regionBuilder
) {
diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php
index 9f7c98cf7f4e7..597442d7a1b35 100644
--- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php
+++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php
@@ -28,7 +28,7 @@
*
* @codeCoverageIgnore
*/
-class Item extends \Magento\Framework\Api\AbstractSimpleObject
+class Item extends \Magento\Framework\Api\AbstractExtensibleObject
{
/**
* Price.
diff --git a/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php
index 31005a60fa8fd..60e9f6adb8fc9 100644
--- a/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php
+++ b/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php
@@ -23,7 +23,7 @@
*/
namespace Magento\Checkout\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\ObjectFactory;
use Magento\Framework\Api\AbstractSearchResultsBuilder;
@@ -38,14 +38,14 @@ class CartSearchResultsBuilder extends AbstractSearchResultsBuilder
* Constructor
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param CartBuilder $itemObjectBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
SearchCriteriaBuilder $searchCriteriaBuilder,
CartBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
index 01939494ff4d9..2473c609a809f 100644
--- a/app/code/Magento/Checkout/composer.json
+++ b/app/code/Magento/Checkout/composer.json
@@ -3,27 +3,27 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-authorization": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-gift-message": "0.1.0-alpha103",
- "magento/module-wishlist": "0.1.0-alpha103",
- "magento/module-page-cache": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-msrp": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-authorization": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-gift-message": "0.1.0-alpha104",
+ "magento/module-wishlist": "0.1.0-alpha104",
+ "magento/module-page-cache": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-msrp": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json
index 555ebf8e9056a..ba78894710633 100644
--- a/app/code/Magento/CheckoutAgreements/composer.json
+++ b/app/code/Magento/CheckoutAgreements/composer.json
@@ -3,14 +3,14 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php b/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php
index 36b0da9c589b0..7ea1db863838c 100644
--- a/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php
+++ b/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php
@@ -35,7 +35,7 @@ class Actions implements RowInterface
/**
* Url path
*/
- const URL_PATH = 'cms/page/edit';
+ const URL_PATH = '*/*/edit';
/**
* @var UrlBuilder
diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json
index 14df5fea779d6..e6ef44c0fc647 100644
--- a/app/code/Magento/Cms/composer.json
+++ b/app/code/Magento/Cms/composer.json
@@ -3,19 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-widget": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-email": "0.1.0-alpha103",
- "magento/module-ui": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-widget": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-email": "0.1.0-alpha104",
+ "magento/module-ui": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml
index 274227dfd4a76..b55a731a87238 100644
--- a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml
+++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml
@@ -23,15 +23,11 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json
index 7e9b6101b4f4f..35b70668be015 100644
--- a/app/code/Magento/CmsUrlRewrite/composer.json
+++ b/app/code/Magento/CmsUrlRewrite/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-url-rewrite": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-url-rewrite": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json
index 40df384e749f5..619a8ec5fc779 100644
--- a/app/code/Magento/ConfigurableImportExport/composer.json
+++ b/app/code/Magento/ConfigurableImportExport/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-catalog-import-export": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-import-export": "0.1.0-alpha103",
- "magento/module-configurable-product": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-catalog-import-export": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-import-export": "0.1.0-alpha104",
+ "magento/module-configurable-product": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json
index 1a43a63ebcba8..8e10f701a525a 100644
--- a/app/code/Magento/ConfigurableProduct/composer.json
+++ b/app/code/Magento/ConfigurableProduct/composer.json
@@ -3,23 +3,23 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-catalog-rule": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
- "magento/module-webapi": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-catalog-rule": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
+ "magento/module-webapi": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json
index ea0865667585c..44d38f24d3afa 100644
--- a/app/code/Magento/Contact/composer.json
+++ b/app/code/Magento/Contact/composer.json
@@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json
index b32e8bdd5a99a..9ade2b568acb8 100644
--- a/app/code/Magento/Core/composer.json
+++ b/app/code/Magento/Core/composer.json
@@ -3,18 +3,18 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-cron": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-page-cache": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-cron": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-page-cache": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json
index b5784bd3d380d..48bc799790395 100644
--- a/app/code/Magento/Cron/composer.json
+++ b/app/code/Magento/Cron/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json
index 3477e2ed64c48..00be91ba47289 100644
--- a/app/code/Magento/CurrencySymbol/composer.json
+++ b/app/code/Magento/CurrencySymbol/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-page-cache": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-page-cache": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Customer/Api/AccountManagementInterface.php b/app/code/Magento/Customer/Api/AccountManagementInterface.php
index b32cb52ab15b9..552320ac5b54e 100644
--- a/app/code/Magento/Customer/Api/AccountManagementInterface.php
+++ b/app/code/Magento/Customer/Api/AccountManagementInterface.php
@@ -185,6 +185,27 @@ public function isEmailAvailable($customerEmail, $websiteId = null);
* @param int $customerWebsiteId
* @param int $storeId
* @return bool
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function isCustomerInStore($customerWebsiteId, $storeId);
+
+ /**
+ * Retrieve default billing address for the given customerId.
+ *
+ * @param int $customerId
+ * @return \Magento\Customer\Api\Data\AddressInterface|null
+ * @throws \Magento\Framework\Exception\NoSuchEntityException If the customer Id is invalid
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ public function getDefaultBillingAddress($customerId);
+
+ /**
+ * Retrieve default shipping address for the given customerId.
+ *
+ * @param int $customerId
+ * @return \Magento\Customer\Api\Data\AddressInterface|null
+ * @throws \Magento\Framework\Exception\NoSuchEntityException If the customer Id is invalid
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ public function getDefaultShippingAddress($customerId);
}
diff --git a/app/code/Magento/Customer/Api/Data/AddressInterface.php b/app/code/Magento/Customer/Api/Data/AddressInterface.php
index 3e616dd30f44a..5452be10a56d7 100644
--- a/app/code/Magento/Customer/Api/Data/AddressInterface.php
+++ b/app/code/Magento/Customer/Api/Data/AddressInterface.php
@@ -51,6 +51,8 @@ interface AddressInterface extends ExtensibleDataInterface
const PREFIX = 'prefix';
const SUFFIX = 'suffix';
const VAT_ID = 'vat_id';
+ const DEFAULT_BILLING = 'default_billing';
+ const DEFAULT_SHIPPING = 'default_shipping';
/**#@-*/
/**
@@ -164,4 +166,18 @@ public function getSuffix();
* @return string|null
*/
public function getVatId();
+
+ /**
+ * Get if this address is default shipping address.
+ *
+ * @return bool|null
+ */
+ public function isDefaultShipping();
+
+ /**
+ * Get if this address is default billing address
+ *
+ * @return bool|null
+ */
+ public function isDefaultBilling();
}
diff --git a/app/code/Magento/Customer/Block/Address/Edit.php b/app/code/Magento/Customer/Block/Address/Edit.php
index ca9b2e6d75f15..c463113e651ed 100644
--- a/app/code/Magento/Customer/Block/Address/Edit.php
+++ b/app/code/Magento/Customer/Block/Address/Edit.php
@@ -146,7 +146,8 @@ protected function _prepareLayout()
'region' => $postedData['region']
);
}
- $this->_address = $this->_addressBuilder->mergeDataObjectWithArray($this->_address, $postedData);
+ $this->_address = $this->_addressBuilder->mergeDataObjectWithArray($this->_address, $postedData)
+ ->create();
}
return $this;
diff --git a/app/code/Magento/Customer/Controller/Account/Edit.php b/app/code/Magento/Customer/Controller/Account/Edit.php
index df78e2f6ddc7f..efab0d71cfdeb 100644
--- a/app/code/Magento/Customer/Controller/Account/Edit.php
+++ b/app/code/Magento/Customer/Controller/Account/Edit.php
@@ -73,7 +73,8 @@ public function execute()
$customerId = $this->_getSession()->getCustomerId();
$customerDataObject = $this->customerAccountService->getCustomer($customerId);
if (!empty($data)) {
- $customerDataObject = $this->customerBuilder->mergeDataObjectWithArray($customerDataObject, $data);
+ $customerDataObject = $this->customerBuilder->mergeDataObjectWithArray($customerDataObject, $data)
+ ->create();
}
$this->_getSession()->setCustomerData($customerDataObject);
$this->_getSession()->setChangePassword($this->getRequest()->getParam('changepass') == 1);
diff --git a/app/code/Magento/Customer/Controller/Address/FormPost.php b/app/code/Magento/Customer/Controller/Address/FormPost.php
index 8b68db9114818..73246c711794e 100644
--- a/app/code/Magento/Customer/Controller/Address/FormPost.php
+++ b/app/code/Magento/Customer/Controller/Address/FormPost.php
@@ -74,6 +74,8 @@ protected function _extractAddress()
->populateWithArray(array_merge($existingAddressData, $attributeValues))
->setCustomerId($this->_getSession()->getCustomerId())
->setRegion($region)
+ ->setDefaultBilling($this->getRequest()->getParam('default_billing', false))
+ ->setDefaultShipping($this->getRequest()->getParam('default_shipping', false))
->create();
}
diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php
index ea1bbc19ff2a0..b2d54213fa67b 100644
--- a/app/code/Magento/Customer/Model/AccountManagement.php
+++ b/app/code/Magento/Customer/Model/AccountManagement.php
@@ -32,7 +32,6 @@
use Magento\Customer\Model\Config\Share as ConfigShare;
use Magento\Customer\Model\Customer as CustomerModel;
use Magento\Customer\Model\CustomerFactory;
-use Magento\Customer\Model\CustomerRegistry;
use Magento\Customer\Model\Metadata\Validator;
use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -54,6 +53,7 @@
use Magento\Framework\StoreManagerInterface;
use Magento\Framework\UrlInterface;
use Magento\Framework\Reflection\DataObjectProcessor;
+use Magento\Customer\Api\Data\AddressInterface;
/**
* Handle various customer account actions
@@ -542,6 +542,24 @@ public function createAccountWithPasswordHash(
return $customer;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultBillingAddress($customerId)
+ {
+ $customer = $this->customerRepository->getById($customerId);
+ return $this->getAddressById($customer, $customer->getDefaultBilling());
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultShippingAddress($customerId)
+ {
+ $customer = $this->customerRepository->getById($customerId);
+ return $this->getAddressById($customer, $customer->getDefaultShipping());
+ }
+
/**
* Send either confirmation or welcome email after an account creation
*
@@ -750,7 +768,6 @@ public function isReadonly($customerId)
return $customer->getDeleteable();
}
-
/**
* Send email with new account related information
*
@@ -795,10 +812,12 @@ protected function sendNewAccountEmail(
}
/**
+ * Send email to customer when his password is reset
+ *
* @param CustomerInterface $customer
* @return $this
*/
- public function sendPasswordResetNotificationEmail($customer)
+ protected function sendPasswordResetNotificationEmail($customer)
{
$storeId = $customer->getStoreId();
if (!$storeId) {
@@ -1084,6 +1103,23 @@ public function sendPasswordResetConfirmationEmail($customer)
return $this;
}
+ /**
+ * Get address by id
+ *
+ * @param CustomerInterface $customer
+ * @param int $addressId
+ * @return AddressInterface|null
+ */
+ protected function getAddressById(CustomerInterface $customer, $addressId)
+ {
+ foreach ($customer->getAddresses() as $address) {
+ if ($address->getId() == $addressId) {
+ return $address;
+ }
+ }
+ return null;
+ }
+
/**
* Create an object with data merged from Customer and CustomerSecure
*
diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php
index 9545c1ee83469..0ec83e7eb9e0c 100644
--- a/app/code/Magento/Customer/Model/Address.php
+++ b/app/code/Magento/Customer/Model/Address.php
@@ -153,6 +153,10 @@ public function updateData(\Magento\Customer\Api\Data\AddressInterface $address)
$this->setDataUsingMethod($attributeCode, $attributeData);
}
}
+ // Need to explicitly set this due to discrepancy in the keys between model and data object
+ $this->setIsDefaultBilling($address->isDefaultBilling());
+ $this->setIsDefaultShipping($address->isDefaultShipping());
+
// Need to use attribute set or future updates can cause data loss
if (!$this->getAttributeSetId()) {
$this->setAttributeSetId(AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS);
diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
index ca1553922e8c2..26402bb2a8ba4 100644
--- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
+++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
@@ -43,13 +43,11 @@ class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke
protected $string;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Framework\Stdlib\String $string
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\String $string)
+ public function __construct(\Magento\Framework\Stdlib\String $string)
{
$this->string = $string;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php
index da9753ef73e4a..83494dac28ce8 100644
--- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php
+++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php
@@ -36,13 +36,11 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
protected $_storeManager;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Framework\StoreManagerInterface $storeManager
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\StoreManagerInterface $storeManager)
+ public function __construct(\Magento\Framework\StoreManagerInterface $storeManager)
{
$this->_storeManager = $storeManager;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php
index c8c99a5f9582b..5e7f4741ea874 100644
--- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php
+++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php
@@ -36,13 +36,11 @@ class Website extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken
protected $_storeManager;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Framework\StoreManagerInterface $storeManager
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\StoreManagerInterface $storeManager)
+ public function __construct(\Magento\Framework\StoreManagerInterface $storeManager)
{
$this->_storeManager = $storeManager;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Customer/Model/Data/Address.php b/app/code/Magento/Customer/Model/Data/Address.php
index e9f5ebbe54ba8..5bff296dbc3e1 100644
--- a/app/code/Magento/Customer/Model/Data/Address.php
+++ b/app/code/Magento/Customer/Model/Data/Address.php
@@ -187,4 +187,24 @@ public function getCustomerId()
{
return $this->_get(self::CUSTOMER_ID);
}
+
+ /**
+ * Get if this address is default shipping address.
+ *
+ * @return bool|null
+ */
+ public function isDefaultShipping()
+ {
+ return $this->_get(self::DEFAULT_SHIPPING);
+ }
+
+ /**
+ * Get if this address is default billing address
+ *
+ * @return bool|null
+ */
+ public function isDefaultBilling()
+ {
+ return $this->_get(self::DEFAULT_BILLING);
+ }
}
diff --git a/app/code/Magento/Customer/Model/Data/CustomerBuilder.php b/app/code/Magento/Customer/Model/Data/CustomerBuilder.php
index 763a05b828819..0b4a91ba19341 100644
--- a/app/code/Magento/Customer/Model/Data/CustomerBuilder.php
+++ b/app/code/Magento/Customer/Model/Data/CustomerBuilder.php
@@ -26,7 +26,7 @@
use Magento\Framework\Api\AbstractExtensibleObject as ExtensibleObject;
use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
/**
@@ -40,12 +40,12 @@ class CustomerBuilder extends ExtensibleObjectBuilder
{
/**
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param CustomerMetadataServiceInterface $metadataService
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
CustomerMetadataServiceInterface $metadataService
) {
parent::__construct($objectFactory, $valueBuilder, $metadataService);
diff --git a/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php b/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php
index 799eb75a951ef..41ee039c924c8 100644
--- a/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php
+++ b/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php
@@ -41,9 +41,9 @@ class DepersonalizePlugin
protected $customerSession;
/**
- * @var \Magento\Customer\Model\Customer
+ * @var \Magento\Customer\Model\CustomerFactory
*/
- protected $customer;
+ protected $customerFactory;
/**
* @var \Magento\Framework\App\RequestInterface
@@ -95,7 +95,7 @@ public function __construct(
) {
$this->session = $session;
$this->customerSession = $customerSession;
- $this->customer = $customerFactory->create();
+ $this->customerFactory = $customerFactory;
$this->request = $request;
$this->moduleManager = $moduleManager;
$this->visitor = $visitor;
@@ -140,8 +140,7 @@ public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subjec
$this->customerSession->clearStorage();
$this->session->setData(\Magento\Framework\Data\Form\FormKey::FORM_KEY, $this->formKey);
$this->customerSession->setCustomerGroupId($this->customerGroupId);
- $this->customer->setGroupId($this->customerGroupId);
- $this->customerSession->setCustomer($this->customer);
+ $this->customerSession->setCustomer($this->customerFactory->create()->setGroupId($this->customerGroupId));
}
return $result;
}
diff --git a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php
index ae46d205a313d..51456c5c87489 100644
--- a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php
+++ b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php
@@ -36,13 +36,11 @@ class Region extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
protected $_regionFactory;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Directory\Model\RegionFactory $regionFactory
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Directory\Model\RegionFactory $regionFactory)
+ public function __construct(\Magento\Directory\Model\RegionFactory $regionFactory)
{
$this->_regionFactory = $regionFactory;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Customer/Model/Resource/AddressRepository.php b/app/code/Magento/Customer/Model/Resource/AddressRepository.php
index 6d3fbec60184d..76ba7615d267b 100644
--- a/app/code/Magento/Customer/Model/Resource/AddressRepository.php
+++ b/app/code/Magento/Customer/Model/Resource/AddressRepository.php
@@ -126,6 +126,9 @@ public function save(\Magento\Customer\Api\Data\AddressInterface $address)
throw $inputException;
}
$this->addressResource->save($addressModel);
+ // Clean up the customer registry since the Address save has a
+ // side effect on customer : \Magento\Customer\Model\Resource\Address::_afterSave
+ $this->customerRegistry->remove($address->getCustomerId());
$this->addressRegistry->push($addressModel);
$customerModel->getAddressesCollection()->clear();
diff --git a/app/code/Magento/Customer/Model/Resource/CustomerRepository.php b/app/code/Magento/Customer/Model/Resource/CustomerRepository.php
index f6af8b15aebe4..abace9e1e65df 100644
--- a/app/code/Magento/Customer/Model/Resource/CustomerRepository.php
+++ b/app/code/Magento/Customer/Model/Resource/CustomerRepository.php
@@ -142,7 +142,6 @@ public function __construct(
*/
public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $passwordHash = null)
{
- $isNewCustomer = $customer->getId() ? false : true;
$this->validate($customer);
$customerModel = $this->customerFactory->create(
[
diff --git a/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php b/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php
index 5c47d7ea441e5..a245af9aaa7ec 100644
--- a/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php
@@ -27,7 +27,7 @@
use Magento\Customer\Service\V1\AddressMetadataServiceInterface;
use Magento\Framework\Api\AbstractExtensibleObject as ExtensibleObject;
use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
/**
* Builder for the Address Service Data Object
@@ -47,13 +47,13 @@ class AddressBuilder extends ExtensibleObjectBuilder
/**
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param AddressMetadataServiceInterface $metadataService
* @param RegionBuilder $regionBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
AddressMetadataServiceInterface $metadataService,
RegionBuilder $regionBuilder
) {
diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php
index 9940cee023084..7b1a36ea61212 100644
--- a/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php
@@ -26,26 +26,26 @@
use Magento\Framework\Api\AbstractExtensibleObject as ExtensibleObject;
use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
/**
* Builder for the Customer Service Data Object
*
* @method Customer create()
- * @method Customer mergeDataObjectWithArray(ExtensibleObject $dataObject, array $data)
- * @method Customer mergeDataObjects(ExtensibleObject $firstDataObject, ExtensibleObject $secondDataObject)
+ * @method CustomerBuilder mergeDataObjectWithArray(ExtensibleObject $dataObject, array $data)
+ * @method CustomerBuilder mergeDataObjects(ExtensibleObject $firstDataObject, ExtensibleObject $secondDataObject)
*/
class CustomerBuilder extends ExtensibleObjectBuilder
{
/**
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param CustomerMetadataServiceInterface $metadataService
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
CustomerMetadataServiceInterface $metadataService
) {
parent::__construct($objectFactory, $valueBuilder, $metadataService);
diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php
index 0db5a29509120..4944bafcc8b70 100644
--- a/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php
@@ -26,7 +26,7 @@
namespace Magento\Customer\Service\V1\Data;
use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -50,14 +50,14 @@ class CustomerDetailsBuilder extends ExtensibleObjectBuilder
/**
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param CustomerBuilder $customerBuilder
* @param AddressBuilder $addressBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
\Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder,
\Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder
diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php
index 7234903af3d14..225512bf1c2d1 100644
--- a/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php
@@ -27,7 +27,7 @@
use Magento\Framework\Api\ObjectFactory;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Api\AbstractSearchResultsBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -41,14 +41,14 @@ class CustomerGroupSearchResultsBuilder extends AbstractSearchResultsBuilder
* Constructor
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param CustomerDetailsBuilder $itemObjectBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
SearchCriteriaBuilder $searchCriteriaBuilder,
CustomerDetailsBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php
index afeddb6b0b77e..cdfb02dc0cfbe 100644
--- a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php
@@ -25,7 +25,7 @@
use Magento\Framework\Api\AttributeMetadataBuilderInterface;
use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -49,14 +49,14 @@ class AttributeMetadataBuilder extends ExtensibleObjectBuilder implements Attrib
/**
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param OptionBuilder $optionBuilder
* @param ValidationRuleBuilder $validationRuleBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
\Magento\Customer\Service\V1\Data\Eav\OptionBuilder $optionBuilder,
\Magento\Customer\Service\V1\Data\Eav\ValidationRuleBuilder $validationRuleBuilder
diff --git a/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php
index e93bd781654d9..4f7bb8b9839bd 100644
--- a/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php
@@ -24,7 +24,7 @@
namespace Magento\Customer\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\ObjectFactory;
use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -42,14 +42,14 @@ class SearchResultsBuilder extends AbstractSearchResultsBuilder
* Constructor
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param CustomerDetailsBuilder $itemObjectBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
SearchCriteriaBuilder $searchCriteriaBuilder,
CustomerDetailsBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json
index 070aa36013707..480763708111d 100644
--- a/app/code/Magento/Customer/composer.json
+++ b/app/code/Magento/Customer/composer.json
@@ -3,27 +3,27 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-newsletter": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-wishlist": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-review": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-page-cache": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
- "magento/module-authorization": "0.1.0-alpha103",
- "magento/module-integration": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-newsletter": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-wishlist": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-review": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-page-cache": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
+ "magento/module-authorization": "0.1.0-alpha104",
+ "magento/module-integration": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml
index e8e2e10559f48..c9bcffc7b8967 100644
--- a/app/code/Magento/Customer/etc/di.xml
+++ b/app/code/Magento/Customer/etc/di.xml
@@ -72,6 +72,8 @@
Magento\Customer\Helper\Data\Proxy
Magento\Customer\Model\Resource\Customer\Proxy
Magento\Customer\Model\Session\Storage
+ Magento\Customer\Model\Converter\Proxy
+ Magento\Customer\Service\V1\CustomerAccountServiceInterface\Proxy
@@ -104,9 +106,14 @@
Magento\Customer\Helper\Data\Proxy
+ Magento\Customer\Service\V1\CustomerGroupServiceInterface\Proxy
+
+
+
+
+ Magento\Customer\Service\V1\CustomerGroupServiceInterface\Proxy
-
@@ -126,6 +133,7 @@
Magento\Framework\Url
+ Magento\Customer\Model\Converter\Proxy
diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json
index dcf167156e556..b107d8d9b56a9 100644
--- a/app/code/Magento/CustomerImportExport/composer.json
+++ b/app/code/Magento/CustomerImportExport/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-import-export": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-import-export": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json
index e08dbfe35a4d6..6283b4dc180f9 100644
--- a/app/code/Magento/DesignEditor/composer.json
+++ b/app/code/Magento/DesignEditor/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json
index b1c924676704d..61bec06052b83 100644
--- a/app/code/Magento/Dhl/composer.json
+++ b/app/code/Magento/Dhl/composer.json
@@ -3,21 +3,21 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.0.php b/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.0.php
rename to app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Dhl/etc/module.xml b/app/code/Magento/Dhl/etc/module.xml
index a0e44e807650a..bbdea658e8958 100644
--- a/app/code/Magento/Dhl/etc/module.xml
+++ b/app/code/Magento/Dhl/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json
index fc660b3e373ec..33cb21f8470e0 100644
--- a/app/code/Magento/Directory/composer.json
+++ b/app/code/Magento/Directory/composer.json
@@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Downloadable/Model/Observer.php b/app/code/Magento/Downloadable/Model/Observer.php
index 4de1abcc23d1d..9ba58b5808dd2 100644
--- a/app/code/Magento/Downloadable/Model/Observer.php
+++ b/app/code/Magento/Downloadable/Model/Observer.php
@@ -23,6 +23,8 @@
*/
namespace Magento\Downloadable\Model;
+use Magento\Store\Model\ScopeInterface;
+
/**
* Downloadable Products Observer
*
@@ -171,7 +173,7 @@ public function saveDownloadableOrderItem($observer)
->_scopeConfig
->getValue(
\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE
+ ScopeInterface::SCOPE_STORE
);
$linkPurchased->setLinkSectionTitle($linkSectionTitle)->save();
foreach ($linkIds as $linkId) {
@@ -269,7 +271,7 @@ public function setLinkStatus($observer)
$downloadableItemsStatuses = array();
$orderItemStatusToEnable = $this->_scopeConfig->getValue(
\Magento\Downloadable\Model\Link\Purchased\Item::XML_PATH_ORDER_ITEM_STATUS,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+ ScopeInterface::SCOPE_STORE,
$order->getStoreId()
);
@@ -355,31 +357,31 @@ public function setLinkStatus($observer)
*/
public function isAllowedGuestCheckout(\Magento\Framework\Event\Observer $observer)
{
- $quote = $observer->getEvent()->getQuote();
- /* @var $quote \Magento\Sales\Model\Quote */
$store = $observer->getEvent()->getStore();
$result = $observer->getEvent()->getResult();
- $isContain = false;
+ $result->setIsAllowed(true);
+
+ if (!$this->_scopeConfig->isSetFlag(
+ self::XML_PATH_DISABLE_GUEST_CHECKOUT,
+ ScopeInterface::SCOPE_STORE,
+ $store
+ )) {
+ return $this;
+ }
+
+ /* @var $quote \Magento\Sales\Model\Quote */
+ $quote = $observer->getEvent()->getQuote();
foreach ($quote->getAllItems() as $item) {
if (($product = $item->getProduct())
&& $product->getTypeId() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE
) {
- $isContain = true;
+ $result->setIsAllowed(false);
+ break;
}
}
- if ($isContain
- && $this->_scopeConfig->isSetFlag(
- self::XML_PATH_DISABLE_GUEST_CHECKOUT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- )
- ) {
- $result->setIsAllowed(false);
- }
-
return $this;
}
diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json
index 54b051f3ba5cf..6ece1ac9540a4 100644
--- a/app/code/Magento/Downloadable/composer.json
+++ b/app/code/Magento/Downloadable/composer.json
@@ -3,26 +3,26 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-wishlist": "0.1.0-alpha103",
- "magento/module-gift-message": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-msrp": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-wishlist": "0.1.0-alpha104",
+ "magento/module-gift-message": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-msrp": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
index 8f22273500453..f9156743622ff 100644
--- a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
@@ -249,9 +249,9 @@
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_flat_order', 'entity_id'),
+ $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $installer->getTable('sales_flat_order'),
+ $installer->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
@@ -383,9 +383,9 @@
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('downloadable_link_purchased_item', 'order_item_id', 'sales_flat_order_item', 'item_id'),
+ $installer->getFkName('downloadable_link_purchased_item', 'order_item_id', 'sales_order_item', 'item_id'),
'order_item_id',
- $installer->getTable('sales_flat_order_item'),
+ $installer->getTable('sales_order_item'),
'item_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php
index e1683939f907d..c76dedfa247ec 100644
--- a/app/code/Magento/Eav/Model/Config.php
+++ b/app/code/Magento/Eav/Model/Config.php
@@ -27,16 +27,20 @@
class Config
{
+ /**#@+
+ * EAV cache ids
+ */
const ENTITIES_CACHE_ID = 'EAV_ENTITY_TYPES';
-
const ATTRIBUTES_CACHE_ID = 'EAV_ENTITY_ATTRIBUTES';
+ const ATTRIBUTES_CODES_CACHE_ID = 'EAV_ENTITY_ATTRIBUTES_CODES';
+ /**#@-*/
/**
* Entity types data
*
* @var array
*/
- protected $_entityData;
+ protected $_entityTypeData;
/**
* Attributes data
@@ -45,26 +49,12 @@ class Config
*/
protected $_attributeData;
- /**
- * Information about preloaded attributes
- *
- * @var array
- */
- protected $_preloadedAttributes = array();
-
- /**
- * Information about entity types with initialized attributes
- *
- * @var array
- */
- protected $_initializedAttributes = array();
-
/**
* Attribute codes cache array
*
* @var array
*/
- protected $_attributeCodes = array();
+ protected $_attributeCodes;
/**
* Initialized objects
@@ -106,11 +96,19 @@ class Config
*/
protected $_cache;
+ /** @var \Magento\Framework\App\Cache\StateInterface */
+ protected $_cacheState;
+
/**
* @var \Magento\Eav\Model\Entity\TypeFactory
*/
protected $_entityTypeFactory;
+ /**
+ * @var \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory
+ */
+ protected $entityTypeCollectionFactory;
+
/**
* @var \Magento\Framework\Validator\UniversalFactory
*/
@@ -118,18 +116,21 @@ class Config
/**
* @param \Magento\Framework\App\CacheInterface $cache
- * @param Entity\TypeFactory $entityTypeFactory
+ * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory
+ * @param \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory $entityTypeCollectionFactory
* @param \Magento\Framework\App\Cache\StateInterface $cacheState
* @param \Magento\Framework\Validator\UniversalFactory $universalFactory
*/
public function __construct(
\Magento\Framework\App\CacheInterface $cache,
\Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory,
+ \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory $entityTypeCollectionFactory,
\Magento\Framework\App\Cache\StateInterface $cacheState,
\Magento\Framework\Validator\UniversalFactory $universalFactory
) {
$this->_cache = $cache;
$this->_entityTypeFactory = $entityTypeFactory;
+ $this->entityTypeCollectionFactory = $entityTypeCollectionFactory;
$this->_cacheState = $cacheState;
$this->_universalFactory = $universalFactory;
}
@@ -141,13 +142,17 @@ public function __construct(
*/
public function clear()
{
- $this->_entityData = null;
+ $this->_entityTypeData = null;
$this->_attributeData = null;
$this->_objects = null;
$this->_references = null;
- $this->_preloadedAttributes = array();
- $this->_initializedAttributes = array();
- $this->_attributeCodes = array();
+ $this->_attributeCodes = null;
+ $this->_cache->clean(
+ [
+ \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+ \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+ ]
+ );
return $this;
}
@@ -271,17 +276,14 @@ protected function _isCacheEnabled()
*/
protected function _initEntityTypes()
{
- if (is_array($this->_entityData)) {
+ if (is_array($this->_entityTypeData)) {
return $this;
}
\Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
- /**
- * try load information about entity types from cache
- */
if ($this->_isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) {
- $this->_entityData = unserialize($cache);
- foreach ($this->_entityData as $typeCode => $data) {
+ $this->_entityTypeData = unserialize($cache);
+ foreach ($this->_entityTypeData as $typeCode => $data) {
$typeId = $data['entity_type_id'];
$this->_addEntityTypeReference($typeId, $typeCode);
}
@@ -289,12 +291,7 @@ protected function _initEntityTypes()
return $this;
}
- $entityTypesData = $this->_entityTypeFactory->create()->getCollection()->getData();
- $types = array();
-
- /**
- * prepare entity type data
- */
+ $entityTypesData = $this->entityTypeCollectionFactory->create()->getData();
foreach ($entityTypesData as $typeData) {
if (!isset($typeData['attribute_model'])) {
$typeData['attribute_model'] = 'Magento\Eav\Model\Entity\Attribute';
@@ -304,14 +301,12 @@ protected function _initEntityTypes()
$typeId = $typeData['entity_type_id'];
$this->_addEntityTypeReference($typeId, $typeCode);
- $types[$typeCode] = $typeData;
+ $this->_entityTypeData[$typeCode] = $typeData;
}
- $this->_entityData = $types;
-
if ($this->_isCacheEnabled()) {
$this->_cache->save(
- serialize($this->_entityData),
+ serialize($this->_entityTypeData),
self::ENTITIES_CACHE_ID,
array(
\Magento\Eav\Model\Cache\Type::CACHE_TAG,
@@ -335,6 +330,7 @@ public function getEntityType($code)
if ($code instanceof Type) {
return $code;
}
+ $this->_initEntityTypes();
\Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
if (is_numeric($code)) {
@@ -351,20 +347,11 @@ public function getEntityType($code)
return $entityType;
}
-
- $entityType = $this->_entityTypeFactory->create();
- if (isset($this->_entityData[$code])) {
- $entityType->setData($this->_entityData[$code]);
- } else {
- if (is_numeric($code)) {
- $entityType->load($code);
- } else {
- $entityType->loadByCode($code);
- }
-
- if (!$entityType->getId()) {
- throw new \Magento\Framework\Model\Exception(__('Invalid entity_type specified: %1', $code));
- }
+ $entityType = $this->_entityTypeFactory->create(
+ ['data' => isset($this->_entityTypeData[$code]) ? $this->_entityTypeData[$code] : []]
+ );
+ if (!$entityType->getId()) {
+ throw new \Magento\Framework\Model\Exception(__('Invalid entity_type specified: %1', $code));
}
$this->_addEntityTypeReference($entityType->getId(), $entityType->getEntityTypeCode());
$this->_save($entityType, $entityKey);
@@ -384,25 +371,46 @@ protected function _initAttributes($entityType)
$entityType = $this->getEntityType($entityType);
$entityTypeCode = $entityType->getEntityTypeCode();
- if (isset($this->_initializedAttributes[$entityTypeCode])) {
+ if (isset($this->_attributeData[$entityTypeCode])) {
return $this;
}
+ $cacheKey = self::ATTRIBUTES_CACHE_ID . $entityTypeCode;
+ if ($this->_isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) {
+ $attributes = unserialize($attributes);
+ if ($attributes) {
+ foreach ($attributes as $attribute) {
+ $this->_createAttribute($entityType, $attribute);
+ $this->_attributeData[$entityTypeCode][$attribute['attribute_code']] = $attribute;
+ }
+ return $this;
+ }
+ }
+
\Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
- $attributesInfo = $this->_universalFactory->create(
+ $attributes = $this->_universalFactory->create(
$entityType->getEntityAttributeCollection()
)->setEntityTypeFilter(
$entityType
)->getData();
- $codes = array();
- foreach ($attributesInfo as $attribute) {
+ foreach ($attributes as $attribute) {
+ if (empty($attribute['attribute_model'])) {
+ $attribute['attribute_model'] = $entityType->getAttributeModel();
+ }
$this->_createAttribute($entityType, $attribute);
- $codes[] = $attribute['attribute_code'];
+ $this->_attributeData[$entityTypeCode][$attribute['attribute_code']] = $attribute;
+ }
+ if ($this->_isCacheEnabled()) {
+ $this->_cache->save(
+ serialize($this->_attributeData[$entityTypeCode]),
+ $cacheKey,
+ array(
+ \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+ \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+ )
+ );
}
-
- $entityType->setAttributeCodes($codes);
- $this->_initializedAttributes[$entityTypeCode] = true;
\Magento\Framework\Profiler::stop('EAV: ' . __METHOD__);
return $this;
@@ -414,21 +422,16 @@ protected function _initAttributes($entityType)
* @param mixed $entityType
* @param mixed $code
* @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute|false
+ * @throws \Magento\Framework\Model\Exception
*/
public function getAttribute($entityType, $code)
{
if ($code instanceof \Magento\Eav\Model\Entity\Attribute\AttributeInterface) {
return $code;
}
-
- \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
+ $this->_initAttributes($entityType);
$entityTypeCode = $this->getEntityType($entityType)->getEntityTypeCode();
- $entityType = $this->getEntityType($entityType);
-
- /**
- * Validate attribute code
- */
if (is_numeric($code)) {
$attributeCode = $this->_getAttributeReference($code, $entityTypeCode);
if ($attributeCode) {
@@ -437,39 +440,12 @@ public function getAttribute($entityType, $code)
}
$attributeKey = $this->_getAttributeKey($entityTypeCode, $code);
- /**
- * Try use loaded attribute
- */
$attribute = $this->_load($attributeKey);
- if ($attribute) {
- \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__);
- return $attribute;
- }
-
- if (isset($this->_attributeData[$entityTypeCode][$code])) {
- $data = $this->_attributeData[$entityTypeCode][$code];
- unset($this->_attributeData[$entityTypeCode][$code]);
- $attribute = $this->_universalFactory->create($data['attribute_model'], array('data' => $data));
- } else {
- if (is_numeric($code)) {
- $attribute = $this->_universalFactory->create($entityType->getAttributeModel())->load($code);
- if ($attribute->getEntityTypeId() != $entityType->getId()) {
- return false;
- }
- $attributeKey = $this->_getAttributeKey($entityTypeCode, $attribute->getAttributeCode());
- } else {
- $attribute = $this->_universalFactory->create(
- $entityType->getAttributeModel()
- )->loadByCode(
- $entityType,
- $code
- )->setAttributeCode(
- $code
- );
- }
- }
-
- if ($attribute) {
+ if (!$attribute) {
+ // TODO: refactor wrong method usage in: addAttributeToSelect, joinAttribute
+ $entityType = $this->getEntityType($entityType);
+ $attribute = $this->_universalFactory->create($entityType->getAttributeModel());
+ $attribute->setAttributeCode($code);
$entity = $entityType->getEntity();
if ($entity && in_array($attribute->getAttributeCode(), $entity->getDefaultAttributes())) {
$attribute->setBackendType(
@@ -478,12 +454,10 @@ public function getAttribute($entityType, $code)
1
);
}
- $attribute->setEntityType($entityType)->setEntityTypeId($entityType->getId());
- $this->_addAttributeReference($attribute->getId(), $attribute->getAttributeCode(), $entityTypeCode);
+ $this->_addAttributeReference($code, $code, $entityTypeCode);
$this->_save($attribute, $attributeKey);
}
\Magento\Framework\Profiler::stop('EAV: ' . __METHOD__);
-
return $attribute;
}
@@ -498,18 +472,21 @@ public function getEntityAttributeCodes($entityType, $object = null)
{
$entityType = $this->getEntityType($entityType);
$attributeSetId = 0;
- if ($object instanceof \Magento\Framework\Object && $object->getAttributeSetId()) {
- $attributeSetId = $object->getAttributeSetId();
- }
$storeId = 0;
- if ($object instanceof \Magento\Framework\Object && $object->getStoreId()) {
- $storeId = $object->getStoreId();
+ if ($object instanceof \Magento\Framework\Object) {
+ $attributeSetId = $object->getAttributeSetId() ?: $attributeSetId;
+ $storeId = $object->getStoreId() ?: $storeId;
}
- $cacheKey = sprintf('%d-%d', $entityType->getId(), $attributeSetId);
+ $cacheKey = self::ATTRIBUTES_CODES_CACHE_ID . $entityType->getId() . '-' . $storeId . '-' . $attributeSetId;
if (isset($this->_attributeCodes[$cacheKey])) {
return $this->_attributeCodes[$cacheKey];
}
+ if ($this->_isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) {
+ $this->_attributeCodes[$cacheKey] = unserialize($attributes);
+ return $this->_attributeCodes[$cacheKey];
+ }
+
if ($attributeSetId) {
$attributesInfo = $this->_universalFactory->create(
$entityType->getEntityAttributeCollection()
@@ -527,81 +504,22 @@ public function getEntityAttributeCodes($entityType, $object = null)
}
} else {
$this->_initAttributes($entityType);
- $attributes = $this->getEntityType($entityType)->getAttributeCodes();
+ $attributes = array_keys($this->_attributeData[$entityType->getEntityTypeCode()]);
}
$this->_attributeCodes[$cacheKey] = $attributes;
-
- return $attributes;
- }
-
- /**
- * Preload entity type attributes for performance optimization
- *
- * @param mixed $entityType
- * @param mixed $attributes
- * @return $this
- */
- public function preloadAttributes($entityType, $attributes)
- {
- if (is_string($attributes)) {
- $attributes = array($attributes);
- }
-
- $entityType = $this->getEntityType($entityType);
- $entityTypeCode = $entityType->getEntityTypeCode();
-
- if (!isset($this->_preloadedAttributes[$entityTypeCode])) {
- $this->_preloadedAttributes[$entityTypeCode] = $attributes;
- } else {
- $attributes = array_diff($attributes, $this->_preloadedAttributes[$entityTypeCode]);
- $this->_preloadedAttributes[$entityTypeCode] = array_merge(
- $this->_preloadedAttributes[$entityTypeCode],
- $attributes
+ if ($this->_isCacheEnabled()) {
+ $this->_cache->save(
+ serialize($attributes),
+ $cacheKey,
+ array(
+ \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+ \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+ )
);
}
- if (empty($attributes)) {
- return $this;
- }
- \Magento\Framework\Profiler::start(
- 'EAV: ' . __METHOD__ . ':' . $entityTypeCode,
- array('group' => 'EAV', 'method' => __METHOD__, 'entity_type_code' => $entityTypeCode)
- );
-
- $attributesInfo = $this->_universalFactory->create(
- $entityType->getEntityAttributeCollection()
- )->setEntityTypeFilter(
- $entityType
- )->setCodeFilter(
- $attributes
- )->getData();
-
- if (!$attributesInfo) {
- \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__ . ':' . $entityTypeCode);
- return $this;
- }
-
- $attributesData = $codes = array();
-
- foreach ($attributesInfo as $attribute) {
- if (empty($attribute['attribute_model'])) {
- $attribute['attribute_model'] = $entityType->getAttributeModel();
- }
-
- $attributeCode = $attribute['attribute_code'];
- $attributeId = $attribute['attribute_id'];
-
- $this->_addAttributeReference($attributeId, $attributeCode, $entityTypeCode);
- $attributesData[$attributeCode] = $attribute;
- $codes[] = $attributeCode;
- }
-
- $this->_attributeData[$entityTypeCode] = $attributesData;
-
- \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__ . ':' . $entityTypeCode);
-
- return $this;
+ return $attributes;
}
/**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
index 373add3c0468b..2da0776686e80 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
@@ -70,19 +70,6 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba
*/
protected $_defaultValue = null;
- /**
- * @var \Magento\Framework\Logger
- */
- protected $_logger;
-
- /**
- * @param \Magento\Framework\Logger $logger
- */
- public function __construct(\Magento\Framework\Logger $logger)
- {
- $this->_logger = $logger;
- }
-
/**
* Set attribute instance
*
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
index bf9115d096a29..39d8abdca16bf 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
@@ -33,13 +33,11 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke
protected $_localeDate;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
+ public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
{
$this->_localeDate = $localeDate;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php
index a51cf76e66b09..e3438a8889737 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php
@@ -31,13 +31,11 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
protected $_storeManager;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Framework\StoreManagerInterface $storeManager
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\StoreManagerInterface $storeManager)
+ public function __construct(\Magento\Framework\StoreManagerInterface $storeManager)
{
$this->_storeManager = $storeManager;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php
index 310350b2f8859..dc2af1bd3144b 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php
@@ -34,13 +34,11 @@ class Created extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken
protected $dateTime;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Framework\Stdlib\DateTime $dateTime
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\DateTime $dateTime)
+ public function __construct(\Magento\Framework\Stdlib\DateTime $dateTime)
{
$this->dateTime = $dateTime;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php
index 78c10c7d76c96..28227e75c346f 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php
@@ -34,13 +34,11 @@ class Updated extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken
protected $dateTime;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Framework\Stdlib\DateTime $dateTime
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\DateTime $dateTime)
+ public function __construct(\Magento\Framework\Stdlib\DateTime $dateTime)
{
$this->dateTime = $dateTime;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Eav/Model/Entity/Type.php b/app/code/Magento/Eav/Model/Entity/Type.php
index cd9038f4bd4ef..9218849a1343a 100644
--- a/app/code/Magento/Eav/Model/Entity/Type.php
+++ b/app/code/Magento/Eav/Model/Entity/Type.php
@@ -357,16 +357,6 @@ public function getEntityTypeCode()
return isset($this->_data['entity_type_code']) ? $this->_data['entity_type_code'] : null;
}
- /**
- * Retrieve attribute codes
- *
- * @return array|null
- */
- public function getAttributeCodes()
- {
- return isset($this->_data['attribute_codes']) ? $this->_data['attribute_codes'] : null;
- }
-
/**
* Get attribute model code for entity type
*
diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php
index e7d4999e43587..d31dc02270d1f 100644
--- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php
+++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php
@@ -92,28 +92,6 @@ protected function _initUniqueFields()
return $this;
}
- /**
- * Load all entity type attributes
- *
- * @param int $entityTypeId
- * @return $this
- */
- protected function _loadTypeAttributes($entityTypeId)
- {
- if (!isset(self::$_entityAttributes[$entityTypeId])) {
- $adapter = $this->_getReadAdapter();
- $bind = array(':entity_type_id' => $entityTypeId);
- $select = $adapter->select()->from($this->getMainTable())->where('entity_type_id = :entity_type_id');
-
- $data = $adapter->fetchAll($select, $bind);
- foreach ($data as $row) {
- self::$_entityAttributes[$entityTypeId][$row['attribute_code']] = $row;
- }
- }
-
- return $this;
- }
-
/**
* Load attribute data by attribute code
*
diff --git a/app/code/Magento/Eav/Plugin/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Plugin/Model/Resource/Entity/Attribute.php
new file mode 100644
index 0000000000000..e78c44e67287b
--- /dev/null
+++ b/app/code/Magento/Eav/Plugin/Model/Resource/Entity/Attribute.php
@@ -0,0 +1,80 @@
+cache = $cache;
+ $this->isCacheEnabled = $cacheState->isEnabled(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER);
+ }
+
+ /**
+ * @param \Magento\Eav\Model\Resource\Entity\Attribute $subject
+ * @param callable $proceed
+ * @param int $attributeId
+ * @return array
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function aroundGetStoreLabelsByAttributeId(
+ \Magento\Eav\Model\Resource\Entity\Attribute $subject,
+ \Closure $proceed,
+ $attributeId
+ ) {
+ $cacheId = self::STORE_LABEL_ATTRIBUTE . $attributeId;
+ if ($this->isCacheEnabled && ($storeLabels = $this->cache->load($cacheId))) {
+ return unserialize($storeLabels);
+ }
+ $storeLabels = $proceed($attributeId);
+ if ($this->isCacheEnabled) {
+ $this->cache->save(
+ serialize($storeLabels),
+ $cacheId,
+ [
+ \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+ \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+ ]
+ );
+ }
+ return $storeLabels;
+ }
+}
diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json
index 6c6d37ad2dc53..8d888f993fbf5 100644
--- a/app/code/Magento/Eav/composer.json
+++ b/app/code/Magento/Eav/composer.json
@@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml
index 6fb75afb1a980..e62f7dd9b125f 100644
--- a/app/code/Magento/Eav/etc/di.xml
+++ b/app/code/Magento/Eav/etc/di.xml
@@ -49,4 +49,7 @@
+
+
+
diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json
index da9af92b589bb..bce2ccbaab764 100644
--- a/app/code/Magento/Email/composer.json
+++ b/app/code/Magento/Email/composer.json
@@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json
index 7564c40fe8489..897ffa1f176a0 100644
--- a/app/code/Magento/Fedex/composer.json
+++ b/app/code/Magento/Fedex/composer.json
@@ -3,19 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.0.php b/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.0.php
rename to app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Fedex/etc/module.xml b/app/code/Magento/Fedex/etc/module.xml
index 8f13222ae32a6..2768394fd1000 100644
--- a/app/code/Magento/Fedex/etc/module.xml
+++ b/app/code/Magento/Fedex/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json
index 9c69e019f8e2b..ce43c28f5cce3 100644
--- a/app/code/Magento/GiftMessage/composer.json
+++ b/app/code/Magento/GiftMessage/composer.json
@@ -3,20 +3,20 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-multishipping": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-multishipping": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json
index 113d5f4ce548b..4d26c26e60fb9 100644
--- a/app/code/Magento/GoogleAdwords/composer.json
+++ b/app/code/Magento/GoogleAdwords/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json
index 508dbb98670ff..8618b895fcabe 100644
--- a/app/code/Magento/GoogleAnalytics/composer.json
+++ b/app/code/Magento/GoogleAnalytics/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json
index 3ec25dde8dfef..6ac73e2238795 100644
--- a/app/code/Magento/GoogleOptimizer/composer.json
+++ b/app/code/Magento/GoogleOptimizer/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-google-analytics": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-google-analytics": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json
index e79b3cb149f23..8bdd03fa89963 100644
--- a/app/code/Magento/GoogleShopping/composer.json
+++ b/app/code/Magento/GoogleShopping/composer.json
@@ -3,19 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json
index 525bf0c37c33a..29a32c8532142 100644
--- a/app/code/Magento/GroupedImportExport/composer.json
+++ b/app/code/Magento/GroupedImportExport/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-import-export": "0.1.0-alpha103",
- "magento/module-catalog-import-export": "0.1.0-alpha103",
- "magento/module-grouped-product": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-import-export": "0.1.0-alpha104",
+ "magento/module-catalog-import-export": "0.1.0-alpha104",
+ "magento/module-grouped-product": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json
index a371019206b63..a4ea85a32ee81 100644
--- a/app/code/Magento/GroupedProduct/composer.json
+++ b/app/code/Magento/GroupedProduct/composer.json
@@ -3,21 +3,21 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-msrp": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-msrp": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php
index ade0deb917439..cace1e17b34ff 100644
--- a/app/code/Magento/ImportExport/Model/Import.php
+++ b/app/code/Magento/ImportExport/Model/Import.php
@@ -114,9 +114,9 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
protected $_uploaderFactory;
/**
- * @var \Magento\Indexer\Model\IndexerFactory
+ * @var \Magento\Indexer\Model\IndexerRegistry
*/
- protected $indexerFactory;
+ protected $indexerRegistry;
/**
* @var \Magento\ImportExport\Model\Source\Import\Behavior\Factory
@@ -134,14 +134,14 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
* @param \Magento\Framework\Logger\AdapterFactory $adapterFactory
* @param \Magento\ImportExport\Helper\Data $importExportData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig
- * @param \Magento\ImportExport\Model\Import\ConfigInterface $importConfig
- * @param \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory
- * @param \Magento\ImportExport\Model\Resource\Import\Data $importData
- * @param \Magento\ImportExport\Model\Export\Adapter\CsvFactory $csvFactory
- * @param \Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory
+ * @param Import\ConfigInterface $importConfig
+ * @param Import\Entity\Factory $entityFactory
+ * @param Resource\Import\Data $importData
+ * @param Export\Adapter\CsvFactory $csvFactory
+ * @param FileTransferFactory $httpFactory
* @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory
- * @param \Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory
- * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory
+ * @param Source\Import\Behavior\Factory $behaviorFactory
+ * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
* @param array $data
*/
public function __construct(
@@ -157,7 +157,7 @@ public function __construct(
\Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory,
\Magento\Core\Model\File\UploaderFactory $uploaderFactory,
\Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory,
- \Magento\Indexer\Model\IndexerFactory $indexerFactory,
+ \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
array $data = array()
) {
$this->_importExportData = $importExportData;
@@ -168,7 +168,7 @@ public function __construct(
$this->_csvFactory = $csvFactory;
$this->_httpFactory = $httpFactory;
$this->_uploaderFactory = $uploaderFactory;
- $this->indexerFactory = $indexerFactory;
+ $this->indexerRegistry = $indexerRegistry;
$this->_behaviorFactory = $behaviorFactory;
$this->_filesystem = $filesystem;
parent::__construct($logger, $filesystem, $adapterFactory, $data);
@@ -573,9 +573,8 @@ public function invalidateIndex()
}
foreach (array_keys($relatedIndexers) as $indexerId) {
- $indexer = $this->indexerFactory->create();
try {
- $indexer->load($indexerId);
+ $indexer = $this->indexerRegistry->get($indexerId);
$indexer->invalidate();
} catch (\InvalidArgumentException $e) {
}
diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json
index 74afea4be232a..f4c145eb45ba7 100644
--- a/app/code/Magento/ImportExport/composer.json
+++ b/app/code/Magento/ImportExport/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-indexer": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-indexer": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"ext-ctype": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php
index 979f028918f9c..f4c53bd93ece1 100644
--- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php
+++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php
@@ -38,13 +38,9 @@ public function execute()
$this->messageManager->addError(__('Please select indexers.'));
} else {
try {
- foreach ($indexerIds as $indexer_id) {
+ foreach ($indexerIds as $indexerId) {
/** @var \Magento\Indexer\Model\IndexerInterface $model */
- $model = $this->_objectManager->create(
- 'Magento\Indexer\Model\IndexerInterface'
- )->load(
- $indexer_id
- );
+ $model = $this->_objectManager->get('Magento\Indexer\Model\IndexerRegistry')->get($indexerId);
$model->setScheduled(true);
}
$this->messageManager->addSuccess(
diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php
index f2d6ffd32c0a7..48fb3319dba5d 100644
--- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php
+++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php
@@ -38,13 +38,9 @@ public function execute()
$this->messageManager->addError(__('Please select indexers.'));
} else {
try {
- foreach ($indexerIds as $indexer_id) {
+ foreach ($indexerIds as $indexerId) {
/** @var \Magento\Indexer\Model\IndexerInterface $model */
- $model = $this->_objectManager->create(
- 'Magento\Indexer\Model\IndexerInterface'
- )->load(
- $indexer_id
- );
+ $model = $this->_objectManager->get('Magento\Indexer\Model\IndexerRegistry')->get($indexerId);
$model->setScheduled(false);
}
$this->messageManager->addSuccess(
diff --git a/app/code/Magento/Indexer/Model/ActionInterface.php b/app/code/Magento/Indexer/Model/ActionInterface.php
index 5db6a971fc15d..20d68865b9c6e 100644
--- a/app/code/Magento/Indexer/Model/ActionInterface.php
+++ b/app/code/Magento/Indexer/Model/ActionInterface.php
@@ -38,7 +38,7 @@ public function executeFull();
* @param int[] $ids
* @return void
*/
- public function executeList($ids);
+ public function executeList(array $ids);
/**
* Execute partial indexation by ID
diff --git a/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php b/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php
index b5cccf62e6878..3c97ac2ba10bb 100644
--- a/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php
+++ b/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php
@@ -33,18 +33,16 @@ abstract class AbstractProcessor
*/
const INDEXER_ID = '';
- /**
- * @var \Magento\Indexer\Model\IndexerInterface
- */
- protected $_indexer;
+ /** @var \Magento\Indexer\Model\IndexerRegistry */
+ protected $indexerRegistry;
/**
- * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory
+ * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
*/
public function __construct(
- \Magento\Indexer\Model\IndexerFactory $indexerFactory
+ \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
) {
- $this->_indexer = $indexerFactory->create();
+ $this->indexerRegistry = $indexerRegistry;
}
/**
@@ -54,10 +52,7 @@ public function __construct(
*/
public function getIndexer()
{
- if (!$this->_indexer->getId()) {
- $this->_indexer->load(static::INDEXER_ID);
- }
- return $this->_indexer;
+ return $this->indexerRegistry->get(static::INDEXER_ID);
}
/**
diff --git a/app/code/Magento/Indexer/Model/IndexerRegistry.php b/app/code/Magento/Indexer/Model/IndexerRegistry.php
new file mode 100644
index 0000000000000..1088c3e9c91e1
--- /dev/null
+++ b/app/code/Magento/Indexer/Model/IndexerRegistry.php
@@ -0,0 +1,60 @@
+objectManager = $objectManager;
+ }
+
+ /**
+ * Retrieve indexer instance by id
+ *
+ * @param string $indexerId
+ * @return IndexerInterface
+ */
+ public function get($indexerId)
+ {
+ if (!isset($this->indexers[$indexerId])) {
+ $this->indexers[$indexerId] = $this->objectManager->create('Magento\Indexer\Model\IndexerInterface')
+ ->load($indexerId);
+ }
+ return $this->indexers[$indexerId];
+ }
+}
diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json
index 4d5f4a80fd5b9..02434dabfb0aa 100644
--- a/app/code/Magento/Indexer/composer.json
+++ b/app/code/Magento/Indexer/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-page-cache": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-page-cache": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json
index 8abd0ede0e490..6d086ae2da008 100644
--- a/app/code/Magento/Integration/composer.json
+++ b/app/code/Magento/Integration/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-user": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
- "magento/module-authorization": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-user": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
+ "magento/module-authorization": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json
index 194a561b6702d..b019476a30bcb 100644
--- a/app/code/Magento/LayeredNavigation/composer.json
+++ b/app/code/Magento/LayeredNavigation/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json
index e6decb233a938..63212cbe67965 100644
--- a/app/code/Magento/Log/composer.json
+++ b/app/code/Magento/Log/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json
index 2fb27823c7b17..dc8eaec8526f7 100644
--- a/app/code/Magento/Msrp/composer.json
+++ b/app/code/Magento/Msrp/composer.json
@@ -3,21 +3,21 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-bundle": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-configurable-product": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-downloadable": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-grouped-product": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-bundle": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-configurable-product": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-downloadable": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-grouped-product": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json
index e4df9fe320eb0..0776bfff1a27c 100644
--- a/app/code/Magento/Multishipping/composer.json
+++ b/app/code/Magento/Multishipping/composer.json
@@ -3,19 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json
index 2095dfd29d149..45695e6b333d0 100644
--- a/app/code/Magento/Newsletter/composer.json
+++ b/app/code/Magento/Newsletter/composer.json
@@ -3,20 +3,20 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-widget": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-email": "0.1.0-alpha103",
- "magento/module-cron": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-widget": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-email": "0.1.0-alpha104",
+ "magento/module-cron": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json
index 2b06806aa0957..6a2a6b3a91ccf 100644
--- a/app/code/Magento/OfflinePayments/composer.json
+++ b/app/code/Magento/OfflinePayments/composer.json
@@ -3,12 +3,12 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/OfflinePayments/etc/module.xml b/app/code/Magento/OfflinePayments/etc/module.xml
index 24f917885dbea..7f24be74c198b 100644
--- a/app/code/Magento/OfflinePayments/etc/module.xml
+++ b/app/code/Magento/OfflinePayments/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json
index 3a7d0d251f57f..5d34d020ddec6 100644
--- a/app/code/Magento/OfflineShipping/composer.json
+++ b/app/code/Magento/OfflineShipping/composer.json
@@ -3,19 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-sales-rule": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-sales-rule": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/OfflineShipping/etc/module.xml b/app/code/Magento/OfflineShipping/etc/module.xml
index bd98e5a2db568..40fa442036c4d 100644
--- a/app/code/Magento/OfflineShipping/etc/module.xml
+++ b/app/code/Magento/OfflineShipping/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php
similarity index 95%
rename from app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php
rename to app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php
index 2432d3e699615..cf30803cb2363 100644
--- a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php
+++ b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php
@@ -108,7 +108,7 @@
'Simple Free Shipping'
);
$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_order_item'),
+ $installer->getTable('sales_order_item'),
'free_shipping',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
@@ -116,7 +116,7 @@
'Free Shipping'
);
$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_quote_address'),
+ $installer->getTable('sales_quote_address'),
'free_shipping',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
@@ -124,7 +124,7 @@
'Free Shipping'
);
$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_quote_item'),
+ $installer->getTable('sales_quote_item'),
'free_shipping',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
@@ -132,7 +132,7 @@
'Free Shipping'
);
$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_quote_address_item'),
+ $installer->getTable('sales_quote_address_item'),
'free_shipping',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
diff --git a/app/code/Magento/Ogone/composer.json b/app/code/Magento/Ogone/composer.json
index dc6ff442783ad..300d6a60503cc 100644
--- a/app/code/Magento/Ogone/composer.json
+++ b/app/code/Magento/Ogone/composer.json
@@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Ogone/data/ogone_setup/data-install-1.6.0.0.php b/app/code/Magento/Ogone/data/ogone_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Ogone/data/ogone_setup/data-install-1.6.0.0.php
rename to app/code/Magento/Ogone/data/ogone_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Ogone/etc/module.xml b/app/code/Magento/Ogone/etc/module.xml
index d5a600a2aa7da..875cd11e011e7 100644
--- a/app/code/Magento/Ogone/etc/module.xml
+++ b/app/code/Magento/Ogone/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json
index b80a9f8d3a52f..bc79d590b4e23 100644
--- a/app/code/Magento/PageCache/composer.json
+++ b/app/code/Magento/PageCache/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/PayPalRecurringPayment/composer.json b/app/code/Magento/PayPalRecurringPayment/composer.json
index c7e5ca5291b3f..f3695b3101716 100644
--- a/app/code/Magento/PayPalRecurringPayment/composer.json
+++ b/app/code/Magento/PayPalRecurringPayment/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-paypal": "0.1.0-alpha103",
- "magento/module-recurring-payment": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-paypal": "0.1.0-alpha104",
+ "magento/module-recurring-payment": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/PayPalRecurringPayment/etc/module.xml b/app/code/Magento/PayPalRecurringPayment/etc/module.xml
index c0f24a5bf8276..42e091d878ef5 100644
--- a/app/code/Magento/PayPalRecurringPayment/etc/module.xml
+++ b/app/code/Magento/PayPalRecurringPayment/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php
index b2989c643e473..01706937d0730 100644
--- a/app/code/Magento/Payment/Model/Info.php
+++ b/app/code/Magento/Payment/Model/Info.php
@@ -217,8 +217,12 @@ public function hasAdditionalInformation($key = null)
*/
protected function _initAdditionalInformation()
{
- if (empty($this->_additionalInformation) && $this->_getData('additional_information')) {
- $this->_additionalInformation = $this->_getData('additional_information');
+ $additionalInfo = $this->_getData('additional_information');
+ if (empty($this->_additionalInformation) && $additionalInfo) {
+ if (!is_array($additionalInfo)) {
+ $additionalInfo = unserialize($additionalInfo);
+ }
+ $this->_additionalInformation = $additionalInfo;
}
}
}
diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json
index a10ad27cc9ce5..8b7ad14ae6550 100644
--- a/app/code/Magento/Payment/composer.json
+++ b/app/code/Magento/Payment/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-centinel": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-centinel": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Payment/etc/module.xml b/app/code/Magento/Payment/etc/module.xml
index 08103caabeffe..0c2de188ef556 100644
--- a/app/code/Magento/Payment/etc/module.xml
+++ b/app/code/Magento/Payment/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Paypal/Model/Api/AbstractApi.php b/app/code/Magento/Paypal/Model/Api/AbstractApi.php
index 5f7c6e3f77742..15efd4db6adb1 100644
--- a/app/code/Magento/Paypal/Model/Api/AbstractApi.php
+++ b/app/code/Magento/Paypal/Model/Api/AbstractApi.php
@@ -306,7 +306,7 @@ public function getBusinessAccount()
* @param array $publicMap
* @return array|\Magento\Framework\Object
*/
- public function &import($to, array $publicMap = array())
+ public function import($to, array $publicMap = array())
{
return \Magento\Framework\Object\Mapper::accumulateByMap(array($this, 'getDataUsingMethod'), $to, $publicMap);
}
diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json
index 7cca4e588801d..4302f9947945f 100644
--- a/app/code/Magento/Paypal/composer.json
+++ b/app/code/Magento/Paypal/composer.json
@@ -3,25 +3,25 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-centinel": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-centinel": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php b/app/code/Magento/Paypal/data/paypal_setup/data-install-2.0.0.php
similarity index 91%
rename from app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php
rename to app/code/Magento/Paypal/data/paypal_setup/data-install-2.0.0.php
index c1a85daa4350d..779aa18f971b5 100644
--- a/app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Paypal/data/paypal_setup/data-install-2.0.0.php
@@ -44,7 +44,11 @@
);
$data = array();
-$statuses = array('pending_paypal' => __('Pending PayPal'));
+$statuses = array(
+ 'pending_paypal' => __('Pending PayPal'),
+ 'paypal_reversed' => __('PayPal Reversed'),
+ 'paypal_canceled_reversal' => __('PayPal Canceled Reversal')
+);
foreach ($statuses as $code => $info) {
$data[] = array('status' => $code, 'label' => $info);
}
diff --git a/app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php
deleted file mode 100644
index b34584387c7a0..0000000000000
--- a/app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php
+++ /dev/null
@@ -1,38 +0,0 @@
-getConnection();
-$installer->startSetup();
-$data = array(
- array('paypal_reversed', 'PayPal Reversed'),
- array('paypal_canceled_reversal', 'PayPal Canceled Reversal')
-);
-$connection = $installer->getConnection()->insertArray(
- $installer->getTable('sales_order_status'),
- array('status', 'label'),
- $data
-);
-$installer->endSetup();
diff --git a/app/code/Magento/Paypal/etc/module.xml b/app/code/Magento/Paypal/etc/module.xml
index 228996c72b5e4..ba80a69b3c175 100644
--- a/app/code/Magento/Paypal/etc/module.xml
+++ b/app/code/Magento/Paypal/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php b/app/code/Magento/Paypal/sql/paypal_setup/install-2.0.0.php
similarity index 88%
rename from app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php
rename to app/code/Magento/Paypal/sql/paypal_setup/install-2.0.0.php
index b1809bf6af863..8107bd4b7c75b 100644
--- a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Paypal/sql/paypal_setup/install-2.0.0.php
@@ -147,9 +147,9 @@
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('paypal_billing_agreement_order', 'order_id', 'sales_flat_order', 'entity_id'),
+ $installer->getFkName('paypal_billing_agreement_order', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $installer->getTable('sales_flat_order'),
+ $installer->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
@@ -313,6 +313,18 @@
127,
array(),
'Consumer Id'
+)->addColumn(
+ 'payment_tracking_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 255,
+ array(),
+ 'Payment Tracking ID'
+)->addColumn(
+ 'store_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 50,
+ array(),
+ 'Store ID'
)->addIndex(
$installer->getIdxName('paypal_settlement_report_row', array('report_id')),
array('report_id')
@@ -370,6 +382,47 @@
)->setComment(
'Paypal Certificate Table'
);
+
+/**
+ * Create table 'paypal_payment_transaction'
+ */
+$table = $installer->getConnection()->newTable(
+ $installer->getTable('paypal_payment_transaction')
+)->addColumn(
+ 'transaction_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+ null,
+ array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
+ 'Entity Id'
+)->addColumn(
+ 'txn_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 100,
+ array(),
+ 'Txn Id'
+)->addColumn(
+ 'additional_information',
+ \Magento\Framework\DB\Ddl\Table::TYPE_BLOB,
+ '64K',
+ array(),
+ 'Additional Information'
+)->addColumn(
+ 'created_at',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
+ null,
+ array(),
+ 'Created At'
+)->addIndex(
+ $installer->getIdxName(
+ 'paypal_payment_transaction',
+ array('txn_id'),
+ \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+ ),
+ array('txn_id'),
+ array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
+)->setComment(
+ 'PayPal Payflow Link Payment Transaction'
+);
$installer->getConnection()->createTable($table);
/**
* Prepare database after install
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php
deleted file mode 100644
index 7355597d8f518..0000000000000
--- a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php
+++ /dev/null
@@ -1,68 +0,0 @@
-getConnection()->newTable(
- $installer->getTable('paypal_payment_transaction')
-)->addColumn(
- 'transaction_id',
- \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
- null,
- array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
- 'Entity Id'
-)->addColumn(
- 'txn_id',
- \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
- 100,
- array(),
- 'Txn Id'
-)->addColumn(
- 'additional_information',
- \Magento\Framework\DB\Ddl\Table::TYPE_BLOB,
- '64K',
- array(),
- 'Additional Information'
-)->addColumn(
- 'created_at',
- \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
- null,
- array(),
- 'Created At'
-)->addIndex(
- $installer->getIdxName(
- 'paypal_payment_transaction',
- array('txn_id'),
- \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
- ),
- array('txn_id'),
- array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
-)->setComment(
- 'PayPal Payflow Link Payment Transaction'
-);
-$installer->getConnection()->createTable($table);
diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json
index 5c946c684d0a6..ea9bb11020a84 100644
--- a/app/code/Magento/Persistent/composer.json
+++ b/app/code/Magento/Persistent/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-cron": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-cron": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Persistent/etc/frontend/di.xml b/app/code/Magento/Persistent/etc/frontend/di.xml
index db997b25019eb..4e381ebb770cc 100644
--- a/app/code/Magento/Persistent/etc/frontend/di.xml
+++ b/app/code/Magento/Persistent/etc/frontend/di.xml
@@ -31,4 +31,9 @@
+
+
+ Magento\Customer\Service\V1\CustomerAccountServiceInterface\Proxy
+
+
diff --git a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
index fb33978aa5d69..12d2aab293d1a 100644
--- a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
+++ b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
@@ -97,11 +97,11 @@
$installer->getConnection()->createTable($table);
/**
- * Alter sales_flat_quote table with is_persistent flag
+ * Alter sales_quote table with is_persistent flag
*
*/
$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_quote'),
+ $installer->getTable('sales_quote'),
'is_persistent',
array(
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json
index 838a97b3f9756..6a98e206a3b42 100644
--- a/app/code/Magento/ProductAlert/composer.json
+++ b/app/code/Magento/ProductAlert/composer.json
@@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/RecurringPayment/composer.json b/app/code/Magento/RecurringPayment/composer.json
index b4b05b2f40d1b..853e3e0541961 100644
--- a/app/code/Magento/RecurringPayment/composer.json
+++ b/app/code/Magento/RecurringPayment/composer.json
@@ -3,22 +3,22 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php b/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php
rename to app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/RecurringPayment/etc/frontend/di.xml b/app/code/Magento/RecurringPayment/etc/frontend/di.xml
new file mode 100644
index 0000000000000..886edd277de3f
--- /dev/null
+++ b/app/code/Magento/RecurringPayment/etc/frontend/di.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Magento\RecurringPayment\Block\Fields\Proxy
+
+
+
diff --git a/app/code/Magento/RecurringPayment/etc/module.xml b/app/code/Magento/RecurringPayment/etc/module.xml
index a2f6dbc541cb8..75e605cd693ec 100644
--- a/app/code/Magento/RecurringPayment/etc/module.xml
+++ b/app/code/Magento/RecurringPayment/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-2.0.0.php
similarity index 99%
rename from app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php
rename to app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-2.0.0.php
index 06f5e08660525..d7fae978e7615 100644
--- a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php
+++ b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-2.0.0.php
@@ -296,9 +296,9 @@
$this->getIdxName('recurring_payment_order', array('order_id')),
array('order_id')
)->addForeignKey(
- $this->getFkName('recurring_payment_order', 'order_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('recurring_payment_order', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $this->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
diff --git a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
index 2889c8e40a3a7..5c0955ec40425 100644
--- a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
@@ -187,7 +187,7 @@ public function joinOrders($fromDate = '', $toDate = '')
}
$this->getSelect()->joinLeft(
- array('orders' => $this->getTable('sales_flat_order')),
+ array('orders' => $this->getTable('sales_order')),
"orders.customer_id = e.entity_id" . $dateFilter,
array()
);
@@ -288,7 +288,7 @@ protected function _addOrdersStatistics()
$select = $this->getConnection()->select();
$select->from(
- array('orders' => $this->getTable('sales_flat_order')),
+ array('orders' => $this->getTable('sales_order')),
array(
'orders_avg_amount' => "AVG({$totalExpr})",
'orders_sum_amount' => "SUM({$totalExpr})",
diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php
index 23134cd656ed6..f9bc7d973b50e 100644
--- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php
@@ -212,7 +212,7 @@ protected function _getSalesAmountExpression()
*/
protected function _prepareSummaryLive($range, $customStart, $customEnd, $isFilter = 0)
{
- $this->setMainTable('sales_flat_order');
+ $this->setMainTable('sales_order');
$adapter = $this->getConnection();
/**
@@ -510,7 +510,7 @@ public function calculateTotals($isFilter = 0)
*/
protected function _calculateTotalsLive($isFilter = 0)
{
- $this->setMainTable('sales_flat_order');
+ $this->setMainTable('sales_order');
$this->removeAllFieldsFromSelect();
$adapter = $this->getConnection();
@@ -623,7 +623,7 @@ public function calculateSales($isFilter = 0)
}
$this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses);
} else {
- $this->setMainTable('sales_flat_order');
+ $this->setMainTable('sales_order');
$this->removeAllFieldsFromSelect();
$expr = $this->_getSalesAmountExpression();
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
index d255990093d12..ee49c760130ac 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
@@ -252,10 +252,10 @@ public function getSelectCountSql()
if ($this->_selectCountSqlType == self::SELECT_COUNT_SQL_TYPE_CART) {
$countSelect = clone $this->getSelect();
$countSelect->reset()->from(
- array('quote_item_table' => $this->getTable('sales_flat_quote_item')),
+ array('quote_item_table' => $this->getTable('sales_quote_item')),
array('COUNT(DISTINCT quote_item_table.product_id)')
)->join(
- array('quote_table' => $this->getTable('sales_flat_quote')),
+ array('quote_table' => $this->getTable('sales_quote')),
'quote_table.entity_id = quote_item_table.quote_id AND quote_table.is_active = 1',
array()
);
@@ -285,10 +285,10 @@ public function addCartsCount()
$countSelect->reset();
$countSelect->from(
- array('quote_items' => $this->getTable('sales_flat_quote_item')),
+ array('quote_items' => $this->getTable('sales_quote_item')),
'COUNT(*)'
)->join(
- array('quotes' => $this->getTable('sales_flat_quote')),
+ array('quotes' => $this->getTable('sales_quote')),
'quotes.entity_id = quote_items.quote_id AND quotes.is_active = 1',
array()
)->where(
@@ -316,7 +316,7 @@ public function addCartsCount()
*/
public function addOrdersCount($from = '', $to = '')
{
- $orderItemTableName = $this->getTable('sales_flat_order_item');
+ $orderItemTableName = $this->getTable('sales_order_item');
$productFieldName = sprintf('e.%s', $this->getProductEntityId());
$this->getSelect()->joinLeft(
@@ -373,10 +373,10 @@ public function addOrderedQty($from = '', $to = '')
}
$this->getSelect()->reset()->from(
- array('order_items' => $this->getTable('sales_flat_order_item')),
+ array('order_items' => $this->getTable('sales_order_item')),
array('ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name')
)->joinInner(
- array('order' => $this->getTable('sales_flat_order')),
+ array('order' => $this->getTable('sales_order')),
implode(' AND ', $orderJoinCondition),
array()
)->joinLeft(
diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
index 984b00dfa7751..4098da01538dc 100644
--- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
@@ -147,7 +147,7 @@ public function prepareForProductsInCarts()
$ordersSubSelect = clone $this->getSelect();
$ordersSubSelect->reset()->from(
- array('oi' => $this->getTable('sales_flat_order_item')),
+ array('oi' => $this->getTable('sales_order_item')),
array('orders' => new \Zend_Db_Expr('COUNT(1)'), 'product_id')
)->group(
'oi.product_id'
@@ -158,7 +158,7 @@ public function prepareForProductsInCarts()
)->reset(
\Zend_Db_Select::COLUMNS
)->joinInner(
- array('quote_items' => $this->getTable('sales_flat_quote_item')),
+ array('quote_items' => $this->getTable('sales_quote_item')),
'quote_items.quote_id = main_table.entity_id',
null
)->joinInner(
diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json
index 2742899c658f8..8b4926bd206d0 100644
--- a/app/code/Magento/Reports/composer.json
+++ b/app/code/Magento/Reports/composer.json
@@ -3,27 +3,27 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-widget": "0.1.0-alpha103",
- "magento/module-log": "0.1.0-alpha103",
- "magento/module-wishlist": "0.1.0-alpha103",
- "magento/module-review": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-downloadable": "0.1.0-alpha103",
- "magento/module-sales-rule": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-widget": "0.1.0-alpha104",
+ "magento/module-log": "0.1.0-alpha104",
+ "magento/module-wishlist": "0.1.0-alpha104",
+ "magento/module-review": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-downloadable": "0.1.0-alpha104",
+ "magento/module-sales-rule": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json
index d890eb8dd6427..8641f5e0b9cfa 100644
--- a/app/code/Magento/RequireJs/composer.json
+++ b/app/code/Magento/RequireJs/composer.json
@@ -3,11 +3,11 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Review/Block/Product/Review.php b/app/code/Magento/Review/Block/Product/Review.php
index ed15320b73b5f..73714ba9919da 100644
--- a/app/code/Magento/Review/Block/Product/Review.php
+++ b/app/code/Magento/Review/Block/Product/Review.php
@@ -47,13 +47,13 @@ class Review extends \Magento\Framework\View\Element\Template
protected $_reviewsColFactory;
/**
- * @param \Magento\Backend\Block\Template\Context $context
+ * @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory
* @param array $data
*/
public function __construct(
- \Magento\Backend\Block\Template\Context $context,
+ \Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory,
array $data = array()
diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json
index acf1ecf72c66d..47420672b6038 100644
--- a/app/code/Magento/Review/composer.json
+++ b/app/code/Magento/Review/composer.json
@@ -3,20 +3,20 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-newsletter": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-newsletter": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json
index 12d22eadd1ab3..beed028e0ea81 100644
--- a/app/code/Magento/Rss/composer.json
+++ b/app/code/Magento/Rss/composer.json
@@ -3,14 +3,14 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Rule/Model/Condition/Combine.php b/app/code/Magento/Rule/Model/Condition/Combine.php
index e079e2d2c69d4..87239a38323c6 100644
--- a/app/code/Magento/Rule/Model/Condition/Combine.php
+++ b/app/code/Magento/Rule/Model/Condition/Combine.php
@@ -25,13 +25,6 @@
class Combine extends AbstractCondition
{
- /**
- * Store all used condition models
- *
- * @var array
- */
- protected $_conditionModels = array();
-
/**
* @var \Magento\Rule\Model\ConditionFactory
*/
@@ -75,36 +68,6 @@ public function __construct(Context $context, array $data = array())
}
}
- /**
- * Retrieve new object for each requested model.
- * If model is requested first time, store it at static array.
- *
- * It's made by performance reasons to avoid initialization of same models each time when rules are being processed.
- *
- * @param string $modelClass
- * @return AbstractCondition|bool
- */
- protected function _getNewConditionModelInstance($modelClass)
- {
- if (empty($modelClass)) {
- return false;
- }
-
- if (!array_key_exists($modelClass, $this->_conditionModels)) {
- $model = $this->_conditionFactory->create($modelClass);
- $this->_conditionModels[$modelClass] = $model;
- } else {
- $model = $this->_conditionModels[$modelClass];
- }
-
- if (!$model) {
- return false;
- }
-
- $newModel = clone $model;
- return $newModel;
- }
-
/* start aggregator methods */
/**
* @return $this
@@ -266,13 +229,11 @@ public function loadArray($arr, $key = 'conditions')
);
if (!empty($arr[$key]) && is_array($arr[$key])) {
- foreach ($arr[$key] as $condArr) {
+ foreach ($arr[$key] as $conditionArr) {
try {
- $cond = $this->_getNewConditionModelInstance($condArr['type']);
- if ($cond) {
- $this->addCondition($cond);
- $cond->loadArray($condArr, $key);
- }
+ $condition = $this->_conditionFactory->create($conditionArr['type']);
+ $this->addCondition($condition);
+ $condition->loadArray($conditionArr, $key);
} catch (\Exception $e) {
$this->_logger->logException($e);
}
diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
index fda5e0744cb9f..3a706165d7226 100644
--- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
+++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
@@ -331,11 +331,11 @@ public function collectValidatedAttributes($productCollection)
{
$attribute = $this->getAttribute();
if ('category_ids' != $attribute) {
+ $productCollection->addAttributeToSelect($attribute, 'left');
if ($this->getAttributeObject()->isScopeGlobal()) {
$attributes = $this->getRule()->getCollectedAttributes();
$attributes[$attribute] = true;
$this->getRule()->setCollectedAttributes($attributes);
- $productCollection->addAttributeToSelect($attribute, 'left');
} else {
$this->_entityAttributeValues = $productCollection->getAllAttributeValues($attribute);
}
@@ -607,14 +607,20 @@ public function getBindArgumentValue()
}
/**
- * Get field by attribute
+ * Get mapped sql field
*
* @return string
*/
public function getMappedSqlField()
{
-
- return ($this->getAttribute() == 'category_ids') ? 'e.entity_id' : parent::getMappedSqlField();
+ if (!$this->isAttributeSetOrCategory()) {
+ $mappedSqlField = $this->getEavAttributeTableAlias() . '.value';
+ } elseif ($this->getAttribute() == 'category_ids') {
+ $mappedSqlField = 'e.entity_id';
+ } else {
+ $mappedSqlField = parent::getMappedSqlField();
+ }
+ return $mappedSqlField;
}
/**
@@ -702,4 +708,26 @@ public function getOperatorForValidate()
return $operator;
}
+
+ /**
+ * Check is attribute set or category
+ *
+ * @return bool
+ */
+ protected function isAttributeSetOrCategory()
+ {
+ return in_array($this->getAttribute(), ['attribute_set_id', 'category_ids']);
+ }
+
+ /**
+ * Get eav attribute alias
+ *
+ * @return string
+ */
+ protected function getEavAttributeTableAlias()
+ {
+ $attribute = $this->getAttributeObject();
+
+ return 'at_' . $attribute->getAttributeCode();
+ }
}
diff --git a/app/code/Magento/Rule/Model/Condition/Sql/Builder.php b/app/code/Magento/Rule/Model/Condition/Sql/Builder.php
index 2f2cedbea3055..dac518d9a4f2a 100644
--- a/app/code/Magento/Rule/Model/Condition/Sql/Builder.php
+++ b/app/code/Magento/Rule/Model/Condition/Sql/Builder.php
@@ -119,7 +119,8 @@ protected function _joinTablesToCollection(
/** @var $condition AbstractCondition */
$collection->getSelect()->joinLeft(
[$alias => $collection->getResource()->getTable($joinTable['name'])],
- $joinTable['condition']
+ $joinTable['condition'],
+ isset($joinTable['columns']) ? $joinTable['columns'] : '*'
);
}
return $this;
diff --git a/app/code/Magento/Rule/Model/ConditionFactory.php b/app/code/Magento/Rule/Model/ConditionFactory.php
index e03c3f0d767f4..95b18789ba8fd 100644
--- a/app/code/Magento/Rule/Model/ConditionFactory.php
+++ b/app/code/Magento/Rule/Model/ConditionFactory.php
@@ -23,30 +23,48 @@
*/
namespace Magento\Rule\Model;
+use Magento\Framework\ObjectManager;
+
class ConditionFactory
{
/**
- * @var \Magento\Framework\ObjectManager
+ * @var ObjectManager
+ */
+ private $objectManager;
+
+ /**
+ * Store all used condition models
+ *
+ * @var array
*/
- protected $_objectManager;
+ private $conditionModels = [];
/**
- * @param \Magento\Framework\ObjectManager $objectManager
+ * @param ObjectManager $objectManager
*/
- public function __construct(\Magento\Framework\ObjectManager $objectManager)
+ public function __construct(ObjectManager $objectManager)
{
- $this->_objectManager = $objectManager;
+ $this->objectManager = $objectManager;
}
/**
- * Create new action object
+ * Create new object for each requested model.
+ * If model is requested first time, store it at array.
+ * It's made by performance reasons to avoid initialization of same models each time when rules are being processed.
*
* @param string $type
- * @param array $data
+ *
* @return \Magento\Rule\Model\Condition\ConditionInterface
+ *
+ * @throws \LogicException
+ * @throws \BadMethodCallException
*/
- public function create($type, array $data = array())
+ public function create($type)
{
- return $this->_objectManager->create($type, $data);
+ if (!array_key_exists($type, $this->conditionModels)) {
+ $this->conditionModels[$type] = $this->objectManager->create($type);
+ }
+
+ return clone $this->conditionModels[$type];
}
}
diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json
index 02b8dfdb00a8b..01c7fdadc746f 100644
--- a/app/code/Magento/Rule/composer.json
+++ b/app/code/Magento/Rule/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php
index f3d45333bb3e4..897b51f3370ed 100644
--- a/app/code/Magento/Sales/Model/AdminOrder/Create.php
+++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php
@@ -1493,7 +1493,8 @@ public function setAccountData($accountData)
$request = $form->prepareRequest($accountData);
$data = $form->extractData($request);
$data = $form->restoreData($data);
- $customer = $this->_customerBuilder->mergeDataObjectWithArray($customer, $data);
+ $customer = $this->_customerBuilder->mergeDataObjectWithArray($customer, $data)
+ ->create();
$this->getQuote()->updateCustomerData($customer);
$data = array();
@@ -1604,7 +1605,8 @@ protected function _validateCustomerData(CustomerDataObject $customerDataObject)
unset($data[$key]);
}
}
- return $this->_customerBuilder->mergeDataObjectWithArray($customerDataObject, $data);
+ return $this->_customerBuilder->mergeDataObjectWithArray($customerDataObject, $data)
+ ->create();
}
/**
@@ -1702,7 +1704,7 @@ protected function _prepareCustomerAddress($customerDataObject, $quoteCustomerAd
$customerAddressDataObject = $this->_customerAddressBuilder->mergeDataObjects(
$existingAddressDataObject,
$customerAddressDataObject
- );
+ )->create();
} elseif ($addressType == CustomerAddressDataObject::ADDRESS_TYPE_SHIPPING) {
try {
$billingAddressDataObject = $this->_customerAddressService->getDefaultBillingAddress($customerId);
diff --git a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
index c88b04b27bd00..f867d7fdce95a 100644
--- a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
+++ b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
@@ -109,7 +109,7 @@ public function dispatch(\Magento\Framework\Event\Observer $observer)
$customerData = $this->customerBuilder->mergeDataObjectWithArray(
$customerData,
array('group_id' => $groupId)
- );
+ )->create();
$quote->setCustomerData($customerData);
}
}
diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php
index 72165ecb21c34..aea40921e5fd9 100644
--- a/app/code/Magento/Sales/Model/Quote.php
+++ b/app/code/Magento/Sales/Model/Quote.php
@@ -179,6 +179,11 @@ class Quote extends \Magento\Framework\Model\AbstractModel
*/
protected $_payments;
+ /**
+ * @var \Magento\Sales\Model\Quote\Payment
+ */
+ protected $_currentPayment;
+
/**
* Different groups of error infos
*
@@ -533,6 +538,10 @@ protected function _afterSave()
if (null !== $this->_payments) {
$this->getPaymentsCollection()->save();
}
+
+ if (null !== $this->_currentPayment) {
+ $this->getPayment()->save();
+ }
return $this;
}
@@ -1593,7 +1602,15 @@ public function getPaymentsCollection()
*/
public function getPayment()
{
- foreach ($this->getPaymentsCollection() as $payment) {
+ if (null === $this->_currentPayment || !$this->_currentPayment) {
+ $this->_currentPayment = $this->_quotePaymentCollectionFactory->create()
+ ->setQuoteFilter($this->getId())
+ ->getFirstItem();
+ }
+ if ($payment = $this->_currentPayment) {
+ if ($this->getId()) {
+ $payment->setQuote($this);
+ }
if (!$payment->isDeleted()) {
return $payment;
}
diff --git a/app/code/Magento/Sales/Model/Quote/Payment.php b/app/code/Magento/Sales/Model/Quote/Payment.php
index b7c50268f63ab..6801cfccc4e7d 100644
--- a/app/code/Magento/Sales/Model/Quote/Payment.php
+++ b/app/code/Magento/Sales/Model/Quote/Payment.php
@@ -159,21 +159,16 @@ public function importData(array $data)
$this->setMethod($data->getMethod());
$method = $this->getMethodInstance();
+ $quote = $this->getQuote();
/**
* Payment availability related with quote totals.
* We have to recollect quote totals before checking
*/
- $this->getQuote()->collectTotals();
-
- if (!$method->isAvailable(
- $this->getQuote()
- ) || !$this->methodSpecificationFactory->create(
- $data->getChecks()
- )->isApplicable(
- $method,
- $this->getQuote()
- )
+ $quote->collectTotals();
+
+ if (!$method->isAvailable($quote)
+ || !$this->methodSpecificationFactory->create($data->getChecks())->isApplicable($method, $quote)
) {
throw new \Magento\Framework\Model\Exception(__('The requested Payment Method is not available.'));
}
diff --git a/app/code/Magento/Sales/Model/Resource/AbstractGrid.php b/app/code/Magento/Sales/Model/Resource/AbstractGrid.php
index 01da9011b074b..62f5126129fcd 100644
--- a/app/code/Magento/Sales/Model/Resource/AbstractGrid.php
+++ b/app/code/Magento/Sales/Model/Resource/AbstractGrid.php
@@ -45,12 +45,12 @@ abstract class AbstractGrid extends AbstractDb implements GridInterface
/**
* @var string
*/
- protected $orderTableName = 'sales_flat_order';
+ protected $orderTableName = 'sales_order';
/**
* @var string
*/
- protected $addressTableName = 'sales_flat_order_address';
+ protected $addressTableName = 'sales_order_address';
/**
* @param AppResource $resource
diff --git a/app/code/Magento/Sales/Model/Resource/Order.php b/app/code/Magento/Sales/Model/Resource/Order.php
index 0950d18db3270..5dcb87177f9ab 100644
--- a/app/code/Magento/Sales/Model/Resource/Order.php
+++ b/app/code/Magento/Sales/Model/Resource/Order.php
@@ -70,7 +70,7 @@ class Order extends SalesResource
*/
protected function _construct()
{
- $this->_init('sales_flat_order', 'entity_id');
+ $this->_init('sales_order', 'entity_id');
}
/**
@@ -108,7 +108,7 @@ public function aggregateProductsByTypes($orderId, $productTypeIds = array(), $i
{
$adapter = $this->getReadConnection();
$select = $adapter->select()->from(
- array('o' => $this->getTable('sales_flat_order_item')),
+ array('o' => $this->getTable('sales_order_item')),
array('o.product_type', new \Zend_Db_Expr('COUNT(*)'))
)->joinInner(
array('p' => $this->getTable('catalog_product_entity')),
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php
index 1a72291fc08c6..e3f33bcfde32c 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Address.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php
@@ -76,7 +76,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_order_address', 'entity_id');
+ $this->_init('sales_order_address', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Collection.php
index 8cabdec551862..3e47161e43636 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Collection.php
@@ -135,7 +135,7 @@ protected function _getAllIdsSelect($limit = null, $offset = null)
}
/**
- * Join table sales_flat_order_address to select for billing and shipping order addresses.
+ * Join table sales_order_address to select for billing and shipping order addresses.
* Create correlation map
*
* @return $this
@@ -144,7 +144,7 @@ protected function _addAddressFields()
{
$billingAliasName = 'billing_o_a';
$shippingAliasName = 'shipping_o_a';
- $joinTable = $this->getTable('sales_flat_order_address');
+ $joinTable = $this->getTable('sales_order_address');
$this->addFilterToMap(
'billing_firstname',
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php
index 33b3d2cb7b4f9..ad3a64403dab3 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php
@@ -51,7 +51,7 @@ class Creditmemo extends SalesResource
*/
protected function _construct()
{
- $this->_init('sales_flat_creditmemo', 'entity_id');
+ $this->_init('sales_creditmemo', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php
index c9db568fedf74..9786250c8bce1 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php
@@ -71,7 +71,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_creditmemo_comment', 'entity_id');
+ $this->_init('sales_creditmemo_comment', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php
index 25669e15b31dd..914058cc611c0 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php
@@ -35,12 +35,12 @@ class Grid extends AbstractGrid
/**
* @var string
*/
- protected $gridTableName = 'sales_flat_creditmemo_grid';
+ protected $gridTableName = 'sales_creditmemo_grid';
/**
* @var string
*/
- protected $creditmemoTableName = 'sales_flat_creditmemo';
+ protected $creditmemoTableName = 'sales_creditmemo';
/**
* Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php
index 2384f1c766fb3..69ef97b40b357 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php
@@ -52,6 +52,6 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Creditmemo\Collecti
protected function _construct()
{
parent::_construct();
- $this->setMainTable('sales_flat_creditmemo_grid');
+ $this->setMainTable('sales_creditmemo_grid');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php
index 04cc496aa2e58..f1c8a6026238e 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php
@@ -44,6 +44,6 @@ class Item extends \Magento\Sales\Model\Resource\Entity
*/
protected function _construct()
{
- $this->_init('sales_flat_creditmemo_item', 'entity_id');
+ $this->_init('sales_creditmemo_item', 'entity_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Grid.php
index 3d266fd5fcd8b..18a4efbaad2cc 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Grid.php
@@ -35,7 +35,7 @@ class Grid extends AbstractGrid
/**
* @var string
*/
- protected $gridTableName = 'sales_flat_order_grid';
+ protected $gridTableName = 'sales_order_grid';
/**
* Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php
index 53d27423805e6..7b029049c9370 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php
@@ -59,7 +59,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection
protected function _construct()
{
parent::_construct();
- $this->setMainTable('sales_flat_order_grid');
+ $this->setMainTable('sales_order_grid');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php
index 08e1918d8fb0e..3eabd12157f77 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php
@@ -49,7 +49,7 @@ class Invoice extends SalesResource
*/
protected function _construct()
{
- $this->_init('sales_flat_invoice', 'entity_id');
+ $this->_init('sales_invoice', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php
index 6d3ce1e283e1c..41f7326e25dff 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php
@@ -74,7 +74,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_invoice_comment', 'entity_id');
+ $this->_init('sales_invoice_comment', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php
index 1a68f9c05378e..161fffa8932a2 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php
@@ -35,12 +35,12 @@ class Grid extends AbstractGrid
/**
* @var string
*/
- protected $gridTableName = 'sales_flat_invoice_grid';
+ protected $gridTableName = 'sales_invoice_grid';
/**
* @var string
*/
- protected $invoiceTableName = 'sales_flat_invoice';
+ protected $invoiceTableName = 'sales_invoice';
/**
* Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php
index 4da498d1052f1..828817e347554 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php
@@ -52,6 +52,6 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Invoice\Collection
protected function _construct()
{
parent::_construct();
- $this->setMainTable('sales_flat_invoice_grid');
+ $this->setMainTable('sales_invoice_grid');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php
index 0ec5acbe69acb..9e51bc4409481 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php
@@ -44,6 +44,6 @@ class Item extends \Magento\Sales\Model\Resource\Entity
*/
protected function _construct()
{
- $this->_init('sales_flat_invoice_item', 'entity_id');
+ $this->_init('sales_invoice_item', 'entity_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Item.php
index 34a8ffca5286c..8881bdd83ea1a 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Item.php
@@ -44,6 +44,6 @@ class Item extends SalesResource
*/
protected function _construct()
{
- $this->_init('sales_flat_order_item', 'item_id');
+ $this->_init('sales_order_item', 'item_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment.php b/app/code/Magento/Sales/Model/Resource/Order/Payment.php
index 35a0bc2e401fd..e14c251505425 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Payment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Payment.php
@@ -55,6 +55,6 @@ class Payment extends SalesResource
*/
protected function _construct()
{
- $this->_init('sales_flat_order_payment', 'entity_id');
+ $this->_init('sales_order_payment', 'entity_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php
index b5555a97b7ebe..a6129ef934ec4 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php
@@ -128,7 +128,7 @@ public function getOrderWebsiteId($orderId)
$adapter = $this->_getReadAdapter();
$bind = array(':entity_id' => $orderId);
$select = $adapter->select()->from(
- array('so' => $this->getTable('sales_flat_order')),
+ array('so' => $this->getTable('sales_order')),
'cs.website_id'
)->joinInner(
array('cs' => $this->getTable('store')),
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php
index 17699d9712ae0..9b535ce492c3b 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php
@@ -215,7 +215,7 @@ protected function _renderFiltersBefore()
}
if ($this->_addPaymentInformation) {
$this->getSelect()->joinInner(
- array('sop' => $this->getTable('sales_flat_order_payment')),
+ array('sop' => $this->getTable('sales_order_payment')),
'main_table.payment_id = sop.entity_id',
$this->_addPaymentInformation
);
@@ -226,7 +226,7 @@ protected function _renderFiltersBefore()
}
if ($this->_addOrderInformation) {
$this->getSelect()->joinInner(
- array('so' => $this->getTable('sales_flat_order')),
+ array('so' => $this->getTable('sales_order')),
'main_table.order_id = so.entity_id',
$this->_addOrderInformation
);
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php b/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php
index 005372e9f9c6c..e352563c0c7fb 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php
@@ -58,8 +58,8 @@ public function getAllCommentCollection($orderId)
$fields = array('notified' => 'is_customer_notified', 'comment', 'created_at');
$commentSelects = array();
foreach (array('invoice', 'shipment', 'creditmemo') as $entityTypeCode) {
- $mainTable = $resource->getTableName('sales_flat_' . $entityTypeCode);
- $slaveTable = $resource->getTableName('sales_flat_' . $entityTypeCode . '_comment');
+ $mainTable = $resource->getTableName('sales_' . $entityTypeCode);
+ $slaveTable = $resource->getTableName('sales_' . $entityTypeCode . '_comment');
$select = $read->select()->from(
array('main' => $mainTable),
array('entity_id' => 'order_id', 'entity_type_code' => new \Zend_Db_Expr("'{$entityTypeCode}'"))
@@ -74,7 +74,7 @@ public function getAllCommentCollection($orderId)
$commentSelects[] = '(' . $select . ')';
}
$select = $read->select()->from(
- $resource->getTableName('sales_flat_order_status_history'),
+ $resource->getTableName('sales_order_status_history'),
array('entity_id' => 'parent_id', 'entity_type_code' => new \Zend_Db_Expr("'order'")) + $fields
)->where(
'parent_id = ?',
@@ -87,7 +87,7 @@ public function getAllCommentCollection($orderId)
$commentSelect = $read->select()->union($commentSelects, \Zend_Db_Select::SQL_UNION_ALL);
$select = $read->select()->from(
- array('orders' => $resource->getTableName('sales_flat_order')),
+ array('orders' => $resource->getTableName('sales_order')),
array('increment_id')
)->join(
array('t' => $commentSelect),
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php
index 1879a8ab1f012..508c2eeaba16e 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php
@@ -58,7 +58,7 @@ class Shipment extends SalesResource
*/
protected function _construct()
{
- $this->_init('sales_flat_shipment', 'entity_id');
+ $this->_init('sales_shipment', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php
index fa21a5c0e3ebd..b81e3a5817a17 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php
@@ -71,7 +71,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_shipment_comment', 'entity_id');
+ $this->_init('sales_shipment_comment', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php
index 45d951c675720..3a7acd9f6c976 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php
@@ -35,12 +35,12 @@ class Grid extends AbstractGrid
/**
* @var string
*/
- protected $gridTableName = 'sales_flat_shipment_grid';
+ protected $gridTableName = 'sales_shipment_grid';
/**
* @var string
*/
- protected $shipmentTableName = 'sales_flat_shipment';
+ protected $shipmentTableName = 'sales_shipment';
/**
* Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php
index 2017ee5a71cbc..1aeb94dde898a 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php
@@ -52,6 +52,6 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Shipment\Collection
protected function _construct()
{
parent::_construct();
- $this->setMainTable('sales_flat_shipment_grid');
+ $this->setMainTable('sales_shipment_grid');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php
index c0a09763e7ee5..62b8b1d20a9c1 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php
@@ -44,6 +44,6 @@ class Item extends \Magento\Sales\Model\Resource\Entity
*/
protected function _construct()
{
- $this->_init('sales_flat_shipment_item', 'entity_id');
+ $this->_init('sales_shipment_item', 'entity_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php
index fecd4bf17309c..97aefcc1678b0 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php
@@ -71,7 +71,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_shipment_track', 'entity_id');
+ $this->_init('sales_shipment_track', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status.php b/app/code/Magento/Sales/Model/Resource/Order/Status.php
index b0839240f62fe..01cf0228166c7 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Status.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Status.php
@@ -253,7 +253,7 @@ public function checkIsStatusUsed($status)
{
return (bool)$this->_getWriteAdapter()->fetchOne(
$this->_getWriteAdapter()->select()
- ->from(['sfo' => $this->getTable('sales_flat_order')], [])
+ ->from(['sfo' => $this->getTable('sales_order')], [])
->where('status = ?', $status)
->limit(1)
->columns([new \Zend_Db_Expr(1)])
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php
index 2143955fb86f4..368803b73d5fb 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php
@@ -71,7 +71,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_order_status_history', 'entity_id');
+ $this->_init('sales_order_status_history', 'entity_id');
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Quote.php b/app/code/Magento/Sales/Model/Resource/Quote.php
index 9942477762fc9..b02ce7908c2a4 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote.php
@@ -54,7 +54,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_quote', 'entity_id');
+ $this->_init('sales_quote', 'entity_id');
}
/**
@@ -184,7 +184,7 @@ public function isOrderIncrementIdUsed($orderIncrementId)
$adapter = $this->_getReadAdapter();
$bind = array(':increment_id' => $orderIncrementId);
$select = $adapter->select();
- $select->from($this->getTable('sales_flat_order'), 'entity_id')->where('increment_id = :increment_id');
+ $select->from($this->getTable('sales_order'), 'entity_id')->where('increment_id = :increment_id');
$entity_id = $adapter->fetchOne($select, $bind);
if ($entity_id > 0) {
return true;
@@ -200,9 +200,9 @@ public function isOrderIncrementIdUsed($orderIncrementId)
*/
public function markQuotesRecollectOnCatalogRules()
{
- $tableQuote = $this->getTable('sales_flat_quote');
+ $tableQuote = $this->getTable('sales_quote');
$subSelect = $this->_getReadAdapter()->select()->from(
- array('t2' => $this->getTable('sales_flat_quote_item')),
+ array('t2' => $this->getTable('sales_quote_item')),
array('entity_id' => 'quote_id')
)->from(
array('t3' => $this->getTable('catalogrule_product_price')),
@@ -250,7 +250,7 @@ public function substractProductFromQuotes($product)
'items_count' => new \Zend_Db_Expr($adapter->quoteIdentifier('q.items_count') . ' - 1')
)
)->join(
- array('qi' => $this->getTable('sales_flat_quote_item')),
+ array('qi' => $this->getTable('sales_quote_item')),
implode(
' AND ',
array(
@@ -262,7 +262,7 @@ public function substractProductFromQuotes($product)
array()
);
- $updateQuery = $adapter->updateFromSelect($subSelect, array('q' => $this->getTable('sales_flat_quote')));
+ $updateQuery = $adapter->updateFromSelect($subSelect, array('q' => $this->getTable('sales_quote')));
$adapter->query($updateQuery);
@@ -277,8 +277,8 @@ public function substractProductFromQuotes($product)
*/
public function markQuotesRecollect($productIds)
{
- $tableQuote = $this->getTable('sales_flat_quote');
- $tableItem = $this->getTable('sales_flat_quote_item');
+ $tableQuote = $this->getTable('sales_quote');
+ $tableItem = $this->getTable('sales_quote_item');
$subSelect = $this->_getReadAdapter()->select()->from(
$tableItem,
array('entity_id' => 'quote_id')
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address.php b/app/code/Magento/Sales/Model/Resource/Quote/Address.php
index 469c1440df9c2..07b3e2a85b062 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address.php
@@ -37,6 +37,6 @@ class Address extends \Magento\Sales\Model\Resource\AbstractResource
*/
protected function _construct()
{
- $this->_init('sales_flat_quote_address', 'address_id');
+ $this->_init('sales_quote_address', 'address_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php
index 8118c5ae7f9c7..f076e658d496e 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php
@@ -34,13 +34,11 @@ class Region extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
protected $_regionFactory;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Directory\Model\RegionFactory $regionFactory
*/
- public function __construct(\Magento\Framework\Logger $logger, \Magento\Directory\Model\RegionFactory $regionFactory)
+ public function __construct(\Magento\Directory\Model\RegionFactory $regionFactory)
{
$this->_regionFactory = $regionFactory;
- parent::__construct($logger);
}
/**
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php
index 10d80366bdaf8..b719a8e05b60c 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php
@@ -37,6 +37,6 @@ class Item extends \Magento\Sales\Model\Resource\AbstractResource
*/
protected function _construct()
{
- $this->_init('sales_flat_quote_address_item', 'address_item_id');
+ $this->_init('sales_quote_address_item', 'address_item_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php
index 77d4c6071c6c0..19b57ed953e49 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php
@@ -37,6 +37,6 @@ class Rate extends \Magento\Sales\Model\Resource\AbstractResource
*/
protected function _construct()
{
- $this->_init('sales_flat_quote_shipping_rate', 'rate_id');
+ $this->_init('sales_quote_shipping_rate', 'rate_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item.php b/app/code/Magento/Sales/Model/Resource/Quote/Item.php
index 2d3ad7452d1e3..b83e78c539285 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Item.php
@@ -37,6 +37,6 @@ class Item extends \Magento\Sales\Model\Resource\AbstractResource
*/
protected function _construct()
{
- $this->_init('sales_flat_quote_item', 'item_id');
+ $this->_init('sales_quote_item', 'item_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php
index 412ade472fc35..742f97fe3f219 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php
@@ -37,6 +37,6 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb
*/
protected function _construct()
{
- $this->_init('sales_flat_quote_item_option', 'option_id');
+ $this->_init('sales_quote_item_option', 'option_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Payment.php b/app/code/Magento/Sales/Model/Resource/Quote/Payment.php
index 22b0d7282e224..f1a2bf2bd5d23 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Payment.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Payment.php
@@ -53,6 +53,6 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('sales_flat_quote_payment', 'payment_id');
+ $this->_init('sales_quote_payment', 'payment_id');
}
}
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php
index 041bf7cdd9279..52e2b866306e9 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php
@@ -112,7 +112,7 @@ public function aggregate($from = null, $to = null)
try {
if ($from !== null || $to !== null) {
$subSelect = $this->_getTableDateRangeSelect(
- $this->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'created_at',
'updated_at',
$from,
@@ -126,7 +126,7 @@ public function aggregate($from = null, $to = null)
// convert dates from UTC to current admin timezone
$periodExpr = $adapter->getDatePartSql(
$this->getStoreTZOffsetQuery(
- array('source_table' => $this->getTable('sales_flat_order')),
+ array('source_table' => $this->getTable('sales_order')),
'source_table.created_at',
$from,
$to
@@ -164,10 +164,10 @@ public function aggregate($from = null, $to = null)
);
$select->from(
- array('source_table' => $this->getTable('sales_flat_order')),
+ array('source_table' => $this->getTable('sales_order')),
$columns
)->joinInner(
- array('order_item' => $this->getTable('sales_flat_order_item')),
+ array('order_item' => $this->getTable('sales_order_item')),
'order_item.order_id = source_table.entity_id',
array()
)->where(
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php b/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php
index 6ca9e230b1cd5..053275809feac 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php
@@ -72,8 +72,8 @@ public function aggregate($from = null, $to = null)
protected function _aggregateByInvoiceCreatedAt($from, $to)
{
$table = $this->getTable('sales_invoiced_aggregated');
- $sourceTable = $this->getTable('sales_flat_invoice');
- $orderTable = $this->getTable('sales_flat_order');
+ $sourceTable = $this->getTable('sales_invoice');
+ $orderTable = $this->getTable('sales_order');
$adapter = $this->_getWriteAdapter();
$adapter->beginTransaction();
@@ -195,7 +195,7 @@ protected function _aggregateByInvoiceCreatedAt($from, $to)
protected function _aggregateByOrderCreatedAt($from, $to)
{
$table = $this->getTable('sales_invoiced_aggregated_order');
- $sourceTable = $this->getTable('sales_flat_order');
+ $sourceTable = $this->getTable('sales_order');
$adapter = $this->_getWriteAdapter();
if ($from !== null || $to !== null) {
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php b/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php
index 76d39962ce1a6..062659b23fb11 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php
@@ -75,7 +75,7 @@ protected function _aggregateByField($aggregationField, $from, $to)
if ($from !== null || $to !== null) {
$subSelect = $this->_getTableDateRangeSelect(
- $this->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
$aggregationField,
$aggregationField,
$from,
@@ -88,7 +88,7 @@ protected function _aggregateByField($aggregationField, $from, $to)
$periodExpr = $adapter->getDatePartSql(
$this->getStoreTZOffsetQuery(
- array('o' => $this->getTable('sales_flat_order')),
+ array('o' => $this->getTable('sales_order')),
'o.' . $aggregationField,
$from,
$to
@@ -221,7 +221,7 @@ protected function _aggregateByField($aggregationField, $from, $to)
'total_qty_invoiced' => new \Zend_Db_Expr('SUM(qty_invoiced)')
);
$selectOrderItem->from(
- $this->getTable('sales_flat_order_item'),
+ $this->getTable('sales_order_item'),
$cols
)->where(
'parent_item_id IS NULL'
@@ -230,7 +230,7 @@ protected function _aggregateByField($aggregationField, $from, $to)
);
$select->from(
- array('o' => $this->getTable('sales_flat_order')),
+ array('o' => $this->getTable('sales_order')),
$columns
)->join(
array('oi' => $selectOrderItem),
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Refunded.php b/app/code/Magento/Sales/Model/Resource/Report/Refunded.php
index fc0042e855027..7be06fc137243 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Refunded.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Refunded.php
@@ -72,7 +72,7 @@ public function aggregate($from = null, $to = null)
protected function _aggregateByOrderCreatedAt($from, $to)
{
$table = $this->getTable('sales_refunded_aggregated_order');
- $sourceTable = $this->getTable('sales_flat_order');
+ $sourceTable = $this->getTable('sales_order');
$adapter = $this->_getWriteAdapter();
$adapter->beginTransaction();
@@ -159,8 +159,8 @@ protected function _aggregateByOrderCreatedAt($from, $to)
protected function _aggregateByRefundCreatedAt($from, $to)
{
$table = $this->getTable('sales_refunded_aggregated');
- $sourceTable = $this->getTable('sales_flat_creditmemo');
- $orderTable = $this->getTable('sales_flat_order');
+ $sourceTable = $this->getTable('sales_creditmemo');
+ $orderTable = $this->getTable('sales_order');
$adapter = $this->_getWriteAdapter();
$adapter->beginTransaction();
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Shipping.php b/app/code/Magento/Sales/Model/Resource/Report/Shipping.php
index ec939dec0c750..a8d78fe3b8e74 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Shipping.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Shipping.php
@@ -71,7 +71,7 @@ public function aggregate($from = null, $to = null)
protected function _aggregateByOrderCreatedAt($from, $to)
{
$table = $this->getTable('sales_shipping_aggregated_order');
- $sourceTable = $this->getTable('sales_flat_order');
+ $sourceTable = $this->getTable('sales_order');
$adapter = $this->_getWriteAdapter();
$adapter->beginTransaction();
@@ -163,8 +163,8 @@ protected function _aggregateByOrderCreatedAt($from, $to)
protected function _aggregateByShippingCreatedAt($from, $to)
{
$table = $this->getTable('sales_shipping_aggregated');
- $sourceTable = $this->getTable('sales_flat_invoice');
- $orderTable = $this->getTable('sales_flat_order');
+ $sourceTable = $this->getTable('sales_invoice');
+ $orderTable = $this->getTable('sales_order');
$adapter = $this->_getWriteAdapter();
$adapter->beginTransaction();
diff --git a/app/code/Magento/Sales/Model/Resource/Setup.php b/app/code/Magento/Sales/Model/Resource/Setup.php
index 81c2c7ba6519a..f5bdf6386990a 100644
--- a/app/code/Magento/Sales/Model/Resource/Setup.php
+++ b/app/code/Magento/Sales/Model/Resource/Setup.php
@@ -74,27 +74,27 @@ public function __construct(
* @var $_flatEntityTables array
*/
protected $_flatEntityTables = array(
- 'quote' => 'sales_flat_quote',
- 'quote_item' => 'sales_flat_quote_item',
- 'quote_address' => 'sales_flat_quote_address',
- 'quote_address_item' => 'sales_flat_quote_address_item',
- 'quote_address_rate' => 'sales_flat_quote_shipping_rate',
- 'quote_payment' => 'sales_flat_quote_payment',
- 'order' => 'sales_flat_order',
- 'order_payment' => 'sales_flat_order_payment',
- 'order_item' => 'sales_flat_order_item',
- 'order_address' => 'sales_flat_order_address',
- 'order_status_history' => 'sales_flat_order_status_history',
- 'invoice' => 'sales_flat_invoice',
- 'invoice_item' => 'sales_flat_invoice_item',
- 'invoice_comment' => 'sales_flat_invoice_comment',
- 'creditmemo' => 'sales_flat_creditmemo',
- 'creditmemo_item' => 'sales_flat_creditmemo_item',
- 'creditmemo_comment' => 'sales_flat_creditmemo_comment',
- 'shipment' => 'sales_flat_shipment',
- 'shipment_item' => 'sales_flat_shipment_item',
- 'shipment_track' => 'sales_flat_shipment_track',
- 'shipment_comment' => 'sales_flat_shipment_comment'
+ 'quote' => 'sales_quote',
+ 'quote_item' => 'sales_quote_item',
+ 'quote_address' => 'sales_quote_address',
+ 'quote_address_item' => 'sales_quote_address_item',
+ 'quote_address_rate' => 'sales_quote_shipping_rate',
+ 'quote_payment' => 'sales_quote_payment',
+ 'order' => 'sales_order',
+ 'order_payment' => 'sales_order_payment',
+ 'order_item' => 'sales_order_item',
+ 'order_address' => 'sales_order_address',
+ 'order_status_history' => 'sales_order_status_history',
+ 'invoice' => 'sales_invoice',
+ 'invoice_item' => 'sales_invoice_item',
+ 'invoice_comment' => 'sales_invoice_comment',
+ 'creditmemo' => 'sales_creditmemo',
+ 'creditmemo_item' => 'sales_creditmemo_item',
+ 'creditmemo_comment' => 'sales_creditmemo_comment',
+ 'shipment' => 'sales_shipment',
+ 'shipment_item' => 'sales_shipment_item',
+ 'shipment_track' => 'sales_shipment_track',
+ 'shipment_comment' => 'sales_shipment_comment'
);
/**
@@ -232,28 +232,28 @@ public function getDefaultEntities()
$entities = array(
'order' => array(
'entity_model' => 'Magento\Sales\Model\Resource\Order',
- 'table' => 'sales_flat_order',
+ 'table' => 'sales_order',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
'increment_per_store' => true,
'attributes' => array()
),
'invoice' => array(
'entity_model' => 'Magento\Sales\Model\Resource\Order\Invoice',
- 'table' => 'sales_flat_invoice',
+ 'table' => 'sales_invoice',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
'increment_per_store' => true,
'attributes' => array()
),
'creditmemo' => array(
'entity_model' => 'Magento\Sales\Model\Resource\Order\Creditmemo',
- 'table' => 'sales_flat_creditmemo',
+ 'table' => 'sales_creditmemo',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
'increment_per_store' => true,
'attributes' => array()
),
'shipment' => array(
'entity_model' => 'Magento\Sales\Model\Resource\Order\Shipment',
- 'table' => 'sales_flat_shipment',
+ 'table' => 'sales_shipment',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
'increment_per_store' => true,
'attributes' => array()
diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json
index 4c296da9b4271..cd8ebd2b68baa 100644
--- a/app/code/Magento/Sales/composer.json
+++ b/app/code/Magento/Sales/composer.json
@@ -3,31 +3,31 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-authorization": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-sales-rule": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-widget": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-gift-message": "0.1.0-alpha103",
- "magento/module-reports": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-wishlist": "0.1.0-alpha103",
- "magento/module-email": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-authorization": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-sales-rule": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-widget": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-gift-message": "0.1.0-alpha104",
+ "magento/module-reports": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-wishlist": "0.1.0-alpha104",
+ "magento/module-email": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php b/app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php
similarity index 71%
rename from app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php
rename to app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php
index f8ca4ef8b2011..d3e2be7af5d7b 100644
--- a/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php
@@ -22,13 +22,12 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-/** @var $installer \Magento\Sales\Model\Resource\Setup */
-$installer = $this;
+/** @var $this \Magento\Sales\Model\Resource\Setup */
/**
* Install eav entity types to the eav/entity_type table
*/
-$installer->installEntities();
+$this->installEntities();
/**
* Install order statuses from config
@@ -48,7 +47,7 @@
foreach ($statuses as $code => $info) {
$data[] = array('status' => $code, 'label' => $info);
}
-$installer->getConnection()->insertArray($installer->getTable('sales_order_status'), array('status', 'label'), $data);
+$this->getConnection()->insertArray($this->getTable('sales_order_status'), array('status', 'label'), $data);
/**
* Install order states from config
@@ -107,8 +106,34 @@
}
}
}
-$installer->getConnection()->insertArray(
- $installer->getTable('sales_order_status_state'),
+$this->getConnection()->insertArray(
+ $this->getTable('sales_order_status_state'),
array('status', 'state', 'is_default'),
$data
);
+
+$entitiesToAlter = array('quote_address', 'order_address');
+
+$attributes = array(
+ 'vat_id' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
+ 'vat_is_valid' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT),
+ 'vat_request_id' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
+ 'vat_request_date' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
+ 'vat_request_success' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT)
+);
+
+foreach ($entitiesToAlter as $entityName) {
+ foreach ($attributes as $attributeCode => $attributeParams) {
+ $this->addAttribute($entityName, $attributeCode, $attributeParams);
+ }
+}
+
+/** Update visibility for states */
+$states = array('new', 'processing', 'complete', 'closed', 'canceled', 'holded', 'payment_review');
+foreach ($states as $state) {
+ $this->getConnection()->update(
+ $this->getTable('sales_order_status_state'),
+ array('visible_on_front' => 1),
+ array('state = ?' => $state)
+ );
+}
diff --git a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.4-1.6.0.5.php b/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.4-1.6.0.5.php
deleted file mode 100644
index 91eda509ce867..0000000000000
--- a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.4-1.6.0.5.php
+++ /dev/null
@@ -1,71 +0,0 @@
-getConnection()->select()->from(
- array('citem' => $installer->getTable('sales_flat_creditmemo_item')),
- array(
- 'amount_refunded' => 'SUM(citem.row_total)',
- 'base_amount_refunded' => 'SUM(citem.base_row_total)',
- 'base_tax_refunded' => 'SUM(citem.base_tax_amount)',
- 'discount_refunded' => 'SUM(citem.discount_amount)',
- 'base_discount_refunded' => 'SUM(citem.base_discount_amount)'
- )
-)->joinLeft(
- array('c' => $installer->getTable('sales_flat_creditmemo')),
- 'c.entity_id = citem.parent_id',
- array()
-)->joinLeft(
- array('o' => $installer->getTable('sales_flat_order')),
- 'o.entity_id = c.order_id',
- array()
-)->joinLeft(
- array('oitem' => $installer->getTable('sales_flat_order_item')),
- 'oitem.order_id = o.entity_id AND oitem.product_id=citem.product_id',
- array('item_id')
-)->group(
- 'oitem.item_id'
-);
-
-$select = $installer->getConnection()->select()->from(
- array('selected' => $subSelect),
- array(
- 'amount_refunded' => 'amount_refunded',
- 'base_amount_refunded' => 'base_amount_refunded',
- 'base_tax_refunded' => 'base_tax_refunded',
- 'discount_refunded' => 'discount_refunded',
- 'base_discount_refunded' => 'base_discount_refunded'
- )
-)->where(
- 'main.item_id = selected.item_id'
-);
-
-$updateQuery = $installer->getConnection()->updateFromSelect(
- $select,
- array('main' => $installer->getTable('sales_flat_order_item'))
-);
-
-$installer->getConnection()->query($updateQuery);
diff --git a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php b/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php
deleted file mode 100644
index 65b677a8cb590..0000000000000
--- a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php
+++ /dev/null
@@ -1,42 +0,0 @@
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
- 'vat_is_valid' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT),
- 'vat_request_id' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
- 'vat_request_date' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
- 'vat_request_success' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT)
-);
-
-foreach ($entitiesToAlter as $entityName) {
- foreach ($attributes as $attributeCode => $attributeParams) {
- $installer->addAttribute($entityName, $attributeCode, $attributeParams);
- }
-}
diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml
index 685910b9267a9..427b07dd44361 100644
--- a/app/code/Magento/Sales/etc/module.xml
+++ b/app/code/Magento/Sales/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php b/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php
similarity index 85%
rename from app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php
rename to app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php
index 408e985eb9584..ad5fb72ba0127 100644
--- a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php
@@ -22,15 +22,14 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->startSetup();
+/** @var $this \Magento\Sales\Model\Resource\Setup */
+$this->startSetup();
/**
- * Create table 'sales_flat_order'
+ * Create table 'sales_order'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_order')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -835,62 +834,68 @@
'12,4',
array(),
'Base Shipping Incl Tax'
+)->addColumn(
+ 'coupon_rule_name',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 255,
+ array('nullable' => true),
+ 'Coupon Sales Rule Name'
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('status')),
+ $this->getIdxName('sales_order', array('status')),
array('status')
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('state')),
+ $this->getIdxName('sales_order', array('state')),
array('state')
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('store_id')),
+ $this->getIdxName('sales_order', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_order',
+ $this->getIdxName(
+ 'sales_order',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('created_at')),
+ $this->getIdxName('sales_order', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('customer_id')),
+ $this->getIdxName('sales_order', array('customer_id')),
array('customer_id')
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('ext_order_id')),
+ $this->getIdxName('sales_order', array('ext_order_id')),
array('ext_order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('quote_id')),
+ $this->getIdxName('sales_order', array('quote_id')),
array('quote_id')
)->addIndex(
- $installer->getIdxName('sales_flat_order', array('updated_at')),
+ $this->getIdxName('sales_order', array('updated_at')),
array('updated_at')
)->addForeignKey(
- $installer->getFkName('sales_flat_order', 'customer_id', 'customer_entity', 'entity_id'),
+ $this->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'),
'customer_id',
- $installer->getTable('customer_entity'),
+ $this->getTable('customer_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_order', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_order', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Order'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_order_grid'
+ * Create table 'sales_order_grid'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_order_grid')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_grid')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -988,78 +993,78 @@
array(),
'Updated At'
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('status')),
+ $this->getIdxName('sales_order_grid', array('status')),
array('status')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('store_id')),
+ $this->getIdxName('sales_order_grid', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('base_grand_total')),
+ $this->getIdxName('sales_order_grid', array('base_grand_total')),
array('base_grand_total')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('base_total_paid')),
+ $this->getIdxName('sales_order_grid', array('base_total_paid')),
array('base_total_paid')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('grand_total')),
+ $this->getIdxName('sales_order_grid', array('grand_total')),
array('grand_total')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('total_paid')),
+ $this->getIdxName('sales_order_grid', array('total_paid')),
array('total_paid')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_order_grid',
+ $this->getIdxName(
+ 'sales_order_grid',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('shipping_name')),
+ $this->getIdxName('sales_order_grid', array('shipping_name')),
array('shipping_name')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('billing_name')),
+ $this->getIdxName('sales_order_grid', array('billing_name')),
array('billing_name')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('created_at')),
+ $this->getIdxName('sales_order_grid', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('customer_id')),
+ $this->getIdxName('sales_order_grid', array('customer_id')),
array('customer_id')
)->addIndex(
- $installer->getIdxName('sales_flat_order_grid', array('updated_at')),
+ $this->getIdxName('sales_order_grid', array('updated_at')),
array('updated_at')
)->addForeignKey(
- $installer->getFkName('sales_flat_order_grid', 'customer_id', 'customer_entity', 'entity_id'),
+ $this->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'),
'customer_id',
- $installer->getTable('customer_entity'),
+ $this->getTable('customer_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_order_grid', 'entity_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'),
'entity_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_order_grid', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Order Grid'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_order_address'
+ * Create table 'sales_order_address'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_order_address')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_address')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1187,26 +1192,26 @@
array(),
'Company'
)->addIndex(
- $installer->getIdxName('sales_flat_order_address', array('parent_id')),
+ $this->getIdxName('sales_order_address', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_order_address', 'parent_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Order Address'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_order_status_history'
+ * Create table 'sales_order_status_history'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_order_status_history')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_status_history')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1249,30 +1254,36 @@
null,
array(),
'Created At'
+)->addColumn(
+ 'entity_name',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 32,
+ array('nullable' => true),
+ 'Shows what entity history is bind to.'
)->addIndex(
- $installer->getIdxName('sales_flat_order_status_history', array('parent_id')),
+ $this->getIdxName('sales_order_status_history', array('parent_id')),
array('parent_id')
)->addIndex(
- $installer->getIdxName('sales_flat_order_status_history', array('created_at')),
+ $this->getIdxName('sales_order_status_history', array('created_at')),
array('created_at')
)->addForeignKey(
- $installer->getFkName('sales_flat_order_status_history', 'parent_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Order Status History'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_order_item'
+ * Create table 'sales_order_item'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_order_item')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_item')
)->addColumn(
'item_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1669,37 +1680,54 @@
'12,4',
array(),
'Tax Refunded'
+)->addColumn(
+ 'base_tax_refunded',
+ \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
+ '12,4',
+ array(),
+ 'Base Tax Refunded'
+)->addColumn(
+ 'discount_refunded',
+ \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
+ '12,4',
+ array(),
+ 'Discount Refunded'
+)->addColumn(
+ 'base_discount_refunded',
+ \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
+ '12,4',
+ array(),
+ 'Base Discount Refunded'
)->addIndex(
- $installer->getIdxName('sales_flat_order_item', array('order_id')),
+ $this->getIdxName('sales_order_item', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_order_item', array('store_id')),
+ $this->getIdxName('sales_order_item', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_order_item', 'order_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_order_item', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_order_item', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Order Item'
);
-$installer->getConnection()->createTable($table);
-
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_order_payment'
+ * Create table 'sales_order_payment'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_order_payment')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_payment')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1950,7 +1978,7 @@
'cc_exp_year',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
- array(),
+ array('nullable' => true, 'default' => null),
'Cc Exp Year'
)->addColumn(
'cc_status',
@@ -2025,26 +2053,26 @@
array(),
'Additional Information'
)->addIndex(
- $installer->getIdxName('sales_flat_order_payment', array('parent_id')),
+ $this->getIdxName('sales_order_payment', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_order_payment', 'parent_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Order Payment'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_shipment'
+ * Create table 'sales_shipment'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_shipment')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_shipment')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2123,54 +2151,65 @@
null,
array(),
'Updated At'
+)->addColumn(
+ 'packages',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ '20000',
+ array(),
+ 'Packed Products in Packages'
+)->addColumn(
+ 'shipping_label',
+ \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY,
+ '2m',
+ array(),
+ 'Shipping Label Content'
)->addIndex(
- $installer->getIdxName('sales_flat_shipment', array('store_id')),
+ $this->getIdxName('sales_shipment', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment', array('total_qty')),
+ $this->getIdxName('sales_shipment', array('total_qty')),
array('total_qty')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_shipment',
+ $this->getIdxName(
+ 'sales_shipment',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_shipment', array('order_id')),
+ $this->getIdxName('sales_shipment', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment', array('created_at')),
+ $this->getIdxName('sales_shipment', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment', array('updated_at')),
+ $this->getIdxName('sales_shipment', array('updated_at')),
array('updated_at')
)->addForeignKey(
- $installer->getFkName('sales_flat_shipment', 'order_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_shipment', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_shipment', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Shipment'
);
-$installer->getConnection()->createTable($table);
-
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_shipment_grid'
+ * Create table 'sales_shipment_grid'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_shipment_grid')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_shipment_grid')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2232,62 +2271,62 @@
array(),
'Shipping Name'
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('store_id')),
+ $this->getIdxName('sales_shipment_grid', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('total_qty')),
+ $this->getIdxName('sales_shipment_grid', array('total_qty')),
array('total_qty')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('order_id')),
+ $this->getIdxName('sales_shipment_grid', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('shipment_status')),
+ $this->getIdxName('sales_shipment_grid', array('shipment_status')),
array('shipment_status')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_shipment_grid',
+ $this->getIdxName(
+ 'sales_shipment_grid',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('order_increment_id')),
+ $this->getIdxName('sales_shipment_grid', array('order_increment_id')),
array('order_increment_id')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('created_at')),
+ $this->getIdxName('sales_shipment_grid', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('order_created_at')),
+ $this->getIdxName('sales_shipment_grid', array('order_created_at')),
array('order_created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_grid', array('shipping_name')),
+ $this->getIdxName('sales_shipment_grid', array('shipping_name')),
array('shipping_name')
)->addForeignKey(
- $installer->getFkName('sales_flat_shipment_grid', 'entity_id', 'sales_flat_shipment', 'entity_id'),
+ $this->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'),
'entity_id',
- $installer->getTable('sales_flat_shipment'),
+ $this->getTable('sales_shipment'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_shipment_grid', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Shipment Grid'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_shipment_item'
+ * Create table 'sales_shipment_item'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_shipment_item')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_shipment_item')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2361,26 +2400,26 @@
array(),
'Sku'
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_item', array('parent_id')),
+ $this->getIdxName('sales_shipment_item', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_shipment_item', 'parent_id', 'sales_flat_shipment', 'entity_id'),
+ $this->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_shipment'),
+ $this->getTable('sales_shipment'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Shipment Item'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_shipment_track'
+ * Create table 'sales_shipment_track'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_shipment_track')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_shipment_track')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2448,32 +2487,32 @@
array(),
'Updated At'
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_track', array('parent_id')),
+ $this->getIdxName('sales_shipment_track', array('parent_id')),
array('parent_id')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_track', array('order_id')),
+ $this->getIdxName('sales_shipment_track', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_track', array('created_at')),
+ $this->getIdxName('sales_shipment_track', array('created_at')),
array('created_at')
)->addForeignKey(
- $installer->getFkName('sales_flat_shipment_track', 'parent_id', 'sales_flat_shipment', 'entity_id'),
+ $this->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_shipment'),
+ $this->getTable('sales_shipment'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Shipment Track'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_shipment_comment'
+ * Create table 'sales_shipment_comment'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_shipment_comment')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_shipment_comment')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2511,29 +2550,29 @@
array(),
'Created At'
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_comment', array('created_at')),
+ $this->getIdxName('sales_shipment_comment', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_shipment_comment', array('parent_id')),
+ $this->getIdxName('sales_shipment_comment', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_shipment_comment', 'parent_id', 'sales_flat_shipment', 'entity_id'),
+ $this->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_shipment'),
+ $this->getTable('sales_shipment'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Shipment Comment'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_invoice'
+ * Create table 'sales_invoice'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_invoice')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_invoice')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2792,54 +2831,60 @@
'12,4',
array(),
'Base Total Refunded'
+)->addColumn(
+ 'discount_description',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 255,
+ array(),
+ 'Discount Description'
)->addIndex(
- $installer->getIdxName('sales_flat_invoice', array('store_id')),
+ $this->getIdxName('sales_invoice', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice', array('grand_total')),
+ $this->getIdxName('sales_invoice', array('grand_total')),
array('grand_total')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice', array('order_id')),
+ $this->getIdxName('sales_invoice', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice', array('state')),
+ $this->getIdxName('sales_invoice', array('state')),
array('state')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_invoice',
+ $this->getIdxName(
+ 'sales_invoice',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_invoice', array('created_at')),
+ $this->getIdxName('sales_invoice', array('created_at')),
array('created_at')
)->addForeignKey(
- $installer->getFkName('sales_flat_invoice', 'order_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_invoice', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_invoice', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Invoice'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_invoice_grid'
+ * Create table 'sales_invoice_grid'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_invoice_grid')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_invoice_grid')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2931,62 +2976,62 @@
array(),
'Billing Name'
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('store_id')),
+ $this->getIdxName('sales_invoice_grid', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('grand_total')),
+ $this->getIdxName('sales_invoice_grid', array('grand_total')),
array('grand_total')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('order_id')),
+ $this->getIdxName('sales_invoice_grid', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('state')),
+ $this->getIdxName('sales_invoice_grid', array('state')),
array('state')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_invoice_grid',
+ $this->getIdxName(
+ 'sales_invoice_grid',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('order_increment_id')),
+ $this->getIdxName('sales_invoice_grid', array('order_increment_id')),
array('order_increment_id')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('created_at')),
+ $this->getIdxName('sales_invoice_grid', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('order_created_at')),
+ $this->getIdxName('sales_invoice_grid', array('order_created_at')),
array('order_created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_grid', array('billing_name')),
+ $this->getIdxName('sales_invoice_grid', array('billing_name')),
array('billing_name')
)->addForeignKey(
- $installer->getFkName('sales_flat_invoice_grid', 'entity_id', 'sales_flat_invoice', 'entity_id'),
+ $this->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'),
'entity_id',
- $installer->getTable('sales_flat_invoice'),
+ $this->getTable('sales_invoice'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_invoice_grid', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Invoice Grid'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_invoice_item'
+ * Create table 'sales_invoice_item'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_invoice_item')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_invoice_item')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3132,26 +3177,26 @@
array(),
'Base Hidden Tax Amount'
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_item', array('parent_id')),
+ $this->getIdxName('sales_invoice_item', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_invoice_item', 'parent_id', 'sales_flat_invoice', 'entity_id'),
+ $this->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_invoice'),
+ $this->getTable('sales_invoice'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Invoice Item'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_invoice_comment'
+ * Create table 'sales_invoice_comment'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_invoice_comment')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_invoice_comment')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3189,29 +3234,29 @@
array(),
'Created At'
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_comment', array('created_at')),
+ $this->getIdxName('sales_invoice_comment', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_invoice_comment', array('parent_id')),
+ $this->getIdxName('sales_invoice_comment', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_invoice_comment', 'parent_id', 'sales_flat_invoice', 'entity_id'),
+ $this->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_invoice'),
+ $this->getTable('sales_invoice'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Invoice Comment'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_creditmemo'
+ * Create table 'sales_creditmemo'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_creditmemo')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_creditmemo')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3494,54 +3539,60 @@
'12,4',
array(),
'Base Shipping Incl Tax'
+)->addColumn(
+ 'discount_description',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 255,
+ array(),
+ 'Discount Description'
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo', array('store_id')),
+ $this->getIdxName('sales_creditmemo', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo', array('order_id')),
+ $this->getIdxName('sales_creditmemo', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo', array('creditmemo_status')),
+ $this->getIdxName('sales_creditmemo', array('creditmemo_status')),
array('creditmemo_status')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_creditmemo',
+ $this->getIdxName(
+ 'sales_creditmemo',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo', array('state')),
+ $this->getIdxName('sales_creditmemo', array('state')),
array('state')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo', array('created_at')),
+ $this->getIdxName('sales_creditmemo', array('created_at')),
array('created_at')
)->addForeignKey(
- $installer->getFkName('sales_flat_creditmemo', 'order_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_creditmemo', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Creditmemo'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_creditmemo_grid'
+ * Create table 'sales_creditmemo_grid'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_creditmemo_grid')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_creditmemo_grid')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3669,68 +3720,68 @@
array(),
'Billing Name'
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('store_id')),
+ $this->getIdxName('sales_creditmemo_grid', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('grand_total')),
+ $this->getIdxName('sales_creditmemo_grid', array('grand_total')),
array('grand_total')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('base_grand_total')),
+ $this->getIdxName('sales_creditmemo_grid', array('base_grand_total')),
array('base_grand_total')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('order_id')),
+ $this->getIdxName('sales_creditmemo_grid', array('order_id')),
array('order_id')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('creditmemo_status')),
+ $this->getIdxName('sales_creditmemo_grid', array('creditmemo_status')),
array('creditmemo_status')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('state')),
+ $this->getIdxName('sales_creditmemo_grid', array('state')),
array('state')
)->addIndex(
- $installer->getIdxName(
- 'sales_flat_creditmemo_grid',
+ $this->getIdxName(
+ 'sales_creditmemo_grid',
array('increment_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
),
array('increment_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('order_increment_id')),
+ $this->getIdxName('sales_creditmemo_grid', array('order_increment_id')),
array('order_increment_id')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('created_at')),
+ $this->getIdxName('sales_creditmemo_grid', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('order_created_at')),
+ $this->getIdxName('sales_creditmemo_grid', array('order_created_at')),
array('order_created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_grid', array('billing_name')),
+ $this->getIdxName('sales_creditmemo_grid', array('billing_name')),
array('billing_name')
)->addForeignKey(
- $installer->getFkName('sales_flat_creditmemo_grid', 'entity_id', 'sales_flat_creditmemo', 'entity_id'),
+ $this->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'),
'entity_id',
- $installer->getTable('sales_flat_creditmemo'),
+ $this->getTable('sales_creditmemo'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_creditmemo_grid', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Creditmemo Grid'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_creditmemo_item'
+ * Create table 'sales_creditmemo_item'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_creditmemo_item')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_creditmemo_item')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3876,25 +3927,25 @@
array(),
'Base Hidden Tax Amount'
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_item', array('parent_id')),
+ $this->getIdxName('sales_creditmemo_item', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_creditmemo_item', 'parent_id', 'sales_flat_creditmemo', 'entity_id'),
+ $this->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_creditmemo'),
+ $this->getTable('sales_creditmemo'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Creditmemo Item'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_creditmemo_comment'
+ * Create table 'sales_creditmemo_comment'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_creditmemo_comment')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_creditmemo_comment')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3932,29 +3983,29 @@
array(),
'Created At'
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_comment', array('created_at')),
+ $this->getIdxName('sales_creditmemo_comment', array('created_at')),
array('created_at')
)->addIndex(
- $installer->getIdxName('sales_flat_creditmemo_comment', array('parent_id')),
+ $this->getIdxName('sales_creditmemo_comment', array('parent_id')),
array('parent_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_creditmemo_comment', 'parent_id', 'sales_flat_creditmemo', 'entity_id'),
+ $this->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'),
'parent_id',
- $installer->getTable('sales_flat_creditmemo'),
+ $this->getTable('sales_creditmemo'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Creditmemo Comment'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_quote'
+ * Create table 'sales_quote'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_quote')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_quote')
)->addColumn(
'entity_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -4250,29 +4301,29 @@
array(),
'Ext Shipping Info'
)->addIndex(
- $installer->getIdxName('sales_flat_quote', array('customer_id', 'store_id', 'is_active')),
+ $this->getIdxName('sales_quote', array('customer_id', 'store_id', 'is_active')),
array('customer_id', 'store_id', 'is_active')
)->addIndex(
- $installer->getIdxName('sales_flat_quote', array('store_id')),
+ $this->getIdxName('sales_quote', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_quote', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_quote', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Quote'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_quote_address'
+ * Create table 'sales_quote_address'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_quote_address')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_quote_address')
)->addColumn(
'address_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -4604,26 +4655,26 @@
array(),
'Base Shipping Incl Tax'
)->addIndex(
- $installer->getIdxName('sales_flat_quote_address', array('quote_id')),
+ $this->getIdxName('sales_quote_address', array('quote_id')),
array('quote_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_address', 'quote_id', 'sales_flat_quote', 'entity_id'),
+ $this->getFkName('sales_quote_address', 'quote_id', 'sales_quote', 'entity_id'),
'quote_id',
- $installer->getTable('sales_flat_quote'),
+ $this->getTable('sales_quote'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Quote Address'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_quote_item'
+ * Create table 'sales_quote_item'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_quote_item')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_quote_item')
)->addColumn(
'item_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -4877,55 +4928,55 @@
array(),
'Base Hidden Tax Amount'
)->addIndex(
- $installer->getIdxName('sales_flat_quote_item', array('parent_item_id')),
+ $this->getIdxName('sales_quote_item', array('parent_item_id')),
array('parent_item_id')
)->addIndex(
- $installer->getIdxName('sales_flat_quote_item', array('product_id')),
+ $this->getIdxName('sales_quote_item', array('product_id')),
array('product_id')
)->addIndex(
- $installer->getIdxName('sales_flat_quote_item', array('quote_id')),
+ $this->getIdxName('sales_quote_item', array('quote_id')),
array('quote_id')
)->addIndex(
- $installer->getIdxName('sales_flat_quote_item', array('store_id')),
+ $this->getIdxName('sales_quote_item', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_item', 'parent_item_id', 'sales_flat_quote_item', 'item_id'),
+ $this->getFkName('sales_quote_item', 'parent_item_id', 'sales_quote_item', 'item_id'),
'parent_item_id',
- $installer->getTable('sales_flat_quote_item'),
+ $this->getTable('sales_quote_item'),
'item_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_item', 'product_id', 'catalog_product_entity', 'entity_id'),
+ $this->getFkName('sales_quote_item', 'product_id', 'catalog_product_entity', 'entity_id'),
'product_id',
- $installer->getTable('catalog_product_entity'),
+ $this->getTable('catalog_product_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_item', 'quote_id', 'sales_flat_quote', 'entity_id'),
+ $this->getFkName('sales_quote_item', 'quote_id', 'sales_quote', 'entity_id'),
'quote_id',
- $installer->getTable('sales_flat_quote'),
+ $this->getTable('sales_quote'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_item', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_quote_item', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Quote Item'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_quote_address_item'
+ * Create table 'sales_quote_address_item'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_quote_address_item')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_quote_address_item')
)->addColumn(
'address_item_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5155,56 +5206,56 @@
array(),
'Base Hidden Tax Amount'
)->addIndex(
- $installer->getIdxName('sales_flat_quote_address_item', array('quote_address_id')),
+ $this->getIdxName('sales_quote_address_item', array('quote_address_id')),
array('quote_address_id')
)->addIndex(
- $installer->getIdxName('sales_flat_quote_address_item', array('parent_item_id')),
+ $this->getIdxName('sales_quote_address_item', array('parent_item_id')),
array('parent_item_id')
)->addIndex(
- $installer->getIdxName('sales_flat_quote_address_item', array('quote_item_id')),
+ $this->getIdxName('sales_quote_address_item', array('quote_item_id')),
array('quote_item_id')
)->addForeignKey(
- $installer->getFkName(
- 'sales_flat_quote_address_item',
+ $this->getFkName(
+ 'sales_quote_address_item',
'quote_address_id',
- 'sales_flat_quote_address',
+ 'sales_quote_address',
'address_id'
),
'quote_address_id',
- $installer->getTable('sales_flat_quote_address'),
+ $this->getTable('sales_quote_address'),
'address_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName(
- 'sales_flat_quote_address_item',
+ $this->getFkName(
+ 'sales_quote_address_item',
'parent_item_id',
- 'sales_flat_quote_address_item',
+ 'sales_quote_address_item',
'address_item_id'
),
'parent_item_id',
- $installer->getTable('sales_flat_quote_address_item'),
+ $this->getTable('sales_quote_address_item'),
'address_item_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_address_item', 'quote_item_id', 'sales_flat_quote_item', 'item_id'),
+ $this->getFkName('sales_quote_address_item', 'quote_item_id', 'sales_quote_item', 'item_id'),
'quote_item_id',
- $installer->getTable('sales_flat_quote_item'),
+ $this->getTable('sales_quote_item'),
'item_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Quote Address Item'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_quote_item_option'
+ * Create table 'sales_quote_item_option'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_quote_item_option')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_quote_item_option')
)->addColumn(
'option_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5236,26 +5287,26 @@
array(),
'Value'
)->addIndex(
- $installer->getIdxName('sales_flat_quote_item_option', array('item_id')),
+ $this->getIdxName('sales_quote_item_option', array('item_id')),
array('item_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_item_option', 'item_id', 'sales_flat_quote_item', 'item_id'),
+ $this->getFkName('sales_quote_item_option', 'item_id', 'sales_quote_item', 'item_id'),
'item_id',
- $installer->getTable('sales_flat_quote_item'),
+ $this->getTable('sales_quote_item'),
'item_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Quote Item Option'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_quote_payment'
+ * Create table 'sales_quote_payment'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_quote_payment')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_quote_payment')
)->addColumn(
'payment_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5318,9 +5369,9 @@
'Cc Owner'
)->addColumn(
'cc_exp_month',
- \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
- null,
- array('unsigned' => true, 'default' => '0'),
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 255,
+ array('unsigned' => true, 'default' => null, 'nullable' => true),
'Cc Exp Month'
)->addColumn(
'cc_exp_year',
@@ -5371,26 +5422,26 @@
array(),
'Additional Information'
)->addIndex(
- $installer->getIdxName('sales_flat_quote_payment', array('quote_id')),
+ $this->getIdxName('sales_quote_payment', array('quote_id')),
array('quote_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_payment', 'quote_id', 'sales_flat_quote', 'entity_id'),
+ $this->getFkName('sales_quote_payment', 'quote_id', 'sales_quote', 'entity_id'),
'quote_id',
- $installer->getTable('sales_flat_quote'),
+ $this->getTable('sales_quote'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Quote Payment'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
- * Create table 'sales_flat_quote_shipping_rate'
+ * Create table 'sales_quote_shipping_rate'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_flat_quote_shipping_rate')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_quote_shipping_rate')
)->addColumn(
'rate_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5464,26 +5515,26 @@
array(),
'Method Title'
)->addIndex(
- $installer->getIdxName('sales_flat_quote_shipping_rate', array('address_id')),
+ $this->getIdxName('sales_quote_shipping_rate', array('address_id')),
array('address_id')
)->addForeignKey(
- $installer->getFkName('sales_flat_quote_shipping_rate', 'address_id', 'sales_flat_quote_address', 'address_id'),
+ $this->getFkName('sales_quote_shipping_rate', 'address_id', 'sales_quote_address', 'address_id'),
'address_id',
- $installer->getTable('sales_flat_quote_address'),
+ $this->getTable('sales_quote_address'),
'address_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Flat Quote Shipping Rate'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_invoiced_aggregated'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_invoiced_aggregated')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_invoiced_aggregated')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5539,7 +5590,7 @@
array(),
'Invoiced Not Captured'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_invoiced_aggregated',
array('period', 'store_id', 'order_status'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5547,26 +5598,26 @@
array('period', 'store_id', 'order_status'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_invoiced_aggregated', array('store_id')),
+ $this->getIdxName('sales_invoiced_aggregated', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Invoiced Aggregated'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_invoiced_aggregated_order'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_invoiced_aggregated_order')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_invoiced_aggregated_order')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5622,7 +5673,7 @@
array(),
'Invoiced Not Captured'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_invoiced_aggregated_order',
array('period', 'store_id', 'order_status'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5630,26 +5681,26 @@
array('period', 'store_id', 'order_status'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_invoiced_aggregated_order', array('store_id')),
+ $this->getIdxName('sales_invoiced_aggregated_order', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Invoiced Aggregated Order'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_order_aggregated_created'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_order_aggregated_created')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_aggregated_created')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5771,7 +5822,7 @@
array('nullable' => false, 'default' => '0.0000'),
'Total Discount Amount Actual'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_order_aggregated_created',
array('period', 'store_id', 'order_status'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5779,26 +5830,33 @@
array('period', 'store_id', 'order_status'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_order_aggregated_created', array('store_id')),
+ $this->getIdxName('sales_order_aggregated_created', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Order Aggregated Created'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+$this->getConnection()->createTable(
+ $this->getConnection()->createTableByDdl(
+ $this->getTable('sales_order_aggregated_created'),
+ $this->getTable('sales_order_aggregated_updated')
+ )
+);
/**
* Create table 'sales_payment_transaction'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_payment_transaction')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_payment_transaction')
)->addColumn(
'transaction_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5860,7 +5918,7 @@
array(),
'Created At'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_payment_transaction',
array('order_id', 'payment_id', 'txn_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5868,43 +5926,43 @@
array('order_id', 'payment_id', 'txn_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_payment_transaction', array('parent_id')),
+ $this->getIdxName('sales_payment_transaction', array('parent_id')),
array('parent_id')
)->addIndex(
- $installer->getIdxName('sales_payment_transaction', array('payment_id')),
+ $this->getIdxName('sales_payment_transaction', array('payment_id')),
array('payment_id')
)->addForeignKey(
- $installer->getFkName('sales_payment_transaction', 'order_id', 'sales_flat_order', 'entity_id'),
+ $this->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'),
'order_id',
- $installer->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'),
+ $this->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'),
'parent_id',
- $installer->getTable('sales_payment_transaction'),
+ $this->getTable('sales_payment_transaction'),
'transaction_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_flat_order_payment', 'entity_id'),
+ $this->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'),
'payment_id',
- $installer->getTable('sales_flat_order_payment'),
+ $this->getTable('sales_order_payment'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Payment Transaction'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_refunded_aggregated'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_refunded_aggregated')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_refunded_aggregated')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5954,7 +6012,7 @@
array(),
'Offline Refunded'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_refunded_aggregated',
array('period', 'store_id', 'order_status'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5962,26 +6020,26 @@
array('period', 'store_id', 'order_status'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_refunded_aggregated', array('store_id')),
+ $this->getIdxName('sales_refunded_aggregated', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Refunded Aggregated'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_refunded_aggregated_order'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_refunded_aggregated_order')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_refunded_aggregated_order')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6031,7 +6089,7 @@
array(),
'Offline Refunded'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_refunded_aggregated_order',
array('period', 'store_id', 'order_status'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6039,26 +6097,26 @@
array('period', 'store_id', 'order_status'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_refunded_aggregated_order', array('store_id')),
+ $this->getIdxName('sales_refunded_aggregated_order', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Refunded Aggregated Order'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_shipping_aggregated'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_shipping_aggregated')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_shipping_aggregated')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6108,7 +6166,7 @@
array(),
'Total Shipping Actual'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_shipping_aggregated',
array('period', 'store_id', 'order_status', 'shipping_description'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6116,26 +6174,26 @@
array('period', 'store_id', 'order_status', 'shipping_description'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_shipping_aggregated', array('store_id')),
+ $this->getIdxName('sales_shipping_aggregated', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Shipping Aggregated'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_shipping_aggregated_order'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_shipping_aggregated_order')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_shipping_aggregated_order')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6185,7 +6243,7 @@
array(),
'Total Shipping Actual'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_shipping_aggregated_order',
array('period', 'store_id', 'order_status', 'shipping_description'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6193,26 +6251,26 @@
array('period', 'store_id', 'order_status', 'shipping_description'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_shipping_aggregated_order', array('store_id')),
+ $this->getIdxName('sales_shipping_aggregated_order', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Shipping Aggregated Order'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_bestsellers_aggregated_daily'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_bestsellers_aggregated_daily')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_bestsellers_aggregated_daily')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6262,7 +6320,7 @@
array('unsigned' => true, 'nullable' => false, 'default' => '0'),
'Rating Pos'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_bestsellers_aggregated_daily',
array('period', 'store_id', 'product_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6270,36 +6328,36 @@
array('period', 'store_id', 'product_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_bestsellers_aggregated_daily', array('store_id')),
+ $this->getIdxName('sales_bestsellers_aggregated_daily', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_bestsellers_aggregated_daily', array('product_id')),
+ $this->getIdxName('sales_bestsellers_aggregated_daily', array('product_id')),
array('product_id')
)->addForeignKey(
- $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'),
+ $this->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'),
'product_id',
- $installer->getTable('catalog_product_entity'),
+ $this->getTable('catalog_product_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Bestsellers Aggregated Daily'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_bestsellers_aggregated_monthly'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_bestsellers_aggregated_monthly')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_bestsellers_aggregated_monthly')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6349,7 +6407,7 @@
array('unsigned' => true, 'nullable' => false, 'default' => '0'),
'Rating Pos'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_bestsellers_aggregated_monthly',
array('period', 'store_id', 'product_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6357,35 +6415,35 @@
array('period', 'store_id', 'product_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_bestsellers_aggregated_monthly', array('store_id')),
+ $this->getIdxName('sales_bestsellers_aggregated_monthly', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_bestsellers_aggregated_monthly', array('product_id')),
+ $this->getIdxName('sales_bestsellers_aggregated_monthly', array('product_id')),
array('product_id')
)->addForeignKey(
- $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'),
+ $this->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'),
'product_id',
- $installer->getTable('catalog_product_entity'),
+ $this->getTable('catalog_product_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Bestsellers Aggregated Monthly'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_bestsellers_aggregated_yearly'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_bestsellers_aggregated_yearly')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_bestsellers_aggregated_yearly')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6435,7 +6493,7 @@
array('unsigned' => true, 'nullable' => false, 'default' => '0'),
'Rating Pos'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'sales_bestsellers_aggregated_yearly',
array('period', 'store_id', 'product_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6443,35 +6501,35 @@
array('period', 'store_id', 'product_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('sales_bestsellers_aggregated_yearly', array('store_id')),
+ $this->getIdxName('sales_bestsellers_aggregated_yearly', array('store_id')),
array('store_id')
)->addIndex(
- $installer->getIdxName('sales_bestsellers_aggregated_yearly', array('product_id')),
+ $this->getIdxName('sales_bestsellers_aggregated_yearly', array('product_id')),
array('product_id')
)->addForeignKey(
- $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'),
+ $this->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'),
'product_id',
- $installer->getTable('catalog_product_entity'),
+ $this->getTable('catalog_product_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Bestsellers Aggregated Yearly'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_order_tax'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_order_tax')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_tax')
)->addColumn(
'tax_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6545,19 +6603,19 @@
array('unsigned' => true, 'nullable' => false, 'default' => '0'),
'Hidden'
)->addIndex(
- $installer->getIdxName('sales_order_tax', array('order_id', 'priority', 'position')),
+ $this->getIdxName('sales_order_tax', array('order_id', 'priority', 'position')),
array('order_id', 'priority', 'position')
)->setComment(
'Sales Order Tax Table'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_order_status'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_order_status')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_status')
)->addColumn(
'status',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -6573,14 +6631,14 @@
)->setComment(
'Sales Order Status Table'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_order_status_state'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_order_status_state')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_status_state')
)->addColumn(
'status',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -6599,24 +6657,29 @@
null,
array('unsigned' => true, 'nullable' => false, 'default' => '0'),
'Is Default'
+)->addColumn(
+ 'visible_on_front',
+ \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+ 1,
+ array('unsigned' => true, 'nullable' => false, 'default' => '0'),
+ 'Visible on front'
)->addForeignKey(
- $installer->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'),
+ $this->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'),
'status',
- $installer->getTable('sales_order_status'),
+ $this->getTable('sales_order_status'),
'status',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Order Status Table'
);
-$installer->getConnection()->createTable($table);
-
+$this->getConnection()->createTable($table);
/**
* Create table 'sales_order_status_label'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('sales_order_status_label')
+$table = $this->getConnection()->newTable(
+ $this->getTable('sales_order_status_label')
)->addColumn(
'status',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -6636,25 +6699,25 @@
array('nullable' => false),
'Label'
)->addIndex(
- $installer->getIdxName('sales_order_status_label', array('store_id')),
+ $this->getIdxName('sales_order_status_label', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'),
+ $this->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'),
'status',
- $installer->getTable('sales_order_status'),
+ $this->getTable('sales_order_status'),
'status',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'),
+ $this->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Sales Order Status Label Table'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
-$installer->endSetup();
+$this->endSetup();
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.0-1.6.0.1.php
deleted file mode 100644
index af18b0bdaa8ee..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.0-1.6.0.1.php
+++ /dev/null
@@ -1,37 +0,0 @@
-getConnection()->addColumn(
- $installer->getTable('sales_flat_order_status_history'),
- 'entity_name',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
- 'length' => 32,
- 'nullable' => true,
- 'comment' => 'Shows what entity history is bind to.'
- )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.1-1.6.0.2.php
deleted file mode 100644
index 252edee3a82c2..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ /dev/null
@@ -1,33 +0,0 @@
-startSetup();
-$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_shipment'),
- 'packages',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'comment' => 'Packed Products in Packages', 'length' => '20000')
-);
-$installer->endSetup();
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.11-1.6.0.12.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.11-1.6.0.12.php
deleted file mode 100644
index 978444e5eee27..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.11-1.6.0.12.php
+++ /dev/null
@@ -1,41 +0,0 @@
-startSetup();
-
-$installer->getConnection()->addColumn(
- $installer->getTable('sales_order_status_state'),
- 'visible_on_front',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
- 'length' => 1,
- 'nullable' => false,
- 'default' => 0,
- 'comment' => 'visible_on_front'
- )
-);
-
-$installer->endSetup();
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php
deleted file mode 100644
index 8d5542163ff7a..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php
+++ /dev/null
@@ -1,37 +0,0 @@
-getConnection();
-$connection->createTable(
- $connection->createTableByDdl(
- $installer->getTable('sales_order_aggregated_created'),
- $installer->getTable('sales_order_aggregated_updated')
- )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.4-1.6.0.5.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.4-1.6.0.5.php
deleted file mode 100644
index a40b49fec9fc0..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.4-1.6.0.5.php
+++ /dev/null
@@ -1,56 +0,0 @@
-getConnection()->addColumn(
- $installer->getTable('sales_flat_order_item'),
- 'base_tax_refunded',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
- 'comment' => 'Base Tax Refunded',
- 'scale' => 4,
- 'precision' => 12
- )
-);
-$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_order_item'),
- 'discount_refunded',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
- 'comment' => 'Discount Refunded',
- 'scale' => 4,
- 'precision' => 12
- )
-);
-$installer->getConnection()->addColumn(
- $installer->getTable('sales_flat_order_item'),
- 'base_discount_refunded',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
- 'comment' => 'Base Discount Refunded',
- 'scale' => 4,
- 'precision' => 12
- )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.6-1.6.0.7.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.6-1.6.0.7.php
deleted file mode 100644
index 14d993e9bc309..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.6-1.6.0.7.php
+++ /dev/null
@@ -1,37 +0,0 @@
-getConnection()->addColumn(
- $installer->getTable('sales_flat_order'),
- 'coupon_rule_name',
- array(
- 'TYPE' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
- 'LENGTH' => 255,
- 'NULLABLE' => true,
- 'COMMENT' => 'Coupon Sales Rule Name'
- )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php
deleted file mode 100644
index fdcdff51c72eb..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php
+++ /dev/null
@@ -1,40 +0,0 @@
-getTable('sales_flat_invoice');
-$installer->getConnection()->addColumn(
- $invoiceTable,
- 'discount_description',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Discount Description')
-);
-
-$creditmemoTable = $installer->getTable('sales_flat_creditmemo');
-$installer->getConnection()->addColumn(
- $creditmemoTable,
- 'discount_description',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Discount Description')
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php
deleted file mode 100644
index b4dbc035aee32..0000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php
+++ /dev/null
@@ -1,51 +0,0 @@
-startSetup();
-
-$installer->getConnection()->modifyColumn(
- $installer->getTable('sales_flat_quote_payment'),
- 'cc_exp_year',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
- 'length' => 255,
- 'nullable' => true,
- 'default' => null,
- 'comment' => 'Cc Exp Year'
- )
-)->modifyColumn(
- $installer->getTable('sales_flat_quote_payment'),
- 'cc_exp_month',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
- 'length' => 255,
- 'nullable' => true,
- 'default' => null,
- 'comment' => 'Cc Exp Month'
- )
-);
-
-$installer->endSetup();
diff --git a/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php b/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php
index 56f6fd5b3b696..7390a72f02455 100644
--- a/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php
+++ b/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php
@@ -69,7 +69,7 @@ protected function _aggregateByOrder($aggregationField, $from, $to)
$this->_checkDates($from, $to);
$table = $this->getMainTable();
- $sourceTable = $this->getTable('sales_flat_order');
+ $sourceTable = $this->getTable('sales_order');
$adapter = $this->_getWriteAdapter();
$adapter->beginTransaction();
diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json
index 56b42d7c447e2..cf6eda03156a8 100644
--- a/app/code/Magento/SalesRule/composer.json
+++ b/app/code/Magento/SalesRule/composer.json
@@ -3,26 +3,26 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-rule": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-reports": "0.1.0-alpha103",
- "magento/module-catalog-rule": "0.1.0-alpha103",
- "magento/module-widget": "0.1.0-alpha103",
- "magento/module-cron": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-rule": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-reports": "0.1.0-alpha104",
+ "magento/module-catalog-rule": "0.1.0-alpha104",
+ "magento/module-widget": "0.1.0-alpha104",
+ "magento/module-cron": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php
rename to app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/SalesRule/etc/module.xml b/app/code/Magento/SalesRule/etc/module.xml
index 64ccddb8b010d..df34f83da4836 100644
--- a/app/code/Magento/SalesRule/etc/module.xml
+++ b/app/code/Magento/SalesRule/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php b/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php
similarity index 66%
rename from app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php
rename to app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php
index 5bdfccba3faef..5b83785602375 100644
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php
+++ b/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php
@@ -22,15 +22,14 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->startSetup();
+/* @var $this \Magento\Framework\Module\Setup */
+$this->startSetup();
/**
* Create table 'salesrule'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('salesrule')
+$table = $this->getConnection()->newTable(
+ $this->getTable('salesrule')
)->addColumn(
'rule_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -53,13 +52,13 @@
'from_date',
\Magento\Framework\DB\Ddl\Table::TYPE_DATE,
null,
- array(),
+ array('nullable' => true, 'default' => null),
'From Date'
)->addColumn(
'to_date',
\Magento\Framework\DB\Ddl\Table::TYPE_DATE,
null,
- array(),
+ array('nullable' => true, 'default' => null),
'To Date'
)->addColumn(
'uses_per_customer',
@@ -157,19 +156,33 @@
null,
array('unsigned' => true, 'nullable' => false, 'default' => '1'),
'Coupon Type'
+)->addColumn(
+ 'use_auto_generation',
+ \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+ null,
+ array('unsigned' => false, 'nullable' => false, 'default' => 0),
+ 'Use Auto Generation'
+)->addColumn(
+ 'uses_per_coupon',
+ \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+ null,
+ array('nullable' => false, 'default' => 0),
+ 'User Per Coupon'
)->addIndex(
- $installer->getIdxName('salesrule', array('is_active', 'sort_order', 'to_date', 'from_date')),
+ $this->getIdxName('salesrule', array('is_active', 'sort_order', 'to_date', 'from_date')),
array('is_active', 'sort_order', 'to_date', 'from_date')
)->setComment(
'Salesrule'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+
/**
* Create table 'salesrule_coupon'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('salesrule_coupon')
+$table = $this->getConnection()->newTable(
+ $this->getTable('salesrule_coupon')
)->addColumn(
'coupon_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -218,8 +231,20 @@
null,
array('unsigned' => true),
'Is Primary'
+)->addColumn(
+ 'created_at',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
+ null,
+ array('nullable' => true),
+ 'Coupon Code Creation Date'
+)->addColumn(
+ 'type',
+ \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+ null,
+ array('nullable' => true, 'default' => 0),
+ 'Coupon Code Type'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'salesrule_coupon',
array('code'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -227,7 +252,7 @@
array('code'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'salesrule_coupon',
array('rule_id', 'is_primary'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -235,25 +260,25 @@
array('rule_id', 'is_primary'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('salesrule_coupon', array('rule_id')),
+ $this->getIdxName('salesrule_coupon', array('rule_id')),
array('rule_id')
)->addForeignKey(
- $installer->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'),
+ $this->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'),
'rule_id',
- $installer->getTable('salesrule'),
+ $this->getTable('salesrule'),
'rule_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Salesrule Coupon'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'salesrule_coupon_usage'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('salesrule_coupon_usage')
+$table = $this->getConnection()->newTable(
+ $this->getTable('salesrule_coupon_usage')
)->addColumn(
'coupon_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -273,32 +298,32 @@
array('unsigned' => true, 'nullable' => false, 'default' => '0'),
'Times Used'
)->addIndex(
- $installer->getIdxName('salesrule_coupon_usage', array('customer_id')),
+ $this->getIdxName('salesrule_coupon_usage', array('customer_id')),
array('customer_id')
)->addForeignKey(
- $installer->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'),
+ $this->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'),
'coupon_id',
- $installer->getTable('salesrule_coupon'),
+ $this->getTable('salesrule_coupon'),
'coupon_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'),
+ $this->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'),
'customer_id',
- $installer->getTable('customer_entity'),
+ $this->getTable('customer_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Salesrule Coupon Usage'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'salesrule_customer'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('salesrule_customer')
+$table = $this->getConnection()->newTable(
+ $this->getTable('salesrule_customer')
)->addColumn(
'rule_customer_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -324,35 +349,35 @@
array('unsigned' => true, 'nullable' => false, 'default' => '0'),
'Times Used'
)->addIndex(
- $installer->getIdxName('salesrule_customer', array('rule_id', 'customer_id')),
+ $this->getIdxName('salesrule_customer', array('rule_id', 'customer_id')),
array('rule_id', 'customer_id')
)->addIndex(
- $installer->getIdxName('salesrule_customer', array('customer_id', 'rule_id')),
+ $this->getIdxName('salesrule_customer', array('customer_id', 'rule_id')),
array('customer_id', 'rule_id')
)->addForeignKey(
- $installer->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'),
+ $this->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'),
'customer_id',
- $installer->getTable('customer_entity'),
+ $this->getTable('customer_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'),
+ $this->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'),
'rule_id',
- $installer->getTable('salesrule'),
+ $this->getTable('salesrule'),
'rule_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Salesrule Customer'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'salesrule_label'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('salesrule_label')
+$table = $this->getConnection()->newTable(
+ $this->getTable('salesrule_label')
)->addColumn(
'label_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -378,7 +403,7 @@
array(),
'Label'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'salesrule_label',
array('rule_id', 'store_id'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -386,32 +411,32 @@
array('rule_id', 'store_id'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('salesrule_label', array('store_id')),
+ $this->getIdxName('salesrule_label', array('store_id')),
array('store_id')
)->addForeignKey(
- $installer->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'),
+ $this->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'),
'rule_id',
- $installer->getTable('salesrule'),
+ $this->getTable('salesrule'),
'rule_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'),
+ $this->getFkName('salesrule_label', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Salesrule Label'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'salesrule_product_attribute'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('salesrule_product_attribute')
+$table = $this->getConnection()->newTable(
+ $this->getTable('salesrule_product_attribute')
)->addColumn(
'rule_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -437,52 +462,52 @@
array('unsigned' => true, 'nullable' => false, 'primary' => true),
'Attribute Id'
)->addIndex(
- $installer->getIdxName('salesrule_product_attribute', array('website_id')),
+ $this->getIdxName('salesrule_product_attribute', array('website_id')),
array('website_id')
)->addIndex(
- $installer->getIdxName('salesrule_product_attribute', array('customer_group_id')),
+ $this->getIdxName('salesrule_product_attribute', array('customer_group_id')),
array('customer_group_id')
)->addIndex(
- $installer->getIdxName('salesrule_product_attribute', array('attribute_id')),
+ $this->getIdxName('salesrule_product_attribute', array('attribute_id')),
array('attribute_id')
)->addForeignKey(
- $installer->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'),
+ $this->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'),
'attribute_id',
- $installer->getTable('eav_attribute'),
+ $this->getTable('eav_attribute'),
'attribute_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
)->addForeignKey(
- $installer->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'),
+ $this->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'),
'customer_group_id',
- $installer->getTable('customer_group'),
+ $this->getTable('customer_group'),
'customer_group_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
)->addForeignKey(
- $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'),
+ $this->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'),
'rule_id',
- $installer->getTable('salesrule'),
+ $this->getTable('salesrule'),
'rule_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
)->addForeignKey(
- $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'),
+ $this->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'),
'website_id',
- $installer->getTable('store_website'),
+ $this->getTable('store_website'),
'website_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
)->setComment(
'Salesrule Product Attribute'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
/**
* Create table 'coupon_aggregated'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('coupon_aggregated')
+$table = $this->getConnection()->newTable(
+ $this->getTable('coupon_aggregated')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -555,8 +580,14 @@
array(12, 4),
array('nullable' => false, 'default' => '0.0000'),
'Total Amount Actual'
+)->addColumn(
+ 'rule_name',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 255,
+ array(),
+ 'Rule Name'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'coupon_aggregated',
array('period', 'store_id', 'order_status', 'coupon_code'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -564,25 +595,35 @@
array('period', 'store_id', 'order_status', 'coupon_code'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('coupon_aggregated', array('store_id')),
+ $this->getIdxName('coupon_aggregated', array('store_id')),
array('store_id')
+)->addIndex(
+ $this->getIdxName('coupon_aggregated', array('rule_name')),
+ array('rule_name')
)->addForeignKey(
- $installer->getFkName('coupon_aggregated', 'store_id', 'store', 'store_id'),
+ $this->getFkName('coupon_aggregated', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Coupon Aggregated'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+$this->getConnection()->createTable(
+ $this->getConnection()->createTableByDdl(
+ $this->getTable('coupon_aggregated'),
+ $this->getTable('coupon_aggregated_updated')
+ )
+);
/**
* Create table 'coupon_aggregated_order'
*/
-$table = $installer->getConnection()->newTable(
- $installer->getTable('coupon_aggregated_order')
+$table = $this->getConnection()->newTable(
+ $this->getTable('coupon_aggregated_order')
)->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -637,8 +678,14 @@
array(12, 4),
array('nullable' => false, 'default' => '0.0000'),
'Total Amount'
+)->addColumn(
+ 'rule_name',
+ \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+ 255,
+ array(),
+ 'Rule Name'
)->addIndex(
- $installer->getIdxName(
+ $this->getIdxName(
'coupon_aggregated_order',
array('period', 'store_id', 'order_status', 'coupon_code'),
\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -646,18 +693,109 @@
array('period', 'store_id', 'order_status', 'coupon_code'),
array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
)->addIndex(
- $installer->getIdxName('coupon_aggregated_order', array('store_id')),
+ $this->getIdxName('coupon_aggregated_order', array('store_id')),
array('store_id')
+)->addIndex(
+ $this->getIdxName('coupon_aggregated_order', array('rule_name')),
+ array('rule_name')
)->addForeignKey(
- $installer->getFkName('coupon_aggregated_order', 'store_id', 'store', 'store_id'),
+ $this->getFkName('coupon_aggregated_order', 'store_id', 'store', 'store_id'),
'store_id',
- $installer->getTable('store'),
+ $this->getTable('store'),
'store_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->setComment(
'Coupon Aggregated Order'
);
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+$websitesTable = $this->getTable('store_website');
+$customerGroupsTable = $this->getTable('customer_group');
+$rulesWebsitesTable = $this->getTable('salesrule_website');
+$rulesCustomerGroupsTable = $this->getTable('salesrule_customer_group');
+
+/**
+ * Create table 'salesrule_website' if not exists. This table will be used instead of
+ * column website_ids of main catalog rules table
+ */
+$table = $this->getConnection()->newTable(
+ $rulesWebsitesTable
+)->addColumn(
+ 'rule_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+ null,
+ array('unsigned' => true, 'nullable' => false, 'primary' => true),
+ 'Rule Id'
+)->addColumn(
+ 'website_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+ null,
+ array('unsigned' => true, 'nullable' => false, 'primary' => true),
+ 'Website Id'
+)->addIndex(
+ $this->getIdxName('salesrule_website', array('website_id')),
+ array('website_id')
+)->addForeignKey(
+ $this->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'),
+ 'rule_id',
+ $this->getTable('salesrule'),
+ 'rule_id',
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+ $this->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'),
+ 'website_id',
+ $websitesTable,
+ 'website_id',
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->setComment(
+ 'Sales Rules To Websites Relations'
+);
+
+$this->getConnection()->createTable($table);
+
+
+/**
+ * Create table 'salesrule_customer_group' if not exists. This table will be used instead of
+ * column customer_group_ids of main catalog rules table
+ */
+$table = $this->getConnection()->newTable(
+ $rulesCustomerGroupsTable
+)->addColumn(
+ 'rule_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+ null,
+ array('unsigned' => true, 'nullable' => false, 'primary' => true),
+ 'Rule Id'
+)->addColumn(
+ 'customer_group_id',
+ \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+ null,
+ array('unsigned' => true, 'nullable' => false, 'primary' => true),
+ 'Customer Group Id'
+)->addIndex(
+ $this->getIdxName('salesrule_customer_group', array('customer_group_id')),
+ array('customer_group_id')
+)->addForeignKey(
+ $this->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'),
+ 'rule_id',
+ $this->getTable('salesrule'),
+ 'rule_id',
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+ $this->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'),
+ 'customer_group_id',
+ $customerGroupsTable,
+ 'customer_group_id',
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+ \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->setComment(
+ 'Sales Rules To Customer Groups Relations'
+);
+
+$this->getConnection()->createTable($table);
-$installer->endSetup();
+$this->endSetup();
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php
deleted file mode 100644
index 656e8b88ef734..0000000000000
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ /dev/null
@@ -1,118 +0,0 @@
-getConnection()->addColumn(
- $installer->getTable('salesrule_coupon'),
- 'created_at',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
- 'comment' => 'Coupon Code Creation Date',
- 'nullable' => false,
- 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT
- )
-);
-
-$installer->getConnection()->addColumn(
- $installer->getTable('salesrule_coupon'),
- 'type',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'comment' => 'Coupon Code Type', 'default' => 0)
-);
-
-$installer->getConnection()->addColumn(
- $installer->getTable('salesrule'),
- 'use_auto_generation',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
- 'comment' => 'Use Auto Generation',
- 'nullable' => false,
- 'default' => 0
- )
-);
-
-$installer->getConnection()->addColumn(
- $installer->getTable('salesrule'),
- 'uses_per_coupon',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
- 'comment' => 'Uses Per Coupon',
- 'nullable' => false,
- 'default' => 0
- )
-);
-
-$installer->getConnection()->addColumn(
- $installer->getTable('coupon_aggregated'),
- 'rule_name',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Rule Name')
-);
-
-$installer->getConnection()->addColumn(
- $installer->getTable('coupon_aggregated_order'),
- 'rule_name',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Rule Name')
-);
-
-$installer->getConnection()->addColumn(
- $installer->getTable('coupon_aggregated_updated'),
- 'rule_name',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Rule Name')
-);
-
-$installer->getConnection()->addIndex(
- $installer->getTable('coupon_aggregated'),
- $installer->getIdxName(
- 'coupon_aggregated',
- array('rule_name'),
- \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
- ),
- array('rule_name'),
- \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-);
-
-$installer->getConnection()->addIndex(
- $installer->getTable('coupon_aggregated_order'),
- $installer->getIdxName(
- 'coupon_aggregated_order',
- array('rule_name'),
- \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
- ),
- array('rule_name'),
- \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-);
-
-$installer->getConnection()->addIndex(
- $installer->getTable('coupon_aggregated_updated'),
- $installer->getIdxName(
- 'coupon_aggregated_updated',
- array('rule_name'),
- \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
- ),
- array('rule_name'),
- \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-);
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php
deleted file mode 100644
index 443d92baa25f7..0000000000000
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php
+++ /dev/null
@@ -1,135 +0,0 @@
-getConnection();
-
-$rulesTable = $installer->getTable('salesrule');
-$websitesTable = $installer->getTable('store_website');
-$customerGroupsTable = $installer->getTable('customer_group');
-$rulesWebsitesTable = $installer->getTable('salesrule_website');
-$rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group');
-
-$installer->startSetup();
-/**
- * Create table 'salesrule_website' if not exists. This table will be used instead of
- * column website_ids of main catalog rules table
- */
-$table = $connection->newTable(
- $rulesWebsitesTable
-)->addColumn(
- 'rule_id',
- \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
- null,
- array('unsigned' => true, 'nullable' => false, 'primary' => true),
- 'Rule Id'
-)->addColumn(
- 'website_id',
- \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
- null,
- array('unsigned' => true, 'nullable' => false, 'primary' => true),
- 'Website Id'
-)->addIndex(
- $installer->getIdxName('salesrule_website', array('website_id')),
- array('website_id')
-)->addForeignKey(
- $installer->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'),
- 'rule_id',
- $rulesTable,
- 'rule_id',
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
- $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'),
- 'website_id',
- $websitesTable,
- 'website_id',
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->setComment(
- 'Sales Rules To Websites Relations'
-);
-
-$connection->createTable($table);
-
-
-/**
- * Create table 'salesrule_customer_group' if not exists. This table will be used instead of
- * column customer_group_ids of main catalog rules table
- */
-$table = $connection->newTable(
- $rulesCustomerGroupsTable
-)->addColumn(
- 'rule_id',
- \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
- null,
- array('unsigned' => true, 'nullable' => false, 'primary' => true),
- 'Rule Id'
-)->addColumn(
- 'customer_group_id',
- \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
- null,
- array('unsigned' => true, 'nullable' => false, 'primary' => true),
- 'Customer Group Id'
-)->addIndex(
- $installer->getIdxName('salesrule_customer_group', array('customer_group_id')),
- array('customer_group_id')
-)->addForeignKey(
- $installer->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'),
- 'rule_id',
- $rulesTable,
- 'rule_id',
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
- $installer->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'),
- 'customer_group_id',
- $customerGroupsTable,
- 'customer_group_id',
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
- \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->setComment(
- 'Sales Rules To Customer Groups Relations'
-);
-
-$connection->createTable($table);
-
-
-/**
- * Change default value to "null" for "from" and "to" dates columns
- */
-$connection->modifyColumn(
- $rulesTable,
- 'from_date',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'default' => null)
-);
-
-$connection->modifyColumn(
- $rulesTable,
- 'to_date',
- array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'default' => null)
-);
-
-$installer->endSetup();
diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json
index 4ceeea36119a9..78765ded878fb 100644
--- a/app/code/Magento/Search/composer.json
+++ b/app/code/Magento/Search/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/framework": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json
index d1b5e5e445dcc..1cf385c9c8487 100644
--- a/app/code/Magento/Sendfriend/composer.json
+++ b/app/code/Magento/Sendfriend/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json
index 7b306b9cec0d8..d785061f50313 100644
--- a/app/code/Magento/Shipping/composer.json
+++ b/app/code/Magento/Shipping/composer.json
@@ -3,23 +3,23 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-contact": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-payment": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-contact": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-payment": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"ext-gd": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Shipping/etc/module.xml b/app/code/Magento/Shipping/etc/module.xml
index 5dec754161d08..621bcec54e4ba 100644
--- a/app/code/Magento/Shipping/etc/module.xml
+++ b/app/code/Magento/Shipping/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json
index 2f74fa2dc411d..ba2752d55e434 100644
--- a/app/code/Magento/Sitemap/composer.json
+++ b/app/code/Magento/Sitemap/composer.json
@@ -3,18 +3,18 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-catalog-url-rewrite": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-catalog-url-rewrite": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json
index a83b62964452f..7cbd9a016d92e 100644
--- a/app/code/Magento/Store/composer.json
+++ b/app/code/Magento/Store/composer.json
@@ -3,14 +3,14 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-ui": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-ui": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php b/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php
index 86dfe45b63095..0ea40e92000c4 100644
--- a/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php
+++ b/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php
@@ -76,7 +76,7 @@ protected function _aggregateByOrder($aggregationField, $from, $to)
try {
if ($from !== null || $to !== null) {
$subSelect = $this->_getTableDateRangeSelect(
- $this->getTable('sales_flat_order'),
+ $this->getTable('sales_order'),
'created_at',
'updated_at',
$from,
@@ -90,7 +90,7 @@ protected function _aggregateByOrder($aggregationField, $from, $to)
// convert dates from UTC to current admin timezone
$periodExpr = $writeAdapter->getDatePartSql(
$this->getStoreTZOffsetQuery(
- array('e' => $this->getTable('sales_flat_order')),
+ array('e' => $this->getTable('sales_order')),
'e.' . $aggregationField,
$from,
$to
@@ -112,7 +112,7 @@ protected function _aggregateByOrder($aggregationField, $from, $to)
array('tax' => $this->getTable('sales_order_tax')),
$columns
)->joinInner(
- array('e' => $this->getTable('sales_flat_order')),
+ array('e' => $this->getTable('sales_order')),
'e.entity_id = tax.order_id',
array()
)->useStraightJoin();
diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php
index f96ecf5e2c1b8..b7ede890920e6 100644
--- a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php
@@ -23,7 +23,7 @@
*/
namespace Magento\Tax\Service\V1\Data\OrderTaxDetails;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -45,13 +45,13 @@ class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
* Initialize dependencies
*
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param AppliedTaxBuilder $appliedTaxBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
AppliedTaxBuilder $appliedTaxBuilder
) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php
index ad33bc878b23d..facd6bbad985e 100644
--- a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php
@@ -26,7 +26,7 @@
use \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTaxBuilder;
use \Magento\Tax\Service\V1\Data\OrderTaxDetails\ItemBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -54,14 +54,14 @@ class OrderTaxDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuil
* Initialize dependencies
*
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param AppliedTaxBuilder $appliedTaxBuilder
* @param ItemBuilder $itemBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
AppliedTaxBuilder $appliedTaxBuilder,
ItemBuilder $itemBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php
index 4606696a56009..63a5db447e998 100644
--- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php
@@ -23,7 +23,7 @@
*/
namespace Magento\Tax\Service\V1\Data\QuoteDetails;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -44,13 +44,13 @@ class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
* Initialize dependencies
*
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
\Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder
) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php
index 3ca8f0b566507..09abb8d738bea 100644
--- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php
@@ -23,7 +23,7 @@
*/
namespace Magento\Tax\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -58,7 +58,7 @@ class QuoteDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
* Initialize dependencies.
*
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param \Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder $itemBuilder
* @param \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder
@@ -66,7 +66,7 @@ class QuoteDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
\Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder $itemBuilder,
\Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder,
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php
index d1a5b4d6b140f..aaaa826b6c754 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php
@@ -24,7 +24,7 @@
namespace Magento\Tax\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\ObjectFactory;
use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -41,14 +41,14 @@ class TaxClassSearchResultsBuilder extends AbstractSearchResultsBuilder
* Constructor
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param TaxClassBuilder $itemObjectBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
SearchCriteriaBuilder $searchCriteriaBuilder,
TaxClassBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php
index 63155d19996a4..de943fb0c4851 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php
@@ -23,7 +23,7 @@
*/
namespace Magento\Tax\Service\V1\Data\TaxDetails;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -44,13 +44,13 @@ class AppliedTaxBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
* Initialize dependencies.
*
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param AppliedTaxRateBuilder $appliedTaxRateBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
AppliedTaxRateBuilder $appliedTaxRateBuilder
) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php
index d61795ea390c4..373ef4f2bc9c2 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php
@@ -23,7 +23,7 @@
*/
namespace Magento\Tax\Service\V1\Data\TaxDetails;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Tax\Service\V1\Data\TaxDetails;
@@ -46,13 +46,13 @@ class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
* Initialize dependencies
*
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param AppliedTaxBuilder $appliedTaxBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
\Magento\Tax\Service\V1\Data\TaxDetails\AppliedTaxBuilder $appliedTaxBuilder
) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php
index 3d52a7ab547e8..e3cb24abf12ef 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php
@@ -24,7 +24,7 @@
namespace Magento\Tax\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
/**
@@ -52,14 +52,14 @@ class TaxDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
* Initialize dependencies
*
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param TaxDetails\AppliedTaxBuilder $appliedTaxBuilder
* @param TaxDetails\ItemBuilder $taxDetailsItemBuilder
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
\Magento\Tax\Service\V1\Data\TaxDetails\AppliedTaxBuilder $appliedTaxBuilder,
\Magento\Tax\Service\V1\Data\TaxDetails\ItemBuilder $taxDetailsItemBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php
index 0a541e6d09e0b..74cae8f7cfa74 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php
@@ -23,7 +23,7 @@
*/
namespace Magento\Tax\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\ObjectFactory;
@@ -52,14 +52,14 @@ class TaxRateBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
* Initialize dependencies.
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param ZipRangeBuilder $zipRangeBuilder
* @param TaxRateTitleBuilder $taxRateTitleBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
ZipRangeBuilder $zipRangeBuilder,
TaxRateTitleBuilder $taxRateTitleBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php
index 47aac3fbd86bc..4f3c71ff40649 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php
@@ -24,7 +24,7 @@
namespace Magento\Tax\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\ObjectFactory;
use Magento\Framework\Api\AbstractSearchResultsBuilder;
@@ -41,14 +41,14 @@ class TaxRateSearchResultsBuilder extends AbstractSearchResultsBuilder
* Constructor
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param TaxRateBuilder $itemObjectBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
SearchCriteriaBuilder $searchCriteriaBuilder,
TaxRateBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php
index 6499999341de4..586ed35f07d64 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php
@@ -24,7 +24,7 @@
namespace Magento\Tax\Service\V1\Data;
use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\ObjectFactory;
@@ -46,13 +46,13 @@ class TaxRuleBuilder extends ExtensibleObjectBuilder
* Initialize dependencies.
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param TaxRateBuilder $taxRateBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
TaxRateBuilder $taxRateBuilder
) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php
index 41c16cbd6fd28..a221af83cf4fa 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php
@@ -24,7 +24,7 @@
namespace Magento\Tax\Service\V1\Data;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\ObjectFactory;
use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -41,14 +41,14 @@ class TaxRuleSearchResultsBuilder extends AbstractSearchResultsBuilder
* Constructor
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param TaxRuleBuilder $itemObjectBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
SearchCriteriaBuilder $searchCriteriaBuilder,
TaxRuleBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json
index 817f2a38a57f1..4bd259aaac0c1 100644
--- a/app/code/Magento/Tax/composer.json
+++ b/app/code/Magento/Tax/composer.json
@@ -3,23 +3,23 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-reports": "0.1.0-alpha103",
- "magento/module-configurable-product": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-reports": "0.1.0-alpha104",
+ "magento/module-configurable-product": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Tax/etc/frontend/di.xml b/app/code/Magento/Tax/etc/frontend/di.xml
new file mode 100644
index 0000000000000..d62eaad35321c
--- /dev/null
+++ b/app/code/Magento/Tax/etc/frontend/di.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+ Magento\Customer\Service\V1\CustomerAddressServiceInterface\Proxy
+ Magento\Customer\Service\V1\CustomerGroupServiceInterface\Proxy
+ Magento\Customer\Service\V1\CustomerAccountServiceInterface\Proxy
+
+
+
diff --git a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php
index 18ef18d6db66c..dc85e2b647afc 100644
--- a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php
@@ -67,9 +67,9 @@
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)->addForeignKey(
- $installer->getFkName('sales_order_tax_item', 'item_id', 'sales_flat_order_item', 'item_id'),
+ $installer->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'),
'item_id',
- $installer->getTable('sales_flat_order_item'),
+ $installer->getTable('sales_order_item'),
'item_id',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
diff --git a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php
index 557166c02d862..7f65a36603a46 100644
--- a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php
+++ b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php
@@ -105,9 +105,9 @@
]
);
$connection->addForeignKey(
- $installer->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_flat_order_item', 'item_id'),
+ $installer->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_order_item', 'item_id'),
$installer->getTable('sales_order_tax_item'),
'associated_item_id',
- $installer->getTable('sales_flat_order_item'),
+ $installer->getTable('sales_order_item'),
'item_id'
);
diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json
index c84e9abf1d8b3..5d463084c6bdb 100644
--- a/app/code/Magento/TaxImportExport/composer.json
+++ b/app/code/Magento/TaxImportExport/composer.json
@@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json
index 6d93b9068ee4d..2e3dd1a6e2ca1 100644
--- a/app/code/Magento/Theme/composer.json
+++ b/app/code/Magento/Theme/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-translation": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-translation": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Theme/etc/di.xml b/app/code/Magento/Theme/etc/di.xml
index 9364431357300..789c64087023c 100644
--- a/app/code/Magento/Theme/etc/di.xml
+++ b/app/code/Magento/Theme/etc/di.xml
@@ -62,7 +62,6 @@
-
Magento\Framework\App\Filesystem\DirectoryList::STATIC_VIEW
diff --git a/app/code/Magento/Theme/etc/module.xml b/app/code/Magento/Theme/etc/module.xml
index 2653ba3715326..0859582a9d7bb 100644
--- a/app/code/Magento/Theme/etc/module.xml
+++ b/app/code/Magento/Theme/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json
index 1ab6d63afbdef..ba56c47708d02 100644
--- a/app/code/Magento/Translation/composer.json
+++ b/app/code/Magento/Translation/composer.json
@@ -3,14 +3,14 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json
index 313b30b38c45d..6e3c827631f05 100644
--- a/app/code/Magento/Ui/composer.json
+++ b/app/code/Magento/Ui/composer.json
@@ -3,13 +3,13 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Ui/etc/module.xml b/app/code/Magento/Ui/etc/module.xml
index d859f136d0a3c..3e1302245a0f0 100644
--- a/app/code/Magento/Ui/etc/module.xml
+++ b/app/code/Magento/Ui/etc/module.xml
@@ -24,14 +24,14 @@
*/
-->
-
+
-
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json
index 81119a2bf5042..d6a7c4e76180e 100644
--- a/app/code/Magento/Ups/composer.json
+++ b/app/code/Magento/Ups/composer.json
@@ -3,18 +3,18 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Ups/etc/module.xml b/app/code/Magento/Ups/etc/module.xml
index ae8aab01ae5f0..22c05c57ca705 100644
--- a/app/code/Magento/Ups/etc/module.xml
+++ b/app/code/Magento/Ups/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php b/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php
index e6f5bd53a667a..906ba7f49f324 100644
--- a/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php
+++ b/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php
@@ -166,7 +166,7 @@ public function execute()
$requestPath = $this->getRequest()->getParam('request_path');
$this->_objectManager->get('Magento\UrlRewrite\Helper\UrlRewrite')->validateRequestPath($requestPath);
- $model->setEntityType($this->getRequest()->getParam('entity_type', self::ENTITY_TYPE_CUSTOM))
+ $model->setEntityType($this->getRequest()->getParam('entity_type') ?: self::ENTITY_TYPE_CUSTOM)
->setRequestPath($requestPath)
->setTargetPath($this->getRequest()->getParam('target_path', $model->getTargetPath()))
->setRedirectType($this->getRequest()->getParam('redirect_type'))
diff --git a/app/code/Magento/UrlRewrite/Controller/Router.php b/app/code/Magento/UrlRewrite/Controller/Router.php
index 255904c15c1f7..28f97eef23c4f 100644
--- a/app/code/Magento/UrlRewrite/Controller/Router.php
+++ b/app/code/Magento/UrlRewrite/Controller/Router.php
@@ -26,6 +26,7 @@
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
use Magento\UrlRewrite\Model\UrlFinderInterface;
use Magento\UrlRewrite\Model\OptionProvider;
+use Magento\UrlRewrite\Controller\Adminhtml\Url\Rewrite;
/**
* UrlRewrite Controller Router
@@ -98,15 +99,30 @@ public function match(\Magento\Framework\App\RequestInterface $request)
return null;
}
- $redirectType = $rewrite->getRedirectType();
- if ($redirectType) {
- return $this->redirect($request, $rewrite->getTargetPath(), $redirectType);
+ if ($rewrite->getRedirectType()) {
+ return $this->processRedirect($request, $rewrite);
}
$request->setPathInfo('/' . $rewrite->getTargetPath());
return $this->actionFactory->create('Magento\Framework\App\Action\Forward', array('request' => $request));
}
+ /**
+ * @param \Magento\Framework\App\RequestInterface $request
+ * @param UrlRewrite $rewrite
+ * @return \Magento\Framework\App\ActionInterface|null
+ */
+ protected function processRedirect($request, $rewrite)
+ {
+ $target = $rewrite->getTargetPath();
+ if ($rewrite->getEntityType() !== Rewrite::ENTITY_TYPE_CUSTOM
+ || ($prefix = substr($target, 0, 6)) !== 'http:/' && $prefix !== 'https:'
+ ) {
+ $target = $this->url->getUrl('', array('_direct' => $target));
+ }
+ return $this->redirect($request, $target, $rewrite->getRedirectType());
+ }
+
/**
* @param \Magento\Framework\App\RequestInterface $request
* @param string $url
@@ -115,7 +131,7 @@ public function match(\Magento\Framework\App\RequestInterface $request)
*/
protected function redirect($request, $url, $code)
{
- $this->response->setRedirect($this->url->getUrl('', array('_direct' => $url)), $code);
+ $this->response->setRedirect($url, $code);
$request->setDispatched(true);
return $this->actionFactory->create('Magento\Framework\App\Action\Redirect', array('request' => $request));
}
@@ -127,11 +143,9 @@ protected function redirect($request, $url, $code)
*/
protected function getRewrite($requestPath, $storeId)
{
- return $this->urlFinder->findOneByData(
- [
- UrlRewrite::REQUEST_PATH => trim($requestPath, '/'),
- UrlRewrite::STORE_ID => $storeId,
- ]
- );
+ return $this->urlFinder->findOneByData([
+ UrlRewrite::REQUEST_PATH => trim($requestPath, '/'),
+ UrlRewrite::STORE_ID => $storeId,
+ ]);
}
}
diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json
index 7d14b5527fd55..e1b7463e28d16 100644
--- a/app/code/Magento/UrlRewrite/composer.json
+++ b/app/code/Magento/UrlRewrite/composer.json
@@ -3,18 +3,18 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-store": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-catalog-url-rewrite": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-cms-url-rewrite": "0.1.0-alpha103",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-catalog-url-rewrite": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-cms-url-rewrite": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json
index 34af5709eb061..543ae1e6ff17b 100644
--- a/app/code/Magento/User/composer.json
+++ b/app/code/Magento/User/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-authorization": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-integration": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-authorization": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-integration": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json
index 414c0721039c0..bff4187f43b38 100644
--- a/app/code/Magento/Usps/composer.json
+++ b/app/code/Magento/Usps/composer.json
@@ -3,19 +3,19 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-shipping": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-shipping": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.0.php b/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.0.php
rename to app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Usps/etc/module.xml b/app/code/Magento/Usps/etc/module.xml
index 8ef5554d20703..da87d12316540 100644
--- a/app/code/Magento/Usps/etc/module.xml
+++ b/app/code/Magento/Usps/etc/module.xml
@@ -24,7 +24,7 @@
*/
-->
-
+
diff --git a/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php b/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php
index 7af9aec600d51..a582647d7ddbb 100644
--- a/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php
+++ b/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php
@@ -29,7 +29,7 @@
use Magento\Framework\ObjectManager\Config as ObjectManagerConfig;
use Magento\Framework\Api\Config\Reader as ServiceConfigReader;
use Magento\Framework\Api\AttributeValue;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Reflection\TypeProcessor;
use Zend\Code\Reflection\ClassReflection;
use Zend\Code\Reflection\MethodReflection;
@@ -55,7 +55,7 @@ class ServiceArgsSerializer
/** @var ServiceConfigReader */
protected $serviceConfigReader;
- /** @var AttributeValueBuilder */
+ /** @var AttributeDataBuilder */
protected $attributeValueBuilder;
/**
@@ -64,13 +64,13 @@ class ServiceArgsSerializer
* @param TypeProcessor $typeProcessor
* @param DataBuilderFactory $builderFactory
* @param ServiceConfigReader $serviceConfigReader
- * @param AttributeValueBuilder $attributeValueBuilder
+ * @param AttributeDataBuilder $attributeValueBuilder
*/
public function __construct(
TypeProcessor $typeProcessor,
DataBuilderFactory $builderFactory,
ServiceConfigReader $serviceConfigReader,
- AttributeValueBuilder $attributeValueBuilder
+ AttributeDataBuilder $attributeValueBuilder
) {
$this->typeProcessor = $typeProcessor;
$this->builderFactory = $builderFactory;
diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json
index 25cede30adf7d..34a208debd1e6 100644
--- a/app/code/Magento/Webapi/composer.json
+++ b/app/code/Magento/Webapi/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-authorization": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-integration": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-user": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-authorization": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-integration": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-user": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php
index fe7afcf1f815e..3a339a0a94b10 100644
--- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php
+++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php
@@ -43,7 +43,6 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price
protected $_directoryHelper;
/**
- * @param \Magento\Framework\Logger $logger
* @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
* @param \Magento\Framework\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Helper\Data $catalogData
@@ -52,7 +51,6 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price
* @param \Magento\Weee\Model\Resource\Attribute\Backend\Weee\Tax $attributeTax
*/
public function __construct(
- \Magento\Framework\Logger $logger,
\Magento\Directory\Model\CurrencyFactory $currencyFactory,
\Magento\Framework\StoreManagerInterface $storeManager,
\Magento\Catalog\Helper\Data $catalogData,
@@ -63,7 +61,7 @@ public function __construct(
$this->_directoryHelper = $directoryHelper;
$this->_storeManager = $storeManager;
$this->_attributeTax = $attributeTax;
- parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config);
+ parent::__construct($currencyFactory, $storeManager, $catalogData, $config);
}
/**
diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json
index d455549da8f50..aa73fea5c9fc6 100644
--- a/app/code/Magento/Weee/composer.json
+++ b/app/code/Magento/Weee/composer.json
@@ -3,21 +3,21 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-tax": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-directory": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-eav": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-bundle": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-tax": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-directory": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-eav": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-bundle": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json
index 7e6a5e30b44a4..4758d09cccf2d 100644
--- a/app/code/Magento/Widget/composer.json
+++ b/app/code/Magento/Widget/composer.json
@@ -3,16 +3,16 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-cms": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-cms": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json
index cd936a1bca3f9..187737e677f4c 100644
--- a/app/code/Magento/Wishlist/composer.json
+++ b/app/code/Magento/Wishlist/composer.json
@@ -3,25 +3,25 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/module-store": "0.1.0-alpha103",
- "magento/module-customer": "0.1.0-alpha103",
- "magento/module-catalog": "0.1.0-alpha103",
- "magento/module-core": "0.1.0-alpha103",
- "magento/module-checkout": "0.1.0-alpha103",
- "magento/module-theme": "0.1.0-alpha103",
- "magento/module-catalog-inventory": "0.1.0-alpha103",
- "magento/module-rss": "0.1.0-alpha103",
- "magento/module-backend": "0.1.0-alpha103",
- "magento/module-bundle": "0.1.0-alpha103",
- "magento/module-sales": "0.1.0-alpha103",
- "magento/module-grouped-product": "0.1.0-alpha103",
- "magento/module-configurable-product": "0.1.0-alpha103",
- "magento/module-downloadable": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/module-store": "0.1.0-alpha104",
+ "magento/module-customer": "0.1.0-alpha104",
+ "magento/module-catalog": "0.1.0-alpha104",
+ "magento/module-core": "0.1.0-alpha104",
+ "magento/module-checkout": "0.1.0-alpha104",
+ "magento/module-theme": "0.1.0-alpha104",
+ "magento/module-catalog-inventory": "0.1.0-alpha104",
+ "magento/module-rss": "0.1.0-alpha104",
+ "magento/module-backend": "0.1.0-alpha104",
+ "magento/module-bundle": "0.1.0-alpha104",
+ "magento/module-sales": "0.1.0-alpha104",
+ "magento/module-grouped-product": "0.1.0-alpha104",
+ "magento/module-configurable-product": "0.1.0-alpha104",
+ "magento/module-downloadable": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json
index ef648d9f8788d..c54a869c01b17 100644
--- a/app/design/adminhtml/Magento/backend/composer.json
+++ b/app/design/adminhtml/Magento/backend/composer.json
@@ -3,11 +3,11 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-theme",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/design/adminhtml/Magento/backend/theme.xml b/app/design/adminhtml/Magento/backend/theme.xml
index 480251aaa9d55..d5d8a9cc4caa4 100644
--- a/app/design/adminhtml/Magento/backend/theme.xml
+++ b/app/design/adminhtml/Magento/backend/theme.xml
@@ -24,5 +24,5 @@
-->
Magento 2 backend
- 0.1.0-alpha103
+ 0.1.0-alpha104
diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json
index 08082d03c50e0..70060e31e297a 100644
--- a/app/design/frontend/Magento/blank/composer.json
+++ b/app/design/frontend/Magento/blank/composer.json
@@ -3,11 +3,11 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-theme",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/design/frontend/Magento/blank/theme.xml b/app/design/frontend/Magento/blank/theme.xml
index 777b5718e97b5..cef3f21f04454 100644
--- a/app/design/frontend/Magento/blank/theme.xml
+++ b/app/design/frontend/Magento/blank/theme.xml
@@ -24,7 +24,7 @@
-->
Magento Blank
- 0.1.0-alpha103
+ 0.1.0-alpha104
media/preview.jpg
diff --git a/app/design/frontend/Magento/plushe/composer.json b/app/design/frontend/Magento/plushe/composer.json
index c261261089081..0d2af0efb65bc 100644
--- a/app/design/frontend/Magento/plushe/composer.json
+++ b/app/design/frontend/Magento/plushe/composer.json
@@ -3,12 +3,12 @@
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0",
- "magento/theme-frontend-blank": "0.1.0-alpha103",
- "magento/framework": "0.1.0-alpha103",
+ "magento/theme-frontend-blank": "0.1.0-alpha104",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-theme",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"extra": {
"map": [
[
diff --git a/app/design/frontend/Magento/plushe/theme.xml b/app/design/frontend/Magento/plushe/theme.xml
index 2bafb85bb0e54..812501a26b5b9 100644
--- a/app/design/frontend/Magento/plushe/theme.xml
+++ b/app/design/frontend/Magento/plushe/theme.xml
@@ -24,7 +24,7 @@
-->
Magento Plushe
- 0.1.0-alpha103
+ 0.1.0-alpha104
Magento/blank
media/preview.jpg
diff --git a/app/etc/di.xml b/app/etc/di.xml
index e8440ff4a4b9c..c586ec91283b3 100644
--- a/app/etc/di.xml
+++ b/app/etc/di.xml
@@ -102,7 +102,6 @@
-
diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json
index 04c5fa37ffb56..2f79ba8b3de7c 100644
--- a/app/i18n/magento/de_de/composer.json
+++ b/app/i18n/magento/de_de/composer.json
@@ -1,9 +1,9 @@
{
"name": "magento/language-de_de",
"description": "German (Germany) language",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-language",
diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json
index 2da87721ec061..0bae8cff86b43 100644
--- a/app/i18n/magento/en_us/composer.json
+++ b/app/i18n/magento/en_us/composer.json
@@ -1,9 +1,9 @@
{
"name": "magento/language-en_us",
"description": "English (United States) language",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-language",
diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json
index 2d4801b4d25cf..e8a1d9c61d9b1 100644
--- a/app/i18n/magento/es_es/composer.json
+++ b/app/i18n/magento/es_es/composer.json
@@ -1,9 +1,9 @@
{
"name": "magento/language-es_es",
"description": "Spanish (Spain) language",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-language",
diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json
index dbbea826ea6d3..023ce244a2040 100644
--- a/app/i18n/magento/fr_fr/composer.json
+++ b/app/i18n/magento/fr_fr/composer.json
@@ -1,9 +1,9 @@
{
"name": "magento/language-fr_fr",
"description": "French (France) language",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-language",
diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json
index 7e8220b3a6dfa..2c56e12d90991 100644
--- a/app/i18n/magento/nl_nl/composer.json
+++ b/app/i18n/magento/nl_nl/composer.json
@@ -1,9 +1,9 @@
{
"name": "magento/language-nl_nl",
"description": "Dutch (Netherlands) language",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-language",
diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json
index ea16345b323a6..2aec74a84a6de 100644
--- a/app/i18n/magento/pt_br/composer.json
+++ b/app/i18n/magento/pt_br/composer.json
@@ -1,9 +1,9 @@
{
"name": "magento/language-pt_br",
"description": "Portuguese (Brazil) language",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-language",
diff --git a/app/i18n/magento/zh_cn/composer.json b/app/i18n/magento/zh_cn/composer.json
index 38e1cdcc02390..49e9b73e80c33 100644
--- a/app/i18n/magento/zh_cn/composer.json
+++ b/app/i18n/magento/zh_cn/composer.json
@@ -1,9 +1,9 @@
{
"name": "magento/language-zh_cn",
"description": "Chinese (China) language",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
- "magento/framework": "0.1.0-alpha103",
+ "magento/framework": "0.1.0-alpha104",
"magento/magento-composer-installer": "*"
},
"type": "magento2-language",
diff --git a/composer.json b/composer.json
index 6e91b7b16ccb4..5429b05db8f92 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "magento/project-community-edition",
"description": "Magento project (Community Edition)",
"type": "project",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
"php": "~5.4.11|~5.5.0",
"zendframework/zend-stdlib": "2.0.3"
diff --git a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php
index ad185157e020d..5175c113edc7f 100644
--- a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php
+++ b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php
@@ -52,6 +52,8 @@
* [Subtotal|is|100]
* {Product attribute combination|NOT FOUND|ANY:[[Attribute Set|is|Default][Attribute Set|is|Default]]}
* ]}
+ *
+ * @SuppressWarnings(PHPMD.TooManyFields)
*/
class ConditionsElement extends AbstractElement
{
@@ -178,6 +180,13 @@ class ConditionsElement extends AbstractElement
*/
protected $chooserGridLocator = 'div[id*=chooser]';
+ /**
+ * Rule param input selector.
+ *
+ * @var string
+ */
+ protected $ruleParamInput = '.element [name^="rule[conditions]"]';
+
/**
* Set value to conditions
*
@@ -247,6 +256,13 @@ protected function addSingleCondition($condition, Element $context)
$newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH);
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
+ $typeNew = $this->typeNew;
+ $newCondition->waitUntil(
+ function () use ($newCondition, $typeNew) {
+ $element = $newCondition->find($typeNew, Locator::SELECTOR_XPATH, 'select');
+ return $element->isVisible() ? true : null;
+ }
+ );
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select')->setValue($condition['type']);
$this->ruleParamWait();
@@ -282,7 +298,13 @@ protected function fillCondition(array $rules, Element $element)
$grid->searchAndSelect([$chooserConfig[1] => $rule]);
continue;
}
-
+ $input = $this->ruleParamInput;
+ $param->waitUntil(
+ function () use ($param, $input) {
+ $element = $param->find($input);
+ return $element->isVisible() ? true : null;
+ }
+ );
$value = $param->find('select', Locator::SELECTOR_CSS, 'select');
if ($value->isVisible()) {
$value->setValue($rule);
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php
index 2b95d3fe47086..7a6dd546e3b08 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php
@@ -41,7 +41,7 @@ class View extends \Magento\Catalog\Test\Block\Product\View
*
* @var string
*/
- protected $customizeButton = '.action.primary.customize';
+ protected $customizeButton = '.action.primary.customize span';
/**
* Bundle options block
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php
index 1da8099492b0e..2e8991f6228cb 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php
@@ -67,10 +67,10 @@ public function processAssert(Browser $browser, CatalogProductView $catalogProdu
{
//Open product view page
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
- $viewBlock = $catalogProductView->getViewBlock();
+ $viewBlock = $catalogProductView->getBundleViewBlock();
$viewBlock->clickCustomize();
//Process assertions
- $this->assertPrice($product, $catalogProductView);
+ $this->assertPrice($product, $viewBlock);
}
}
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml
index 470c1a0e668ed..5db58f896ee23 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml
@@ -32,5 +32,10 @@
+
+ Magento\Bundle\Test\Block\Catalog\Product\View
+ #maincontent
+ css selector
+
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php
index 57103046af369..eb34fb40c5bb4 100755
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php
@@ -110,7 +110,7 @@ protected function assertOnCategory($product)
$productListBlock = $categoryPage->getListProductBlock();
$this->assertTrue(
$productListBlock->isProductVisible($product->getName()),
- 'Product "' . $product->getName() . '" is absent on category page'
+ 'Product "' . $product->getName() . '" is absent on category page'
);
$productListBlock->openProductViewPage($product->getName());
//Verification on product detail page
@@ -123,9 +123,8 @@ protected function assertOnCategory($product)
'price_to' => $productViewBlock->getPriceBlock()->getPriceTo()
]
);
-
- $actualOptions = $productPage->getViewBlock()->getOptions($product)['bundle_options'];
$expectedOptions = $product->getBundleOptions();
+ $actualOptions = $productViewBlock->getOptions($product)['bundle_options'];
foreach ($actualOptions as $key => $actualOption) {
$this->assertContains($expectedOptions[$key]['title'], $actualOption);
}
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php
index 26025de223c91..c73f0f00befa7 100755
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php
@@ -120,9 +120,8 @@ protected function assertOnCategory($product)
'price_to' => $productViewBlock->getPriceBlock()->getPriceTo()
]
);
-
- $actualOptions = $productPage->getViewBlock()->getOptions($product)['bundle_options'];
$expectedOptions = $product->getBundleOptions();
+ $actualOptions = $productViewBlock->getOptions($product)['bundle_options'];
foreach ($actualOptions as $key => $actualOption) {
$this->assertContains($expectedOptions[$key]['title'], $actualOption);
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php
index 822ecf09c9445..28c58e9412778 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php
@@ -52,7 +52,7 @@ class CategoryIds extends MultisuggestElement
*
* @var string
*/
- protected $top = './ancestor::body//form[@data-form="edit-product"]';
+ protected $top = './ancestor::body//*[@class="page-main-actions"]';
/**
* Set value
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php
index c61f192582b14..dd80ac49d838f 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php
@@ -25,6 +25,7 @@
namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\ProductDetails;
use Mtf\Client\Driver\Selenium\Element;
+use Mtf\Client\Element\Locator;
/**
* Class ProductOnlineSwitcher
@@ -39,6 +40,13 @@ class ProductOnlineSwitcher extends Element
*/
protected $onlineSwitcher = '#product-online-switcher%s + [for="product-online-switcher"]';
+ /**
+ * Selector for top page click.
+ *
+ * @var string
+ */
+ protected $topPage = './ancestor::body//*[@class="page-main-actions"]';
+
/**
* Set value
*
@@ -56,6 +64,7 @@ public function setValue($value)
&& $this->find(sprintf($this->onlineSwitcher, ':not(:checked)'))->isVisible()
)
) {
+ $this->find($this->topPage, Locator::SELECTOR_XPATH)->click();
$this->find(sprintf($this->onlineSwitcher, ''))->click();
}
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php
index b056a546fb3ca..976a8e13c968a 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php
@@ -25,6 +25,8 @@
namespace Magento\Catalog\Test\Block\Category;
use Mtf\Block\Block;
+use Mtf\Client\Element\Locator;
+use Magento\Widget\Test\Fixture\Widget;
/**
* Class View
@@ -32,6 +34,13 @@
*/
class View extends Block
{
+ /**
+ * Recently Viewed Products selectors
+ *
+ * @var string
+ */
+ protected $recentlyViewedProducts = './/*[contains(@class,"widget")]//strong[@class="product-item-name"]';
+
/**
* Description CSS selector
*
@@ -39,6 +48,13 @@ class View extends Block
*/
protected $description = '.category-description';
+ /**
+ * Locator for category content
+ *
+ * @var string
+ */
+ protected $content = '.category-cms';
+
/**
* Get description
*
@@ -56,6 +72,23 @@ public function getDescription()
*/
public function getContent()
{
- return $this->_rootElement->getText();
+ return $this->_rootElement->find($this->content)->getText();
+ }
+
+ /**
+ * Get products from Recently Viewed block
+ *
+ * @return array
+ */
+ public function getProductsFromRecentlyViewedBlock()
+ {
+ $products = [];
+ $this->waitForElementVisible($this->recentlyViewedProducts, Locator::SELECTOR_XPATH);
+ $productNames = $this->_rootElement->find($this->recentlyViewedProducts, Locator::SELECTOR_XPATH)
+ ->getElements();
+ foreach ($productNames as $productName) {
+ $products[] = $productName->getText();
+ }
+ return $products;
}
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
index bc2fd6057cd6a..f98b1418d44f0 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
@@ -60,5 +60,10 @@
#maincontent
css selector
+
+ Magento\Widget\Test\Block\WidgetView
+ .widget
+ css selector
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml
index 84b218a68816f..89772195b7d9e 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml
@@ -35,5 +35,10 @@
.page.messages .messages
css selector
+
+ Magento\Widget\Test\Block\WidgetView
+ .column.main .widget
+ css selector
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml
index 53b581d68cb2e..3c4c81657aed0 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml
@@ -85,5 +85,10 @@
.page-title h1.title .base
css selector
+
+ Magento\Widget\Test\Block\WidgetView
+ .column.main .widget
+ css selector
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php
index 701b6b754862d..e46a8edc14b20 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php
@@ -27,8 +27,7 @@
use Mtf\Repository\AbstractRepository;
/**
- * Class CatalogProductSimple
- * Data for creation Catalog Product Simple
+ * Data for creation Catalog Product Simple.
*/
class CatalogProductSimple extends AbstractRepository
{
@@ -220,7 +219,7 @@ public function __construct(array $defaultConfig = [], array $defaultData = [])
];
$this->_data['adc_123_simple_for_advancedsearch'] = [
- 'name' => 'adc_123',
+ 'name' => 'adc_123_%isolation%',
'sku' => 'adc_123',
'price' => ['value' => 100.00, 'preset' => '-'],
'tax_class_id' => ['dataSet' => 'None'],
@@ -268,7 +267,7 @@ public function __construct(array $defaultConfig = [], array $defaultData = [])
];
$this->_data['abc_dfj_simple_for_advancedsearch'] = [
- 'name' => 'abc_dfj',
+ 'name' => 'abc_dfj_%isolation%',
'sku' => 'abc_dfj',
'price' => ['value' => 50.00, 'preset' => '-'],
'tax_class_id' => ['dataSet' => 'Taxable Goods'],
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
index 94b3ec11621c0..8b76fd0bc481c 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
@@ -32,8 +32,7 @@
use Mtf\Handler\Curl as AbstractCurl;
/**
- * Class Curl
- * Create new search term via curl
+ * Create new search term via curl.
*/
class Curl extends AbstractCurl implements CatalogSearchQueryInterface
{
@@ -51,6 +50,13 @@ class Curl extends AbstractCurl implements CatalogSearchQueryInterface
]
];
+ /**
+ * Search term url.
+ *
+ * @var string
+ */
+ protected $url = 'search/term/';
+
/**
* Post request for creating search term
*
@@ -67,13 +73,13 @@ public function persist(FixtureInterface $fixture = null)
}
/**
- * Add new search term
+ * Add new search term.
*
* @param array $data
*/
protected function addNewSearchTerm(array $data)
{
- $url = $_ENV['app_backend_url'] . 'catalog/search/save';
+ $url = $_ENV['app_backend_url'] . $this->url . 'save';
$curl = new BackendDecorator(new CurlTransport(), new Config);
$curl->write(CurlInterface::POST, $url, '1.0', [], $data);
$curl->read();
@@ -81,7 +87,7 @@ protected function addNewSearchTerm(array $data)
}
/**
- * Getting search term id
+ * Getting search term id.
*
* @param string $queryText
* @return int
@@ -90,13 +96,13 @@ protected function addNewSearchTerm(array $data)
protected function getNewSearchTermId($queryText)
{
$filter = base64_encode('search_query=' . $queryText);
- $url = $_ENV['app_backend_url'] . 'catalog/search/index/filter/' . $filter;
+ $url = $_ENV['app_backend_url'] . $this->url . 'index/filter/' . $filter;
$curl = new BackendDecorator(new CurlTransport(), new Config);
$curl->write(CurlInterface::GET, $url, '1.0');
$response = $curl->read();
$curl->close();
- if (!preg_match('#search/edit/id/(\d+)/"#', $response, $matches)) {
+ if (!preg_match('#' . $this->url . 'edit/id/(\d+)/"#', $response, $matches)) {
throw new \Exception('Search term not found in grid!');
}
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml
index 321aea4d757b3..16e72e509a3ac 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml
@@ -23,7 +23,7 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
-
+
+
+ Magento\Widget\Test\Block\WidgetView
+ .widget
+ css selector
+
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php
index 5e2861cf2fce6..887e6b67b1fc6 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php
@@ -31,8 +31,6 @@
use Magento\Catalog\Test\Fixture\CatalogProductSimple;
/**
- * Test Creation for AdvancedSearchEntity
- *
* Test Flow:
* Preconditions:
* 1. Two specific simple product is created(unique sku,name,short/full description, tax class)
@@ -90,7 +88,7 @@ public function __prepare(FixtureFactory $fixtureFactory)
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
- public function testSearch(
+ public function test(
array $products,
CatalogProductSimple $productSearch,
CmsIndex $cmsIndex,
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/testSearch.csv b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/test.csv
similarity index 77%
rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/testSearch.csv
rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/test.csv
index c48e64424e4d6..25bbad9bcc99f 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/testSearch.csv
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/test.csv
@@ -1,13 +1,13 @@
-"products/simple_1";"products/simple_2";"productSearch/data/name";"productSearch/data/sku";"productSearch/data/description";"productSearch/data/short_description";"productSearch/data/price/value/price_from";"productSearch/data/price/value/price_to";"constraint"
-"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;500;"assertAdvancedSearchProductsResult"
-"Yes";"-";"abc";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"-";"Yes";"adc_123";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"abc";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"abc_dfj";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"abc";"full";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"-";"Yes";"-";"-";"dfj_full";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"-";"-";"short";"-";"-";"assertAdvancedSearchProductsResult"
-"-";"-";"-";"-";"-";"dfj_short";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"-";"-";"-";50;50;"assertAdvancedSearchProductsResult"
-"Yes";"Yes";"-";"-";"-";"-";"-";100;"assertAdvancedSearchProductsResult"
-"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;50;"assertAdvancedSearchProductsResult"
+"products/simple_1";"products/simple_2";"productSearch/data/name";"productSearch/data/sku";"productSearch/data/description";"productSearch/data/short_description";"productSearch/data/price/value/price_from";"productSearch/data/price/value/price_to";"constraint";"issue"
+"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;500;"assertAdvancedSearchProductsResult";""
+"Yes";"-";"abc";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"-";"Yes";"adc_123";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"abc";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"abc_dfj";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"abc";"full";"-";"-";"-";"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"-";"Yes";"-";"-";"dfj_full";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"-";"-";"short";"-";"-";"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"-";"-";"-";"-";"-";"dfj_short";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"-";"-";"-";50;50;"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"Yes";"Yes";"-";"-";"-";"-";"-";100;"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;50;"assertAdvancedSearchProductsResult";"MAGETWO-30318"
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
index 28764fb922a27..c7e90bce0d3be 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
@@ -1,2 +1,2 @@
"searchTerm/data/query_text/value";"searchTerm/data/store_id";"searchTerm/data/num_results";"searchTerm/data/popularity";"searchTerm/data/synonym_for";"searchTerm/data/redirect";"searchTerm/data/display_in_terms";"constraint"
-"catalogProductSimple::getSku";"Main Website/Main Website Store/Default Store View";1;20;"simple";"http://example.com/";"No";"assertSearchTermSuccessSaveMessage, assertSearchTermForm, assertSearchTermInGrid, assertSearchTermOnFrontend"
+"catalogProductSimple::getSku";"Main Website/Main Website Store/Default Store View";1;20;"simple%isolation%";"http://example.com/";"No";"assertSearchTermSuccessSaveMessage, assertSearchTermForm, assertSearchTermInGrid, assertSearchTermOnFrontend"
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml
index f29d5cfa11273..15e18c204aec3 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml
@@ -30,12 +30,12 @@
adminhtml
- catalog/search/index
+ search/term
Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex
adminhtml
- catalog/search/edit
+ search/term/edit
Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchEdit
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml
index a1a7c4ff0e0e2..7ea1e3ed91304 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml
@@ -26,7 +26,7 @@
flat
- sales_flat_quote
+ sales_quote
Magento\Checkout\Model\Resource\Cart
diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
index 9fa7731d6c207..cbdec15ecfa42 100644
--- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
+++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
@@ -75,5 +75,10 @@
.page.main
css selector
+
+ Magento\Widget\Test\Block\WidgetView
+ .widget
+ css selector
+
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php
index 6f80540e34cc6..66d3da9432b41 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php
@@ -31,7 +31,7 @@
use Mtf\Client\Browser;
/**
- * Assert that deleted products attributes are absent on product page on frontend.
+ * Assert that deleted configurable attributes are absent on product page on frontend.
*/
class AssertConfigurableAttributesAbsentOnProductPage extends AbstractConstraint
{
@@ -43,7 +43,7 @@ class AssertConfigurableAttributesAbsentOnProductPage extends AbstractConstraint
protected $severeness = 'low';
/**
- * Assert that deleted products attributes are absent on product page on frontend.
+ * Assert that deleted configurable attributes are absent on product page on frontend.
*
* @param CatalogProductAttribute[] $deletedProductAttributes
* @param Browser $browser
@@ -64,7 +64,7 @@ public function processAssert(
$attributeLabel = $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertFalse(
isset($pageOptions[$attributeLabel]),
- "Product attribute '$attributeLabel' found on product page on frontend."
+ "Configurable attribute '$attributeLabel' found on product page on frontend."
);
}
}
@@ -76,6 +76,6 @@ public function processAssert(
*/
public function toString()
{
- return "Product attributes are absent on product page on frontend.";
+ return "Configurable attributes are absent on product page on frontend.";
}
}
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php
index 5b89b2d82e783..65194e6d4aad8 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php
@@ -42,7 +42,7 @@ class AssertConfigurableAttributesBlockIsAbsentOnProductPage extends AbstractCon
protected $severeness = 'low';
/**
- * Assert that all products attributes is absent on product page on frontend.
+ * Assert that all configurable attributes is absent on product page on frontend.
*
* @param Browser $browser
* @param CatalogProductView $catalogProductView
@@ -57,7 +57,7 @@ public function processAssert(
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertFalse(
$catalogProductView->getConfigurableAttributesBlock()->isVisible(),
- "Product attributes are present on product page on frontend."
+ "Configurable attributes are present on product page on frontend."
);
}
@@ -68,6 +68,6 @@ public function processAssert(
*/
public function toString()
{
- return "All product attributes are absent on product page on frontend.";
+ return "All configurable attributes are absent on product page on frontend.";
}
}
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
index cd507b550ae6f..d5ac176b9e7dd 100755
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
@@ -66,6 +66,11 @@ class AssertConfigurableProductForm extends AssertProductForm
'is_default',
];
+ /**
+ * Skipped variation matrix field.
+ *
+ * @var array
+ */
protected $skippedVariationMatrixFields = [
'configurable_attribute'
];
diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php b/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php
index 1986caa81afa6..20a3f387be416 100644
--- a/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php
+++ b/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php
@@ -86,9 +86,10 @@ public function run()
foreach ($configData as $configDataSet) {
$config = $this->fixtureFactory->createByCode('configData', ['dataSet' => $configDataSet . $prefix]);
- $config->persist();
-
- $result[] = $config;
+ if ($config->hasData('section')) {
+ $config->persist();
+ $result[] = $config;
+ }
}
return ['config' => $result];
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php
index b379af48b6475..b454ded90eb1f 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php
@@ -27,26 +27,26 @@
use Magento\Customer\Test\Fixture\AddressInjectable;
/**
- * Class Renderer
- * Render output from AddressInjectable fixture according to data format type
+ * Render output from AddressInjectable fixture according to data format type.
*/
class Renderer
{
/**
- * Address format type
+ * Address format type.
*
* @var string
*/
protected $type;
/**
- * AddressInjectable fixture
+ * AddressInjectable fixture.
*
* @var AddressInjectable
*/
protected $address;
/**
+ * @constructor
* @param AddressInjectable $address
* @param string $type
*/
@@ -57,7 +57,7 @@ public function __construct(AddressInjectable $address, $type = null)
}
/**
- * Returns pattern according to address type
+ * Returns pattern according to address type.
*
* @return string
*/
@@ -65,6 +65,12 @@ protected function getPattern()
{
$region = $this->resolveRegion();
switch ($this->type) {
+ case "html":
+ $outputPattern = "{{depend}}{{prefix}} {{/depend}}{{firstname}} {{depend}}{{middlename}} {{/depend}}"
+ . "{{lastname}}{{depend}} {{suffix}}{{/depend}}\n{{depend}}{{company}}\n{{/depend}}{{street}}\n"
+ . "{{city}}, {{{$region}}}, {{postcode}}\n{{country_id}}\n{{depend}}T: {{telephone}}{{/depend}}"
+ . "{{depend}}\nF: {{fax}}{{/depend}}{{depend}}\nVAT: {{vat_id}}{{/depend}}";
+ break;
case "oneline":
default:
$outputPattern = "{{depend}}{{prefix}} {{/depend}}{{firstname}} {{depend}}{{middlename}} {{/depend}}"
@@ -76,7 +82,7 @@ protected function getPattern()
}
/**
- * Render address according to format type
+ * Render address according to format type.
*
* @return string
*/
@@ -85,18 +91,18 @@ public function render()
$outputPattern = $this->getPattern();
$fields = $this->getFieldsArray($outputPattern);
$output = $this->preparePattern();
+ $output = str_replace(['{{depend}}', '{{/depend}}', '{', '}'], '', $output);
foreach ($fields as $field) {
$data = $this->address->getData($field);
$output = str_replace($field, $data, $output);
}
- $output = str_replace(['{', '}'], '', $output);
return $output;
}
/**
- * Get an array of necessary fields from pattern
+ * Get an array of necessary fields from pattern.
*
* @param string $outputPattern
* @return mixed
@@ -114,14 +120,14 @@ protected function getFieldsArray($outputPattern)
}
/**
- * Purge fields from pattern which are not present in fixture
+ * Purge fields from pattern which are not present in fixture.
*
* @return string
*/
protected function preparePattern()
{
$outputPattern = $this->getPattern();
- preg_match_all('@\{\{depend\}\}(.*?)\{\{.depend\}\}@', $outputPattern, $matches);
+ preg_match_all('@\{\{depend\}\}(.*?)\{\{.depend\}\}@siu', $outputPattern, $matches);
foreach ($matches[1] as $key => $dependPart) {
preg_match_all('@\{\{(\w+)\}\}@', $dependPart, $depends);
foreach ($depends[1] as $depend) {
@@ -134,7 +140,7 @@ protected function preparePattern()
}
/**
- * Check necessary field to retrieve according to address country
+ * Check necessary field to retrieve according to address country.
*
* @return string
*/
diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php
index f9b743f4eed21..4852b1a13ca22 100644
--- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php
+++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php
@@ -70,6 +70,16 @@ protected function getPreset($name)
'subtotal' => 22.43
]
],
+ 'default' => [
+ 'options' => [
+ 'links' => [
+ [
+ 'label' => 'link_1',
+ 'value' => 'Yes'
+ ]
+ ],
+ ]
+ ],
];
return isset($presets[$name]) ? $presets[$name] : [];
}
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php
index 5b940aef244af..729d0c845765f 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php
@@ -59,16 +59,16 @@ class AssertGroupedProductInItemsOrderedGrid extends AbstractConstraint
* Assert product was added to Items Ordered grid in customer account on Order creation page backend
*
* @param OrderCreateIndex $orderCreateIndex
- * @param array $entityData
+ * @param array $products
* @throws \Exception
* @return void
*/
- public function processAssert(OrderCreateIndex $orderCreateIndex, array $entityData)
+ public function processAssert(OrderCreateIndex $orderCreateIndex, array $products)
{
- if (!isset($entityData['products'])) {
+ if (empty($products)) {
throw new \Exception("No products");
}
- $data = $this->prepareData($entityData, $orderCreateIndex->getCreateBlock()->getItemsBlock());
+ $data = $this->prepareData($products, $orderCreateIndex->getCreateBlock()->getItemsBlock());
\PHPUnit_Framework_Assert::assertEquals(
$data['fixtureData'],
@@ -87,7 +87,7 @@ public function processAssert(OrderCreateIndex $orderCreateIndex, array $entityD
protected function prepareData(array $data, Items $itemsBlock)
{
$fixtureData = [];
- foreach ($data['products'] as $product) {
+ foreach ($data as $product) {
$products = $product->getAssociated()['products'];
foreach ($products as $key => $value) {
$fixtureData[$key]['name'] = $value->getName();
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php
index 7e148cb713012..a998c4bbfb6c6 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php
@@ -25,6 +25,7 @@
namespace Magento\Wishlist\Test\Block\Customer\Wishlist\Items;
use Mtf\Block\Form;
+use Mtf\Client\Element\Locator;
/**
* Class Product
@@ -53,6 +54,13 @@ class Product extends Form
*/
protected $viewDetails = '.details.tooltip';
+ /**
+ * Selector for 'Details block' element
+ *
+ * @var string
+ */
+ protected $detailsBlock = '.product-item-tooltip';
+
/**
* Edit button css selector
*
@@ -74,6 +82,13 @@ class Product extends Form
*/
protected $optionValue = '.tooltip.content .values';
+ /**
+ * Selector for click on footer block
+ *
+ * @var string
+ */
+ protected $footer = './ancestor::body//footer';
+
/**
* Fill item product details
*
@@ -115,11 +130,15 @@ public function getOptions()
{
$viewDetails = $this->_rootElement->find($this->viewDetails);
if ($viewDetails->isVisible()) {
+ $this->_rootElement->find($this->footer, Locator::SELECTOR_XPATH)->click();
$viewDetails->click();
$labels = $this->_rootElement->find($this->optionLabel)->getElements();
$values = $this->_rootElement->find($this->optionValue)->getElements();
$data = [];
foreach ($labels as $key => $label) {
+ if (!$label->isVisible()) {
+ $viewDetails->click();
+ }
$data[] = [
'title' => $label->getText(),
'value' => str_replace('$', '', $values[$key]->getText())
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php
index 2180f8cceb363..9098a42683042 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php
@@ -24,7 +24,7 @@
namespace Magento\Wishlist\Test\Constraint;
-use Mtf\Constraint\AbstractConstraint;
+use Mtf\Constraint\AbstractAssertForm;
use Magento\Cms\Test\Page\CmsIndex;
use Magento\Wishlist\Test\Page\WishlistIndex;
use Mtf\Fixture\FixtureFactory;
@@ -34,7 +34,7 @@
* Class AssertBundleProductDetailsInWishlist
* Assert that the correct option details are displayed on the "View Details" tool tip
*/
-class AssertProductDetailsInWishlist extends AbstractConstraint
+class AssertProductDetailsInWishlist extends AbstractAssertForm
{
/**
* Constraint severeness
@@ -63,11 +63,8 @@ public function processAssert(
$cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]);
$expectedOptions = $cartFixture->getItems()[0]->getData()['options'];
- \PHPUnit_Framework_Assert::assertEquals(
- $expectedOptions,
- $actualOptions,
- "Expected product options are not equal to actual."
- );
+ $errors = $this->verifyData($expectedOptions, $actualOptions);
+ \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
/**
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php
index e41e009f83395..fee9db347116c 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php
@@ -68,6 +68,7 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli
*/
public function test(CustomerInjectable $customer, $products, $qty, Browser $browser)
{
+ $this->markTestIncomplete("Bug: MAGETWO-30097");
// Preconditions
$this->browser = $browser;
$customer->persist();
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php
index e57e3a27546e9..8827034ea7856 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php
@@ -71,6 +71,7 @@ public function __prepare(CustomerInjectable $customer)
*/
public function test(CustomerInjectable $customer, $product)
{
+ $this->markTestIncomplete("Bug: MAGETWO-30097");
// Preconditions
$product = $this->createProducts($product)[0];
$this->loginCustomer($customer);
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php
index 5fd6ded0abec6..7f74f70127c36 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php
@@ -174,6 +174,7 @@ public function test(
CatalogProductSimple $product,
array $sharingInfo
) {
+ $this->markTestIncomplete("Bug: MAGETWO-30105");
//Steps
$this->loginCustomer($customer);
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
index d123affbf99ec..25366065d1a07 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
@@ -36,7 +36,6 @@ protected function setUp()
$catalogProductOption = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
'Magento\Catalog\Model\Product\Option'
);
- $eavConfig = $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false);
$catalogProductType = $this->getMock('Magento\Catalog\Model\Product\Type', array(), array(), '', false);
$eventManager = $this->getMock(
'Magento\Framework\Event\ManagerInterface',
@@ -55,7 +54,7 @@ protected function setUp()
array(
$productFactory,
$catalogProductOption,
- $eavConfig,
+ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config'),
$catalogProductType,
$eventManager,
$coreData,
@@ -304,22 +303,22 @@ public function testGetOrderOptions()
}
/**
+ * @magentoDbIsolation enabled
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDataFixture Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php
*/
public function testBeforeSave()
{
- $this->markTestIncomplete('MAGETWO-9199');
/** @var $product \Magento\Catalog\Model\Product */
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
'Magento\Catalog\Model\Product'
);
$product->load(1);
// fixture
- $product->setData('links_purchased_separately', 'value');
- // this attribute is applicable only for downloadable
+ $product->setData('attribute_with_invalid_applyto', 'value');
$this->_model->beforeSave($product);
$this->assertTrue($product->canAffectOptions());
- $this->assertFalse($product->hasData('links_purchased_separately'));
+ $this->assertFalse($product->hasData('attribute_with_invalid_applyto'));
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php
new file mode 100644
index 0000000000000..6b74da686c06a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php
@@ -0,0 +1,49 @@
+create(
+ 'Magento\Catalog\Model\Resource\Setup',
+ ['resourceName' => 'catalog_setup']
+);
+
+/** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
+$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ 'Magento\Catalog\Model\Resource\Eav\Attribute'
+);
+$attribute->setData(
+ [
+ 'attribute_code' => 'attribute_with_invalid_applyto',
+ 'entity_type_id' => $installer->getEntityTypeId('catalog_product'),
+ 'apply_to' => 'invalid-type',
+ ]
+);
+$attribute->save();
+
+/* Assign attribute to attribute set */
+$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId());
+
+/** @var \Magento\Eav\Model\Config $eavConfig */
+$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config');
+$eavConfig->clear();
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php
new file mode 100644
index 0000000000000..9d659af73d304
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php
@@ -0,0 +1,126 @@
+indexerBuilder = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Indexer\IndexBuilder');
+ $this->resourceRule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Resource\Rule');
+ $this->product = Bootstrap::getObjectManager()->get('Magento\Catalog\Model\Product');
+ }
+
+ /**
+ * @magentoDbIsolation enabled
+ * @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+ * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+ * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ */
+ public function testReindexById()
+ {
+ $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+
+ $this->indexerBuilder->reindexById(1);
+
+ $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+ }
+
+ /**
+ * @magentoDbIsolation enabled
+ * @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+ * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+ * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ */
+ public function testReindexByIds()
+ {
+ $this->prepareProducts();
+
+ $this->indexerBuilder->reindexByIds([
+ $this->product->getId(),
+ $this->productSecond->getId(),
+ $this->productThird->getId()
+ ]);
+
+ $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+ $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, $this->productSecond->getId()));
+ $this->assertFalse($this->resourceRule->getRulePrice(true, 1, 1, $this->productThird->getId()));
+ }
+
+ /**
+ * @magentoDbIsolation enabled
+ * @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+ * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+ * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ */
+ public function testReindexFull()
+ {
+ $this->prepareProducts();
+
+ $this->indexerBuilder->reindexFull();
+
+ $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+ $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, $this->productSecond->getId()));
+ $this->assertFalse($this->resourceRule->getRulePrice(true, 1, 1, $this->productThird->getId()));
+ }
+
+ protected function prepareProducts()
+ {
+ $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+ $this->productSecond = clone $this->product;
+ $this->productSecond->setId(null)->save();
+ $this->productThird = clone $this->product;
+ $this->productThird->setId(null)->setData('test_attribute', 'NO_test_attribute_value')->save();
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/ProductRuleTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/ProductRuleTest.php
new file mode 100644
index 0000000000000..ebab141b58e8b
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/ProductRuleTest.php
@@ -0,0 +1,65 @@
+resourceRule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Resource\Rule');
+ $this->product = Bootstrap::getObjectManager()->get('Magento\Catalog\Model\Product');
+
+ Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor')
+ ->getIndexer()->isScheduled(false);
+ }
+
+ /**
+ * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+ * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+ * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoAppArea adminhtml
+ */
+ public function testReindexAfterSuitableProductSaving()
+ {
+ $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+
+ $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php
new file mode 100644
index 0000000000000..799fccbb78a5b
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php
@@ -0,0 +1,76 @@
+indexBuilder = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Indexer\IndexBuilder');
+ $this->resourceRule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Resource\Rule');
+ $this->product = Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product');
+ }
+
+ /**
+ * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+ * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ */
+ public function testReindexAfterRuleCreation()
+ {
+ $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+ $this->assertFalse($this->resourceRule->getRulePrice(true, 1, 1, 1));
+
+ $this->saveRule();
+ // apply all rules
+ $this->indexBuilder->reindexFull();
+
+ $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+ }
+
+ protected function saveRule()
+ {
+ require 'Magento/CatalogRule/_files/rule_by_attribute.php';
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php
new file mode 100644
index 0000000000000..5b556d27b0a0d
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php
@@ -0,0 +1,53 @@
+create(
+ 'Magento\Catalog\Model\Resource\Setup',
+ array('resourceName' => 'catalog_setup')
+);
+
+/** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
+$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ 'Magento\Catalog\Model\Resource\Eav\Attribute'
+);
+$attribute->setData(
+ [
+ 'attribute_code' => 'test_attribute',
+ 'entity_type_id' => $installer->getEntityTypeId('catalog_product'),
+ 'is_global' => 1,
+ 'is_user_defined' => 1,
+ 'frontend_input' => 'text',
+ 'is_used_for_promo_rules' => 1,
+ 'backend_type' => 'text',
+ ]
+);
+$attribute->save();
+
+/* Assign attribute to attribute set */
+$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId());
+
+/** @var \Magento\Eav\Model\Config $eavConfig */
+$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config');
+$eavConfig->clear();
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php
index 15605cd20c425..9487109503c87 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php
@@ -39,4 +39,7 @@
->setSimpleAction('by_percent')
->save();
-$catalogRule->applyAll();
+/** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */
+$indexBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get('Magento\CatalogRule\Model\Indexer\IndexBuilder');
+$indexBuilder->reindexFull();
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_attribute.php
similarity index 50%
rename from app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php
rename to dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_attribute.php
index 03fdc17f2ead9..ec66b7c44adf0 100644
--- a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_attribute.php
@@ -22,16 +22,32 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
+use Magento\TestFramework\Helper\Bootstrap;
-$installer->getConnection()
- ->addColumn(
- $installer->getTable('paypal_settlement_report_row'),
- 'store_id',
- array(
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
- 'comment' => 'Store ID',
- 'length' => '50'
- )
- );
+/** @var \Magento\CatalogRule\Model\Rule $rule */
+$rule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\RuleFactory')->create();
+$rule->loadPost([
+ 'name' => 'test_rule',
+ 'is_active' => '1',
+ 'website_ids' => [1],
+ 'customer_group_ids' => [0, 1],
+ 'discount_amount' => 2,
+ 'simple_action' => 'by_percent',
+ 'from_date' => '',
+ 'to_date' => '',
+ 'conditions' => [
+ '1' => [
+ 'type' => 'Magento\CatalogRule\Model\Rule\Condition\Combine',
+ 'aggregator' => 'all',
+ 'value' => '1',
+ 'new_child' => '',
+ ],
+ '1--1' => [
+ 'type' => 'Magento\CatalogRule\Model\Rule\Condition\Product',
+ 'attribute' => 'test_attribute',
+ 'operator' => '==',
+ 'value' => 'test_attribute_value',
+ ],
+ ],
+]);
+$rule->save();
diff --git a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.11-1.6.0.12.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/IndexTest.php
similarity index 64%
rename from app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.11-1.6.0.12.php
rename to dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/IndexTest.php
index d63f241effcc6..823151c6920e6 100644
--- a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.11-1.6.0.12.php
+++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/IndexTest.php
@@ -22,17 +22,16 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-/** @var $installer \Magento\Sales\Model\Resource\Setup */
-$installer = $this;
-$installer->startSetup();
+namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
-/** Update visibility for states */
-$states = array('new', 'processing', 'complete', 'closed', 'canceled', 'holded', 'payment_review');
-foreach ($states as $state) {
- $installer->getConnection()->update(
- $installer->getTable('sales_order_status_state'),
- array('visible_on_front' => 1),
- array('state = ?' => $state)
- );
+class IndexTest extends \Magento\Backend\Utility\Controller
+{
+ public function testViewAction()
+ {
+ $this->dispatch('backend/cms/wysiwyg_images/index/target_element_id/page_content/store/undefined/type/image/');
+ $content = $this->getResponse()->getBody();
+ $this->assertNotContains('assertNotContains('assertNotContains('endSetup();
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php
index ae1c4fec817d6..64b2c874e4da7 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php
@@ -65,4 +65,11 @@ public function testToHtmlRequired()
$this->assertContains('title="Tax/VAT number"', $block->toHtml());
$this->assertContains('required', $block->toHtml());
}
+
+ protected function tearDown()
+ {
+ /** @var \Magento\Eav\Model\Config $eavConfig */
+ $eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config');
+ $eavConfig->clear();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
index 13d9a87450e0a..49faea05afa75 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
@@ -94,7 +94,9 @@ public function testFormPostAction()
'postcode' => '55555',
'country_id' => 'UA',
'success_url' => '',
- 'error_url' => ''
+ 'error_url' => '',
+ 'default_billing' => true,
+ 'default_shipping' => true
)
);
// we are overwriting the address coming from the fixture
@@ -112,6 +114,8 @@ public function testFormPostAction()
$this->assertEquals('UA', $address->getCountryId());
$this->assertEquals('Kyiv', $address->getCity());
$this->assertEquals('Kiev', $address->getRegion()->getRegion());
+ $this->assertTrue($address->isDefaultBilling());
+ $this->assertTrue($address->isDefaultShipping());
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
index 46ca6c183565f..d8203c9d0a59f 100755
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
@@ -25,11 +25,14 @@
namespace Magento\Customer\Model;
use Magento\Customer\Api\AccountManagementInterface;
+use Magento\Customer\Api\AddressRepositoryInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;
+use Magento\Customer\Api\Data\AddressInterface;
use Magento\Customer\Service\V1;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\State\ExpiredException;
+use Magento\Framework\Reflection\DataObjectProcessor;
use Magento\TestFramework\Helper\Bootstrap;
/**
@@ -48,8 +51,8 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
/** @var CustomerRepositoryInterface */
private $customerRepository;
- /** @var CustomerAddressServiceInterface needed to setup tests */
- private $_customerAddressService;
+ /** @var AddressRepositoryInterface needed to setup tests */
+ private $addressRepository;
/** @var \Magento\Framework\ObjectManager */
private $objectManager;
@@ -63,6 +66,9 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Customer\Api\Data\CustomerDataBuilder */
private $customerBuilder;
+ /** @var DataObjectProcessor */
+ private $dataProcessor;
+
protected function setUp()
{
$this->objectManager = Bootstrap::getObjectManager();
@@ -70,20 +76,21 @@ protected function setUp()
->create('Magento\Customer\Api\AccountManagementInterface');
$this->customerRepository = $this->objectManager
->create('Magento\Customer\Api\CustomerRepositoryInterface');
- $this->_customerAddressService =
- $this->objectManager->create('Magento\Customer\Service\V1\CustomerAddressServiceInterface');
+ $this->addressRepository =
+ $this->objectManager->create('Magento\Customer\Api\AddressRepositoryInterface');
$this->addressBuilder = $this->objectManager->create('Magento\Customer\Api\Data\AddressDataBuilder');
$this->customerBuilder = $this->objectManager->create('Magento\Customer\Api\Data\CustomerDataBuilder');
$regionBuilder = $this->objectManager->create('Magento\Customer\Api\Data\RegionDataBuilder');
- $this->addressBuilder->setId(1)
+ $this->addressBuilder->setId('1')
->setCountryId('US')
- ->setCustomerId(1)
+ ->setCustomerId('1')
->setPostcode('75477')
->setRegion(
$regionBuilder->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create()
)
+ ->setCompany('CompanyName')
->setStreet(['Green str, 67'])
->setTelephone('3468676')
->setCity('CityM')
@@ -91,13 +98,14 @@ protected function setUp()
->setLastname('Smith');
$address = $this->addressBuilder->create();
- $this->addressBuilder->setId(2)
+ $this->addressBuilder->setId('2')
->setCountryId('US')
- ->setCustomerId(1)
+ ->setCustomerId('1')
->setPostcode('47676')
->setRegion(
$regionBuilder->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create()
)
+ ->setCompany('Company')
->setStreet(['Black str, 48'])
->setCity('CityX')
->setTelephone('3234676')
@@ -106,6 +114,9 @@ protected function setUp()
$address2 = $this->addressBuilder->create();
$this->_expectedAddresses = [$address, $address2];
+
+ $this->dataProcessor = $this->objectManager
+ ->create('Magento\Framework\Reflection\DataObjectProcessor');
}
/**
@@ -827,6 +838,108 @@ public function testIsEmailAvailableNonExistentEmail()
$this->assertTrue($this->accountManagement->isEmailAvailable('nonexistent@example.com', 1));
}
+ /**
+ * @magentoDataFixture Magento/Customer/_files/customer.php
+ * @magentoDataFixture Magento/Customer/_files/customer_address.php
+ * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
+ */
+ public function testGetDefaultBillingAddress()
+ {
+ $customerId = 1;
+ $address = $this->accountManagement->getDefaultBillingAddress($customerId);
+
+ $expected = $this->dataProcessor->buildOutputDataArray(
+ $this->_expectedAddresses[0],
+ 'Magento\Customer\Api\Data\AddressInterface'
+ );
+ $result = $this->dataProcessor->buildOutputDataArray($address, 'Magento\Customer\Api\Data\AddressInterface');
+ /*
+ * TODO : Data builder / populateWithArray currently does not detect
+ * array type and returns street as string instead of array. Need to fix this.
+ */
+ unset($expected[AddressInterface::STREET]);
+ unset($result[AddressInterface::STREET]);
+ $this->assertEquals($expected, $result);
+ }
+
+ /**
+ * @magentoDataFixture Magento/Customer/_files/customer.php
+ */
+ public function testSaveNewAddressDefaults()
+ {
+ $customerId = 1;
+
+ /** @var $addressShippingBuilder \Magento\Customer\Api\Data\AddressDataBuilder */
+ $addressShippingBuilder = $this->addressBuilder->populate($this->_expectedAddresses[0])->setId(null);
+ $addressShippingBuilder->setDefaultShipping(true)->setDefaultBilling(false)->setCustomerId($customerId);
+ //TODO : Will be fixed as part of fixing populate. For now Region is set as Data Object instead of array
+ $addressShippingBuilder->setRegion($this->_expectedAddresses[0]->getRegion());
+ $addressShipping = $addressShippingBuilder->create();
+
+ /** @var $addressBillingBuilder \Magento\Customer\Api\Data\AddressDataBuilder */
+ $addressBillingBuilder = $this->addressBuilder->populate($this->_expectedAddresses[1])->setId(null);
+ $addressBillingBuilder->setDefaultBilling(true)->setDefaultShipping(false)->setCustomerId($customerId);
+ //TODO : Will be fixed as part of fixing populate
+ $addressBillingBuilder->setRegion($this->_expectedAddresses[1]->getRegion());
+ $addressBilling = $addressBillingBuilder->create();
+
+ $addressShippingExpected = $this->addressRepository->save($addressShipping);
+ $addressBillingExpected = $this->addressRepository->save($addressBilling);
+
+ // Call api under test
+ $shippingResponse = $this->accountManagement->getDefaultShippingAddress($customerId);
+ $billingResponse = $this->accountManagement->getDefaultBillingAddress($customerId);
+
+
+ // Verify if the new Shipping address created is same as returned by the api under test :
+ // \Magento\Customer\Api\AccountManagementInterface::getDefaultShippingAddress
+ $addressShippingExpected = $this->dataProcessor->buildOutputDataArray(
+ $addressShippingExpected,
+ 'Magento\Customer\Api\Data\AddressInterface'
+ );
+ $shippingResponse = $this->dataProcessor->buildOutputDataArray(
+ $shippingResponse,
+ 'Magento\Customer\Api\Data\AddressInterface'
+ );
+ /*
+ * TODO : Data builder / populateWithArray currently does not detect
+ * array type and returns street as string instead of array. Need to fix this.
+ */
+ unset($addressShippingExpected[AddressInterface::STREET]);
+ unset($shippingResponse[AddressInterface::STREET]);
+
+ $this->assertEquals($addressShippingExpected, $shippingResponse);
+
+ // Verify if the new Billing address created is same as returned by the api under test :
+ // \Magento\Customer\Api\AccountManagementInterface::getDefaultShippingAddress
+ $addressBillingExpected = $this->dataProcessor->buildOutputDataArray(
+ $addressBillingExpected,
+ 'Magento\Customer\Api\Data\AddressInterface'
+ );
+ $billingResponse = $this->dataProcessor->buildOutputDataArray(
+ $billingResponse,
+ 'Magento\Customer\Api\Data\AddressInterface'
+ );
+ /*
+ * TODO : Data builder / populateWithArray currently does not detect
+ * array type and returns street as string instead of array. Need to fix this.
+ */
+ unset($addressBillingExpected[AddressInterface::STREET]);
+ unset($billingResponse[AddressInterface::STREET]);
+
+ $this->assertEquals($addressBillingExpected, $billingResponse);
+ }
+
+ /**
+ * @magentoDataFixture Magento/Customer/_files/customer.php
+ */
+ public function testGetDefaultAddressesForNonExistentAddress()
+ {
+ $customerId = 1;
+ $this->assertNull($this->accountManagement->getDefaultBillingAddress($customerId));
+ $this->assertNull($this->accountManagement->getDefaultShippingAddress($customerId));
+ }
+
/**
* Set Rp data to Customer in fixture
*
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php
index 4a984761e94bd..40cd098a1dbb9 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php
@@ -319,7 +319,8 @@ public function testMergeDataObjects()
$customerDetailsA = $this->_builder->populateWithArray(
array('customer' => $customer, 'addresses' => array($address2))
)->create();
- $customerDetailsB = $this->_builder->mergeDataObjects($customerDetailsC, $customerDetailsA);
+ $customerDetailsB = $this->_builder->mergeDataObjects($customerDetailsC, $customerDetailsA)
+ ->create();
$this->assertEquals($customerDetails->__toArray(), $customerDetailsB->__toArray());
}
@@ -386,7 +387,7 @@ public function testMergeDataWithArray()
$customerDetailsB = $this->_builder->mergeDataObjectWithArray(
$customerDetailsC,
array('addresses' => array($address2))
- );
+ )->create();
$this->assertEquals($customerDetails->__toArray(), $customerDetailsB->__toArray());
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php
index a1f2bc2c4ad82..a528858ac62e9 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php
@@ -149,7 +149,8 @@ public function testMergeDataObjects()
$attributeMetadata = $this->_builder->populateWithArray($dataNoOptions)->create();
$attributeMetadataA = $this->_builder->populateWithArray($dataWithOptions)->create();
- $merged = $this->_builder->mergeDataObjects($attributeMetadata, $attributeMetadataA);
+ $merged = $this->_builder->mergeDataObjects($attributeMetadata, $attributeMetadataA)
+ ->create();
$this->assertEquals($attributeMetadataA, $merged);
}
@@ -180,7 +181,8 @@ public function testMergeDataObjectWithArray()
$attributeMetadata = $this->_builder->populateWithArray($dataNoOptions)->create();
$attributeMetadataA = $this->_builder->populateWithArray($dataWithOptions)->create();
- $merged = $this->_builder->mergeDataObjectWithArray($attributeMetadata, $dataWithOptions);
+ $merged = $this->_builder->mergeDataObjectWithArray($attributeMetadata, $dataWithOptions)
+ ->create();
$this->assertEquals($attributeMetadataA, $merged);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
index c9a63d3819492..7580bd0cd6600 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
@@ -25,6 +25,10 @@
use Magento\Wonderland\Api\Data\FakeAddressInterface;
use Magento\Wonderland\Api\Data\FakeRegionInterface;
+use Magento\Wonderland\Model\Data\FakeAddress;
+use Magento\Wonderland\Model\Data\FakeRegion;
+use Magento\Framework\Api\ExtensibleDataInterface;
+use Magento\Framework\Api\AttributeInterface;
class DataBuilderTest extends \PHPUnit_Framework_TestCase
{
@@ -47,12 +51,100 @@ protected function setUp()
);
}
- public function testPopulateWithArray()
+ /**
+ * @dataProvider getBuildersToTest
+ */
+ public function testBuilders($builderType)
{
+ $builder = $this->_objectManager->create($builderType);
+ $this->assertInstanceOf($builderType, $builder);
+ }
+
+ public function getBuildersToTest()
+ {
+ return [
+ ['Magento\Checkout\Service\V1\Data\Cart\TotalsBuilder'],
+ ];
+ }
+
+ public function testDataObjectBuilder()
+ {
+ $regionBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeRegionBuilder');
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegionBuilder', $regionBuilder);
+ $region = $regionBuilder->setRegion('test')
+ ->setRegionCode('test_code')
+ ->setRegionId('test_id')
+ ->create();
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $region);
+ $this->assertEquals('test', $region->getRegion());
+ }
+
+
+ public function testDataObjectPopulateWithArray()
+ {
+ $data = $this->getAddressArray();
+
+ /** @var \Magento\Wonderland\Model\Data\FakeAddressBuilder $addressBuilder */
+ $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeAddressBuilder');
+ /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
+ $address = $addressBuilder->populateWithArray($data)
+ ->create();
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeAddress', $address);
+ $this->assertEquals('Johnes', $address->getLastname());
+ $this->assertNull($address->getCustomAttribute('test'));
+ $this->assertEmpty($address->getCustomAttributes());
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegion());
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[0]);
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[1]);
+ }
+
+
+ public function testDataObjectPopulate()
+ {
+ $data = $this->getAddressArray();
+
+ /** @var \Magento\Wonderland\Model\Data\FakeAddressBuilder $addressBuilder */
+ $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeAddressBuilder');
+ /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
+ $address = $addressBuilder->populateWithArray($data)
+ ->create();
+
+ $addressUpdated = $addressBuilder->populate($address)
+ ->setCompany('RocketScience')
+ ->create();
+
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeAddress', $addressUpdated);
+ $this->assertEquals('RocketScience', $addressUpdated->getCompany());
+
+ $this->assertEmpty($address->getCustomAttributes());
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegion());
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[0]);
+ $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[1]);
+ }
+
+
+ public function testModelPopulateWithArray()
+ {
+ $data = $this->getAddressArray();
+
/** @var \Magento\Wonderland\Api\Data\FakeAddressDataBuilder $addressBuilder */
$addressBuilder = $this->_objectManager->create('Magento\Wonderland\Api\Data\FakeAddressDataBuilder');
+ /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
+ $address = $addressBuilder->populateWithArray($data)
+ ->create();
+ $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeAddressInterface', $address);
+ $this->assertEquals('Johnes', $address->getLastname());
+ $this->assertEquals(true, $address->isDefaultShipping());
+ $this->assertEquals(false, $address->isDefaultBilling());
+ $this->assertNull($address->getCustomAttribute('test'));
+ $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegion());
+ $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[0]);
+ $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[1]);
+ }
- $data = [
+ public function getAddressArray()
+ {
+ return [
FakeAddressInterface::ID => 1,
FakeAddressInterface::CITY => 'Kiev',
FakeAddressInterface::REGION => [
@@ -84,18 +176,9 @@ public function testPopulateWithArray()
FakeAddressInterface::STREET => 'Oak rd.',
FakeAddressInterface::TELEPHONE => '1234567',
FakeAddressInterface::VAT_ID => '1',
- 'test' => 'xxx'
+ 'test' => 'xxx',
+ FakeAddressInterface::DEFAULT_BILLING => false,
+ FakeAddressInterface::DEFAULT_SHIPPING => true,
];
-
- /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
- $address = $addressBuilder->populateWithArray($data)
- ->create();
- $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeAddressInterface', $address);
- $this->assertEquals('Johnes', $address->getLastname());
- $this->assertNull($address->getCustomAttribute('test'));
- $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegion());
- $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[0]);
- $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[1]);
}
-
-}
\ No newline at end of file
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php
index a717126d57208..dbb7899946d1f 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php
@@ -52,6 +52,8 @@ interface FakeAddressInterface extends ExtensibleDataInterface
const PREFIX = 'prefix';
const SUFFIX = 'suffix';
const VAT_ID = 'vat_id';
+ const DEFAULT_BILLING = 'default_billing';
+ const DEFAULT_SHIPPING = 'default_shipping';
/**#@-*/
/**
@@ -172,4 +174,18 @@ public function getSuffix();
* @return string|null
*/
public function getVatId();
+
+ /**
+ * Get if this address is default shipping address.
+ *
+ * @return bool|null
+ */
+ public function isDefaultShipping();
+
+ /**
+ * Get if this address is default billing address
+ *
+ * @return bool|null
+ */
+ public function isDefaultBilling();
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php
new file mode 100644
index 0000000000000..1f9ad5e79eb37
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php
@@ -0,0 +1,222 @@
+_get(self::ID);
+ }
+
+ /**
+ * Get customer ID
+ *
+ * @return int|null
+ */
+ public function getCustomerId()
+ {
+ return $this->_get(self::CUSTOMER_ID);
+ }
+
+ /**
+ * Get region
+ *
+ * @return \Magento\Wonderland\Model\Data\FakeRegion|null
+ */
+ public function getRegion()
+ {
+ return $this->_get(self::REGION);
+ }
+
+ /**
+ * Get region
+ *
+ * @return \Magento\Wonderland\Model\Data\FakeRegion[]|null
+ */
+ public function getRegions()
+ {
+ return $this->_get(self::REGIONS);
+ }
+
+ /**
+ * Two-letter country code in ISO_3166-2 format
+ *
+ * @return string|null
+ */
+ public function getCountryId()
+ {
+ return $this->_get(self::COUNTRY_ID);
+ }
+
+ /**
+ * Get street
+ *
+ * @return string[]|null
+ */
+ public function getStreet()
+ {
+ return $this->_get(self::STREET);
+ }
+
+ /**
+ * Get company
+ *
+ * @return string|null
+ */
+ public function getCompany()
+ {
+ return $this->_get(self::COMPANY);
+ }
+
+ /**
+ * Get telephone number
+ *
+ * @return string|null
+ */
+ public function getTelephone()
+ {
+ return $this->_get(self::TELEPHONE);
+ }
+
+ /**
+ * Get fax number
+ *
+ * @return string|null
+ */
+ public function getFax()
+ {
+ return $this->_get(self::FAX);
+ }
+
+ /**
+ * Get postcode
+ *
+ * @return string|null
+ */
+ public function getPostcode()
+ {
+ return $this->_get(self::POSTCODE);
+ }
+
+ /**
+ * Get city name
+ *
+ * @return string|null
+ */
+ public function getCity()
+ {
+ return $this->_get(self::CITY);
+ }
+
+ /**
+ * Get first name
+ *
+ * @return string|null
+ */
+ public function getFirstname()
+ {
+ return $this->_get(self::FIRSTNAME);
+ }
+
+ /**
+ * Get last name
+ *
+ * @return string|null
+ */
+ public function getLastname()
+ {
+ return $this->_get(self::LASTNAME);
+ }
+
+ /**
+ * Get middle name
+ *
+ * @return string|null
+ */
+ public function getMiddlename()
+ {
+ return $this->_get(self::MIDDLENAME);
+ }
+
+ /**
+ * Get prefix
+ *
+ * @return string|null
+ */
+ public function getPrefix()
+ {
+ return $this->_get(self::PREFIX);
+ }
+
+ /**
+ * Get suffix
+ *
+ * @return string|null
+ */
+ public function getSuffix()
+ {
+ return $this->_get(self::SUFFIX);
+ }
+
+ /**
+ * Get Vat id
+ *
+ * @return string|null
+ */
+ public function getVatId()
+ {
+ return $this->_get(self::VAT_ID);
+ }
+}
\ No newline at end of file
diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/Version/Generator/TimestampTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
similarity index 56%
rename from dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/Version/Generator/TimestampTest.php
rename to dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
index 5f981048d3ed8..6338ff41e36e8 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/Version/Generator/TimestampTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
@@ -1,5 +1,6 @@
_get(self::REGION);
+ }
- protected function setUp()
+ /**
+ * Get region code
+ *
+ * @return string
+ */
+ public function getRegionCode()
{
- $this->object = new Timestamp();
+ return $this->_get(self::REGION_CODE);
}
- public function testGenerate()
+ /**
+ * Get region id
+ *
+ * @return int
+ */
+ public function getRegionId()
{
- $result = $this->object->generate();
- $this->assertNotEmpty($result);
- $this->assertInternalType('string', $result);
- sleep(1);
- $this->assertNotEquals($result, $this->object->generate(), 'Unique value is expected');
+ return $this->_get(self::REGION_ID);
}
-}
+}
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
index d6f31fabd2209..a9026a0909b73 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
@@ -62,7 +62,7 @@ public function getRegion()
/**
* Get region
*
- * @return \Magento\Wonderland\Api\Data\FakeRegionInterface|null
+ * @return \Magento\Wonderland\Api\Data\FakeRegionInterface[]|null
*/
public function getRegions()
{
@@ -198,4 +198,24 @@ public function getVatId()
{
return $this->getData(self::VAT_ID);
}
-}
\ No newline at end of file
+
+ /**
+ * Get if this address is default shipping address.
+ *
+ * @return bool|null
+ */
+ public function isDefaultShipping()
+ {
+ return $this->getData(self::DEFAULT_SHIPPING);
+ }
+
+ /**
+ * Get if this address is default billing address
+ *
+ * @return bool|null
+ */
+ public function isDefaultBilling()
+ {
+ return $this->getData(self::DEFAULT_BILLING);
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
new file mode 100644
index 0000000000000..5cebeeb3a7022
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
@@ -0,0 +1,114 @@
+create('Magento\Framework\Filter\Template\Tokenizer\Parameter');
+ $parameter->setString($string);
+
+ foreach ($values as $value) {
+ $this->assertEquals($value, $parameter->getValue());
+ }
+ }
+
+ /**
+ * @dataProvider tokenizeDataProvider
+ * @param string $string
+ * @param array $params
+ */
+ public function testTokenize($string, $params)
+ {
+ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ /** @var \Magento\Framework\Filter\Template\Tokenizer\Parameter $parameter */
+ $parameter = $objectManager->create('Magento\Framework\Filter\Template\Tokenizer\Parameter');
+ $parameter->setString($string);
+ $this->assertEquals($params, $parameter->tokenize());
+ }
+
+ /**
+ * @return array
+ */
+ public function tokenizeDataProvider()
+ {
+ return [
+ [
+ ' type="Magento\\Catalog\\Block\\Product\\Widget\\NewWidget" display_type="all_products"'
+ . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+ [
+ 'type' => 'Magento\Catalog\Block\Product\Widget\NewWidget',
+ 'display_type' => 'all_products',
+ 'products_count' => 10,
+ 'template' => 'product/widget/new/content/new_grid.phtml'
+ ]
+ ],
+ [
+ ' type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="all_products"'
+ . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+ [
+ 'type' => 'Magento\Catalog\Block\Product\Widget\NewWidget',
+ 'display_type' => 'all_products',
+ 'products_count' => 10,
+ 'template' => 'product/widget/new/content/new_grid.phtml'
+ ]
+ ]
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ public function getValueDataProvider()
+ {
+ return [
+ [
+ ' type="Magento\\Catalog\\Block\\Product\\Widget\\NewWidget" display_type="all_products"'
+ . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+ [
+ 'type="Magento\Catalog\Block\Product\Widget\NewWidget"',
+ 'display_type="all_products"',
+ 'products_count="10"'
+ ]
+ ],
+ [
+ ' type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="all_products"'
+ . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+ [
+ 'type="Magento\Catalog\Block\Product\Widget\NewWidget"',
+ 'display_type="all_products"',
+ 'products_count="10"'
+ ]
+ ]
+ ];
+ }
+}
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php
index 2bf266baadcec..5f2d5bb560a04 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php
@@ -26,7 +26,6 @@
$quote->load('test01', 'reserved_order_id');
$payment = $quote->getPayment();
-$payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS);
-$payment->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123);
-
+$payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS)
+ ->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123);
$quote->collectTotals()->save();
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php
index ff87ee92e4df6..bb1997f88438b 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php
@@ -120,7 +120,7 @@
$payment = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order\Payment');
$payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
-$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
+$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS)->save();
/** @var $service \Magento\Sales\Model\Service\Quote */
$service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php
index 308e524ab2f60..749426b94ec71 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php
@@ -116,7 +116,7 @@
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->collectTotals()->save();
-$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
+$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS)->save();
$quote->setCustomerEmail('admin@example.com');
/** @var $service \Magento\Sales\Model\Service\Quote */
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
index 0b498eb491793..494242ecbe74a 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -577,7 +577,7 @@ protected function _preparePreconditionsForCreateOrder(
);
$this->assertEquals(
$paymentMethod,
- $this->_model->getQuote()->getPaymentsCollection()->getItems()[0]->getData('method'),
+ $this->_model->getQuote()->getPayment()->getData('method'),
'Precondition failed: Payment method data is invalid in create order model'
);
}
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
index 3e417f80252e9..7cdeb97df9d48 100755
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
@@ -129,7 +129,7 @@ public function testSubmitOrderExistingCustomer()
$customerData = $this->_customerBuilder->mergeDataObjectWithArray(
$customerData,
array(CustomerData::EMAIL => 'new@example.com')
- );
+ )->create();
$addresses = $this->_customerAddressService->getAddresses($existingCustomerId);
$this->_serviceQuote->getQuote()->setCustomerData($customerData);
$this->_serviceQuote->getQuote()->setCustomerAddressData($addresses);
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php
index 8f855558094cc..b6a9d7ad316ac 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php
@@ -96,20 +96,36 @@ public function periodDataProvider()
'period' => 'day',
'date_from' => null,
'date_to' => null,
- 'expected_period' => date('Y-m-d', time())
+ 'expected_period' => $this->getNow()
],
[
'period' => 'undefinedPeriod',
'date_from' => null,
'date_to' => null,
- 'expected_period' => date('Y-m-d', time())
+ 'expected_period' => $this->getNow()
],
[
'period' => null,
'date_from' => date('Y-m-d', strtotime('-1 year', time())),
'date_to' => date('Y-m-d', time()),
- 'expected_period' => date('Y-m-d', time())
+ 'expected_period' => $this->getNow()
]
);
}
+
+ /**
+ * Retrieve date in MySQL timezone
+ *
+ * @return string
+ */
+ protected function getNow()
+ {
+ /** @var \Magento\Framework\App\Resource $resources */
+ $resources = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ 'Magento\Framework\App\Resource'
+ );
+ $connection = $resources->getConnection('salesrule_read');
+ $now = $connection->fetchOne("SELECT CURDATE()");
+ return $now;
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php
index 7b418c0423847..90ec5364aff50 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php
@@ -99,7 +99,8 @@ public function testMergeDataObjects()
$itemExpected = $this->quoteDetailsItemBuilder->populateWithArray($data['dataMerged'])->create();
$itemSomeFields = $this->quoteDetailsItemBuilder->populateWithArray($data['data1'])->create();
$itemMoreFields = $this->quoteDetailsItemBuilder->populateWithArray($data['data2'])->create();
- $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjects($itemSomeFields, $itemMoreFields);
+ $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjects($itemSomeFields, $itemMoreFields)
+ ->create();
$this->assertEquals($itemExpected->__toArray(), $itemMerged->__toArray());
}
@@ -108,7 +109,8 @@ public function testMergeDataObjectsWithArray()
$data = $this->getData();
$itemExpected = $this->quoteDetailsItemBuilder->populateWithArray($data['dataMerged'])->create();
$itemSomeFields = $this->quoteDetailsItemBuilder->populateWithArray($data['data1'])->create();
- $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjectWithArray($itemSomeFields, $data['data2']);
+ $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjectWithArray($itemSomeFields, $data['data2'])
+ ->create();
$this->assertEquals($itemExpected->__toArray(), $itemMerged->__toArray());
}
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php
index 10138b0ca3a99..dd69938b3cfd1 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php
@@ -98,7 +98,8 @@ public function testMergeDataObjects()
$taxRate = $this->builder->populateWithArray($data['dataMerged'])->create();
$taxRate1 = $this->builder->populateWithArray($data['data1'])->create();
$taxRate2 = $this->builder->populateWithArray($data['data2'])->create();
- $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2);
+ $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2)
+ ->create();
$this->assertEquals($taxRate->__toArray(), $taxRateMerged->__toArray());
}
@@ -108,7 +109,8 @@ public function testMergeDataObjectWithArray()
$taxRate = $this->builder->populateWithArray($data['dataMerged'])->create();
$taxRate1 = $this->builder->populateWithArray($data['data1'])->create();
- $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $data['data2']);
+ $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $data['data2'])
+ ->create();
$this->assertEquals($taxRate->__toArray(), $taxRateMerged->__toArray());
}
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php
index 1c5c3aa521dfe..c77d296129282 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php
@@ -164,7 +164,8 @@ public function testMergeDataObjects()
$appliedTax = $this->builder->populateWithArray($dataMerged)->create();
$appliedTax1 = $this->builder->populateWithArray($data1)->create();
$appliedTax2 = $this->builder->populateWithArray($data2)->create();
- $appliedTaxMerged = $this->builder->mergeDataObjects($appliedTax1, $appliedTax2);
+ $appliedTaxMerged = $this->builder->mergeDataObjects($appliedTax1, $appliedTax2)
+ ->create();
$this->assertEquals($appliedTax->__toArray(), $appliedTaxMerged->__toArray());
}
@@ -211,7 +212,8 @@ public function testMergeDataObjectWithArray()
$appliedTax = $this->builder->populateWithArray($dataMerged)->create();
$appliedTax1 = $this->builder->populateWithArray($data1)->create();
- $appliedTaxMerged = $this->builder->mergeDataObjectWithArray($appliedTax1, $data2);
+ $appliedTaxMerged = $this->builder->mergeDataObjectWithArray($appliedTax1, $data2)
+ ->create();
$this->assertEquals($appliedTax->__toArray(), $appliedTaxMerged->__toArray());
}
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php
index 0a94d37f9e717..4750e289ff0db 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php
@@ -116,7 +116,8 @@ public function testMergeDataObjects($firstRateArray, $secondRateArray, $expecte
$expectedTaxRate = $this->builder->populateWithArray($expectedResultsArray)->create();
$taxRate1 = $this->builder->populateWithArray($firstRateArray)->create();
$taxRate2 = $this->builder->populateWithArray($secondRateArray)->create();
- $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2);
+ $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2)
+ ->create();
$this->assertEquals($expectedTaxRate->__toArray(), $taxRateMerged->__toArray());
}
@@ -128,7 +129,8 @@ public function testMergeDataObjectWithArray($firstRateArray, $secondRateArray,
$taxRate = $this->builder->populateWithArray($expectedResultsArray)->create();
$taxRate1 = $this->builder->populateWithArray($firstRateArray)->create();
- $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $secondRateArray);
+ $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $secondRateArray)
+ ->create();
$this->assertEquals($taxRate->__toArray(), $taxRateMerged->__toArray());
}
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php
index d9f00a2d47375..00f707e44af33 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php
@@ -110,7 +110,7 @@ public function testMergeDataObjects($firstDataSet, $secondDataSet, $mergedData)
$taxRateSearchResultsMerged = $this->taxRateSearchResultsBuilder->mergeDataObjects(
$taxRateSearchResults1,
$taxRateSearchResults2
- );
+ )->create();
$this->assertEquals($taxRateSearchResults->__toArray(), $taxRateSearchResultsMerged->__toArray());
}
@@ -124,7 +124,7 @@ public function testMergeDataObjectWithArray($firstDataSet, $secondDataSet, $mer
$taxRateSearchResultsMerged = $this->taxRateSearchResultsBuilder->mergeDataObjectWithArray(
$taxRateSearchResults1,
$secondDataSet
- );
+ )->create();
$this->assertEquals($taxRateSearchResults->__toArray(), $taxRateSearchResultsMerged->__toArray());
}
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php
index 5855de2e250f9..a201cbd32d98f 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php
@@ -147,7 +147,8 @@ public function testMergeDataObjects()
$taxRuleExpected = $this->builder->populateWithArray($taxRuleDataExpected)->create();
$taxRuleSomeFields = $this->builder->populateWithArray($taxRuleDataSomeFields)->create();
$taxRuleMoreFields = $this->builder->populateWithArray($taxRuleDataMoreFields)->create();
- $taxRuleMerged = $this->builder->mergeDataObjects($taxRuleSomeFields, $taxRuleMoreFields);
+ $taxRuleMerged = $this->builder->mergeDataObjects($taxRuleSomeFields, $taxRuleMoreFields)
+ ->create();
$this->assertEquals($taxRuleExpected->__toArray(), $taxRuleMerged->__toArray());
}
@@ -180,7 +181,8 @@ public function testMergeDataObjectsWithArray()
$taxRuleExpected = $this->builder->populateWithArray($taxRuleDataExpected)->create();
$taxRuleSomeFields = $this->builder->populateWithArray($taxRuleDataSomeFields)->create();
- $taxRuleMerged = $this->builder->mergeDataObjectWithArray($taxRuleSomeFields, $taxRuleDataMoreFields);
+ $taxRuleMerged = $this->builder->mergeDataObjectWithArray($taxRuleSomeFields, $taxRuleDataMoreFields)
+ ->create();
$this->assertEquals($taxRuleExpected->__toArray(), $taxRuleMerged->__toArray());
}
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php
index e436e650b9496..34923ed3227df 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php
@@ -191,7 +191,8 @@ public function testMergeDataObjects()
$taxRuleSearchResults = $this->builder->populateWithArray($dataMerged)->create();
$taxRuleSearchResults1 = $this->builder->populateWithArray($data1)->create();
$taxRuleSearchResults2 = $this->builder->populateWithArray($data2)->create();
- $taxRuleSearchResultsMerged = $this->builder->mergeDataObjects($taxRuleSearchResults1, $taxRuleSearchResults2);
+ $taxRuleSearchResultsMerged = $this->builder->mergeDataObjects($taxRuleSearchResults1, $taxRuleSearchResults2)
+ ->create();
$this->assertEquals($taxRuleSearchResults->__toArray(), $taxRuleSearchResultsMerged->__toArray());
}
@@ -252,7 +253,8 @@ public function testMergeDataObjectWithArray()
$taxRuleSearchResults = $this->builder->populateWithArray($dataMerged)->create();
$taxRuleSearchResults1 = $this->builder->populateWithArray($data1)->create();
- $taxRuleSearchResultsMerged = $this->builder->mergeDataObjectWithArray($taxRuleSearchResults1, $data2);
+ $taxRuleSearchResultsMerged = $this->builder->mergeDataObjectWithArray($taxRuleSearchResults1, $data2)
+ ->create();
$this->assertEquals($taxRuleSearchResults->__toArray(), $taxRuleSearchResultsMerged->__toArray());
}
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
index 005a517f8d168..d0cd5f25232ee 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
@@ -337,6 +337,8 @@ public function testConstructorIntegrity()
=> 'Magento\Framework\Api\Code\Generator\DataBuilder',
\Magento\Framework\Api\Code\Generator\SearchResultsBuilder::ENTITY_TYPE
=> 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
+ \Magento\Framework\Api\Code\Generator\DataBuilder::ENTITY_TYPE_BUILDER
+ => 'Magento\Framework\Api\Code\Generator\DataBuilder',
\Magento\Framework\ObjectManager\Code\Generator\Factory::ENTITY_TYPE
=> 'Magento\Framework\ObjectManager\Code\Generator\Factory',
\Magento\Framework\ObjectManager\Code\Generator\Repository::ENTITY_TYPE
@@ -345,8 +347,6 @@ public function testConstructorIntegrity()
=> 'Magento\Framework\ObjectManager\Code\Generator\Converter',
\Magento\Framework\Api\Code\Generator\Mapper::ENTITY_TYPE
=> 'Magento\Framework\Api\Code\Generator\Mapper',
- \Magento\Framework\Api\Code\Generator\Builder::ENTITY_TYPE
- => 'Magento\Framework\Api\Code\Generator\Builder',
\Magento\Framework\Api\Code\Generator\SearchResults::ENTITY_TYPE
=> 'Magento\Framework\Api\Code\Generator\SearchResults'
)
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt
index 84301c26bb5de..29c77a9f6d2f7 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt
@@ -25,6 +25,8 @@ dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/
dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeRegionInterface.php
dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeRegion.php
+dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php
+dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/coupling.php
dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/cyclomatic_complexity.php
dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/descendant_count.php
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt
index 02d265b3e8bba..1d55de7b2756d 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt
@@ -33,4 +33,7 @@ DbTest
Model1
Model3
\Magento\Wonderland\Api\Data\FakeRegionInterface
+\Magento\Wonderland\Api\Data\FakeAddressInterface
+\Magento\Wonderland\Model\Data\FakeRegion
+\Magento\Wonderland\Model\Data\FakeAddress
\Magento\Framework\Error\Processor
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php
index 553d2482c1e02..ae3641ceaa04e 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php
@@ -257,53 +257,49 @@
'sales_bestsellers_aggregated_yearly' => 'Magento_Sales',
'paypal_billing_agreement' => 'Magento_Paypal',
'paypal_billing_agreement_order' => 'Magento_Paypal',
- 'sales_flat_creditmemo' => 'Magento_Sales',
- 'sales_flat_creditmemo_comment' => 'Magento_Sales',
- 'sales_flat_creditmemo_grid' => 'Magento_Sales',
- 'sales_flat_creditmemo_item' => 'Magento_Sales',
- 'sales_flat_invoice' => 'Magento_Sales',
- 'sales_flat_invoice_comment' => 'Magento_Sales',
- 'sales_flat_invoice_grid' => 'Magento_Sales',
- 'sales_flat_invoice_item' => 'Magento_Sales',
+ 'sales_creditmemo' => 'Magento_Sales',
+ 'sales_creditmemo_comment' => 'Magento_Sales',
+ 'sales_creditmemo_grid' => 'Magento_Sales',
+ 'sales_creditmemo_item' => 'Magento_Sales',
+ 'sales_invoice' => 'Magento_Sales',
+ 'sales_invoice_comment' => 'Magento_Sales',
+ 'sales_invoice_grid' => 'Magento_Sales',
+ 'sales_invoice_item' => 'Magento_Sales',
'sales_invoiced_aggregated' => 'Magento_Sales',
'sales_invoiced_aggregated_order' => 'Magento_Sales',
- 'sales_flat_order' => 'Magento_Sales',
- 'sales_flat_order_address' => 'Magento_Sales',
+ 'sales_order' => 'Magento_Sales',
+ 'sales_order_address' => 'Magento_Sales',
'sales_order_aggregated_created' => 'Magento_Sales',
'sales_order_aggregated_updated' => 'Magento_Sales',
- 'sales_flat_order_grid' => 'Magento_Sales',
- 'sales_flat_order_item' => 'Magento_Sales',
- 'sales_flat_order_item_option' => 'Magento_Sales',
- 'sales_flat_order_payment' => 'Magento_Sales',
+ 'sales_order_grid' => 'Magento_Sales',
+ 'sales_order_item' => 'Magento_Sales',
+ 'sales_order_item_option' => 'Magento_Sales',
+ 'sales_order_payment' => 'Magento_Sales',
'sales_order_status' => 'Magento_Sales',
- 'sales_flat_order_status_history' => 'Magento_Sales',
+ 'sales_order_status_history' => 'Magento_Sales',
'sales_order_status_label' => 'Magento_Sales',
'sales_order_status_state' => 'Magento_Sales',
'sales_order_tax' => 'Magento_Tax',
'sales_payment_transaction' => 'Magento_Sales',
- 'sales_flat_quote' => 'Magento_Sales',
- 'sales_flat_quote_address' => 'Magento_Sales',
- 'sales_flat_quote_address_item' => 'Magento_Sales',
- 'sales_flat_quote_shipping_rate' => 'Magento_Sales',
- 'sales_flat_quote_item' => 'Magento_Sales',
- 'sales_flat_quote_item_option' => 'Magento_Sales',
- 'sales_flat_quote_payment' => 'Magento_Sales',
+ 'sales_quote' => 'Magento_Sales',
+ 'sales_quote_address' => 'Magento_Sales',
+ 'sales_quote_address_item' => 'Magento_Sales',
+ 'sales_quote_shipping_rate' => 'Magento_Sales',
+ 'sales_quote_item' => 'Magento_Sales',
+ 'sales_quote_item_option' => 'Magento_Sales',
+ 'sales_quote_payment' => 'Magento_Sales',
'recurring_payment' => 'Magento_RecurringPayment',
'recurring_payment_order' => 'Magento_RecurringPayment',
'sales_refunded_aggregated' => 'Magento_Sales',
'sales_refunded_aggregated_order' => 'Magento_Sales',
- 'sales_flat_shipment' => 'Magento_Sales',
- 'sales_flat_shipment_comment' => 'Magento_Sales',
- 'sales_flat_shipment_grid' => 'Magento_Sales',
- 'sales_flat_shipment_item' => 'Magento_Sales',
- 'sales_flat_shipment_track' => 'Magento_Sales',
+ 'sales_shipment' => 'Magento_Sales',
+ 'sales_shipment_comment' => 'Magento_Sales',
+ 'sales_shipment_grid' => 'Magento_Sales',
+ 'sales_shipment_item' => 'Magento_Sales',
+ 'sales_shipment_track' => 'Magento_Sales',
'sales_shipping_aggregated' => 'Magento_Sales',
'sales_shipping_aggregated_order' => 'Magento_Sales',
- 'sales_order' => 'Magento_Sales',
- 'sales_quote' => 'Magento_Sales',
- 'sales_quote_address' => 'Magento_Sales',
'sales_quote_entity' => 'Magento_Sales',
- 'sales_quote_item' => 'Magento_Sales',
'sales_quote_temp' => 'Magento_Sales',
'salesrule_coupon' => 'Magento_SalesRule',
'coupon_aggregated' => 'Magento_SalesRule',
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
index 13ba81bc77a62..4d1eb0440e0ac 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
@@ -2843,4 +2843,6 @@
['Magento\Framework\Filesystem\WrapperInterface'],
['Magento\Install'],
['Magento\Install\Model\Resource\Resource', 'Magento\Framework\Module\Resource'],
+ ['Magento\Framework\App\View\Deployment\Version\Generator\Timestamp', 'Magento\Framework\Stdlib\DateTime'],
+ ['Magento\Framework\App\View\Deployment\Version\GeneratorInterface'],
);
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
index 8a856de5d7b76..1f18ce6467938 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
@@ -32,6 +32,9 @@
array('_addTaxPercents', 'Magento\Catalog\Model\Resource\Product\Collection'),
array('_afterSaveCommit', 'Magento\Framework\Model\AbstractModel'),
array('_afterSetConfig', 'Magento\Eav\Model\Entity\AbstractEntity'),
+ array('getAttributeCodes', 'Magento\Eav\Model\Entity\Type'),
+ array('_loadTypeAttributes', 'Magento\Eav\Model\Resource\Entity\Attribute'),
+ array('preloadAttributes', 'Magento\Eav\Model\Entity\Type\Config'),
array('_aggregateByOrderCreatedAt', 'Magento\SalesRule\Model\Resource\Report\Rule'),
array('_amountByCookies', 'Magento\Sendfriend\Model\Sendfriend'),
array('setCookie', 'Magento\Sendfriend\Model\Sendfriend'),
@@ -48,6 +51,8 @@
array('_avoidDoubleTransactionProcessing'),
array('_beforeChildToHtml'),
array('_beforeMove', 'Magento\Catalog\Model\Resource\Category\Tree'),
+ array('_getIsActiveAttributeId', 'Magento\Catalog\Model\Resource\Category\Tree', 'Magento\Catalog\Model\Resource\Category::getIsActiveAttributeId'),
+ array('_getIsActiveAttributeId', 'Magento\Catalog\Model\Resource\Category', 'Magento\Catalog\Model\Resource\Category::getIsActiveAttributeId'),
array('_bytesToMbytes', 'Magento\Catalog\Model\Product\Option\Type\File'),
array('_calculatePrice', 'Magento\Sales\Model\Quote\Item\AbstractItem'),
array('_canBeStoreCodeInUrl', 'Magento\Framework\App\Request\Http'),
@@ -2052,4 +2057,14 @@
['_getAllowedActions', 'Magento\Customer\Controller\Account', 'Magento\Customer\Controller\Account::getAllowedActions'],
['isRegistrationAllowed', 'Magento\Customer\Controller\Account\CreatePost'],
['isRegistrationAllowed', 'Magento\Invitation\Controller\Customer\Account\CreatePost'],
+ ['getFlatIndexer', 'Magento\Catalog\Model\Category'],
+ ['getProductIndexer', 'Magento\Catalog\Model\Category'],
+ ['getFlatIndexer', 'Magento\Catalog\Model\Indexer\AbstractFlatState'],
+ ['getIndexer', 'Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreGroup'],
+ ['getIndexer', 'Magento\Catalog\Model\Indexer\Category\Flat\Plugin\StoreGroup'],
+ ['getIndexer', 'Magento\Catalog\Model\Indexer\Product\Price\Plugin\AbstractPlugin'],
+ ['getCategoryIndexer', 'Magento\Catalog\Model\Product'],
+ ['getCategoryIndexer', 'Magento\Catalog\Model\Product\Action'],
+ ['getIndexer', 'Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\AbstractPlugin'],
+ ['_getNewConditionModelInstance', 'Magento\Rule\Model\Condition\Combine'],
);
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
index de6a39980f662..3ef0f559c993c 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
@@ -361,4 +361,5 @@
['_openActions', 'Magento\Customer\Controller\Account', 'Magento\Customer\Controller\Account::openActions'],
['_session', 'Magento\Customer\Controller\Account', 'Magento\Customer\Controller\Account::session'],
['_directoryData', 'Magento\Customer\Model\Attribute\Data\Postcode', 'Magento\Customer\Model\Attribute\Data\Postcode::directoryHelper'],
+ ['_conditionModels', 'Magento\Rule\Model\Condition\Combine'],
);
diff --git a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php
index 51c4520f07b49..a35b7a99c6431 100644
--- a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php
+++ b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php
@@ -170,7 +170,9 @@ protected function _getMockWithoutConstructorCall($className)
*/
public function getObject($className, array $arguments = array())
{
- if (is_subclass_of($className, '\Magento\Framework\Api\AbstractSimpleObjectBuilder')) {
+ if (is_subclass_of($className, '\Magento\Framework\Api\AbstractSimpleObjectBuilder')
+ || is_subclass_of($className, '\Magento\Framework\Api\Builder')
+ ) {
return $this->getBuilder($className, $arguments);
}
$constructArguments = $this->getConstructArguments($className, $arguments);
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php
index 84b58dcd75ea9..0dd593aaf1901 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php
@@ -44,6 +44,11 @@ class LinkTest extends \PHPUnit_Framework_TestCase
*/
protected $block;
+ /**
+ * @var \Magento\Catalog\Model\Resource\AbstractResource|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $entityResource;
+
protected function setUp()
{
$this->storeManager = $this->getMock('Magento\Framework\StoreManagerInterface');
@@ -54,9 +59,12 @@ protected function setUp()
->method('getStoreManager')
->will($this->returnValue($this->storeManager));
+ $this->entityResource = $this->getMock('Magento\Catalog\Model\Resource\AbstractResource', [], [], '', false);
+
$this->block = (new ObjectManager($this))->getObject('Magento\Catalog\Block\Widget\Link', [
'context' => $context,
'urlFinder' => $this->urlFinder,
+ 'entityResource' => $this->entityResource
]);
}
@@ -157,6 +165,27 @@ public function testGetHrefWithoutUrlStoreSuffix($url, $separator)
$this->assertEquals($url . $separator . '___store=' . $storeCode, $this->block->getHref());
}
+ public function testGetLabelWithCustomText()
+ {
+ $customText = 'Some text';
+ $this->block->setData('anchor_text', $customText);
+ $this->assertEquals($customText, $this->block->getLabel());
+ }
+
+ public function testGetLabelWithoutCustomText()
+ {
+ $category = 'Some text';
+ $id = 1;
+ $idPath = 'id/' . $id;
+ $store = 1;
+
+ $this->block->setData('id_path', $idPath);
+ $this->storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store));
+ $this->entityResource->expects($this->once())->method('getAttributeRawValue')->with($id, 'name', $store)
+ ->will($this->returnValue($category));
+ $this->assertEquals($category, $this->block->getLabel());
+ }
+
/**
* @return array
*/
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php
index 434af4d436c2b..03c586d6eda56 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php
@@ -99,11 +99,14 @@ protected function setUp()
$this->stockItemBuilder = $this->getMock(
'Magento\CatalogInventory\Service\V1\Data\StockItemBuilder',
- ['mergeDataObjectWithArray'],
+ ['mergeDataObjectWithArray', 'create'],
[],
'',
false
);
+ $this->stockItemBuilder->expects($this->any())
+ ->method('mergeDataObjectWithArray')
+ ->willReturn($this->stockItemBuilder);
$this->stockIndexerProcessor = $this->getMock(
'Magento\CatalogInventory\Model\Indexer\Stock\Processor',
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php
index 724476e993a6d..23f1a85972ba0 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php
@@ -45,6 +45,11 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase
*/
protected $subjectMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var \Closure
*/
@@ -85,14 +90,20 @@ protected function setUp()
$this->closureMock = function () {
return false;
};
- $this->model = new StoreGroup($this->indexerMock, $this->stateMock);
+
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+ $this->model = new StoreGroup($this->indexerRegistryMock, $this->stateMock);
}
public function testAroundSave()
{
$this->stateMock->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(true));
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('invalidate');
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
$this->groupMock->expects(
$this->once()
)->method(
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php
index 0f66723ed9c75..038425b8193b9 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php
@@ -40,6 +40,11 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
*/
protected $model;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var \Closure
*/
@@ -72,7 +77,8 @@ protected function setUp()
return false;
};
$this->subjectMock = $this->getMock('Magento\Store\Model\Resource\Store', array(), array(), '', false);
- $this->model = new StoreView($this->indexerMock, $this->stateMock);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+ $this->model = new StoreView($this->indexerRegistryMock, $this->stateMock);
}
public function testAroundSaveNewObject()
@@ -117,8 +123,11 @@ public function testAroundSaveNoNeed()
protected function mockIndexerMethods()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('invalidate');
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
}
protected function mockConfigFlatEnabled()
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php
index 85788f0448a0b..6d03bfc346bf9 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php
@@ -40,6 +40,11 @@ class StateTest extends \PHPUnit_Framework_TestCase
*/
protected $flatIndexerMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
protected function setUp()
{
$this->scopeConfigMock = $this->getMockForAbstractClass('Magento\Framework\App\Config\ScopeConfigInterface');
@@ -53,6 +58,8 @@ protected function setUp()
true,
array('getId', 'getState', '__wakeup')
);
+
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
}
public function testIsFlatEnabled()
@@ -69,7 +76,7 @@ public function testIsFlatEnabled()
$this->model = new \Magento\Catalog\Model\Indexer\Category\Flat\State(
$this->scopeConfigMock,
- $this->flatIndexerMock
+ $this->indexerRegistryMock
);
$this->assertEquals(true, $this->model->isFlatEnabled());
}
@@ -83,9 +90,12 @@ public function testIsFlatEnabled()
*/
public function testIsAvailable($isAvailable, $isFlatEnabled, $isValid, $result)
{
- $this->flatIndexerMock->expects($this->any())->method('getId')->will($this->returnValue(null));
$this->flatIndexerMock->expects($this->any())->method('load')->with('catalog_category_flat');
$this->flatIndexerMock->expects($this->any())->method('isValid')->will($this->returnValue($isValid));
+ $this->indexerRegistryMock->expects($this->any())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+ ->will($this->returnValue($this->flatIndexerMock));
$this->scopeConfigMock->expects(
$this->any()
@@ -99,7 +109,7 @@ public function testIsAvailable($isAvailable, $isFlatEnabled, $isValid, $result)
$this->model = new \Magento\Catalog\Model\Indexer\Category\Flat\State(
$this->scopeConfigMock,
- $this->flatIndexerMock,
+ $this->indexerRegistryMock,
$isAvailable
);
$this->assertEquals($result, $this->model->isAvailable());
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php
index e1e58ca39ef18..5ae836ad25d17 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php
@@ -40,10 +40,15 @@ class ModeTest extends \PHPUnit_Framework_TestCase
*/
protected $indexerStateMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistry;
+
/**
* @var \Magento\Indexer\Model\IndexerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
- protected $flatIndexerMock;
+ protected $flatIndexer;
protected function setUp()
{
@@ -55,15 +60,9 @@ protected function setUp()
'',
false
);
- $this->flatIndexerMock = $this->getMockForAbstractClass(
- 'Magento\Indexer\Model\IndexerInterface',
- array(),
- '',
- false,
- false,
- true,
- array('load', 'setScheduled', '__wakeup')
- );
+ $this->indexerRegistry = $this->getMock('Magento\Indexer\Model\IndexerRegistry', [], [], '', false);
+
+ $this->flatIndexer = $this->getMock('Magento\Indexer\Model\IndexerInterface');
$objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
$this->model = $objectManager->getObject(
@@ -71,7 +70,7 @@ protected function setUp()
array(
'config' => $this->configMock,
'indexerState' => $this->indexerStateMock,
- 'flatIndexer' => $this->flatIndexerMock
+ 'indexerRegistry' => $this->indexerRegistry
)
);
}
@@ -105,8 +104,8 @@ public function testProcessValueEqual($oldValue, $value)
$this->indexerStateMock->expects($this->never())->method('setStatus');
$this->indexerStateMock->expects($this->never())->method('save');
- $this->flatIndexerMock->expects($this->never())->method('load');
- $this->flatIndexerMock->expects($this->never())->method('setScheduled');
+ $this->indexerRegistry->expects($this->never())->method('load');
+ $this->indexerRegistry->expects($this->never())->method('setScheduled');
$this->model->processValue();
}
@@ -156,8 +155,8 @@ public function testProcessValueOn($oldValue, $value)
);
$this->indexerStateMock->expects($this->once())->method('save')->will($this->returnSelf());
- $this->flatIndexerMock->expects($this->never())->method('load');
- $this->flatIndexerMock->expects($this->never())->method('setScheduled');
+ $this->indexerRegistry->expects($this->never())->method('load');
+ $this->indexerRegistry->expects($this->never())->method('setScheduled');
$this->model->processValue();
}
@@ -191,16 +190,9 @@ public function testProcessValueOff($oldValue, $value)
$this->indexerStateMock->expects($this->never())->method('setStatus');
$this->indexerStateMock->expects($this->never())->method('save');
- $this->flatIndexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- 'catalog_category_flat'
- )->will(
- $this->returnSelf()
- );
- $this->flatIndexerMock->expects($this->once())->method('setScheduled')->with(false);
+ $this->indexerRegistry->expects($this->once())->method('get')->with('catalog_category_flat')
+ ->willReturn($this->flatIndexer);
+ $this->flatIndexer->expects($this->once())->method('setScheduled')->with(false);
$this->model->processValue();
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php
index 21a358a5e32d9..a61d489428c99 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php
@@ -45,6 +45,11 @@ class FlatTest extends \PHPUnit_Framework_TestCase
*/
protected $indexerMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
protected function setUp()
{
$this->fullMock = $this->getMock(
@@ -73,25 +78,19 @@ protected function setUp()
array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
$this->model = new \Magento\Catalog\Model\Indexer\Category\Flat(
$this->fullMock,
$this->rowsMock,
- $this->indexerMock
+ $this->indexerRegistryMock
);
}
public function testExecuteWithIndexerInvalid()
{
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- \Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID
- )->will(
- $this->returnSelf()
- );
$this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(true));
+ $this->prepareIndexer();
$this->rowsMock->expects($this->never())->method('create');
@@ -102,17 +101,9 @@ public function testExecuteWithIndexerWorking()
{
$ids = array(1, 2, 3);
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- \Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID
- )->will(
- $this->returnSelf()
- );
$this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(false));
$this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(true));
+ $this->prepareIndexer();
$rowMock = $this->getMock(
'Magento\Catalog\Model\Indexer\Category\Flat\Action\Rows',
@@ -133,17 +124,9 @@ public function testExecuteWithIndexerNotWorking()
{
$ids = array(1, 2, 3);
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- \Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID
- )->will(
- $this->returnSelf()
- );
$this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(false));
$this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false));
+ $this->prepareIndexer();
$rowMock = $this->getMock(
'Magento\Catalog\Model\Indexer\Category\Flat\Action\Rows',
@@ -158,4 +141,12 @@ public function testExecuteWithIndexerNotWorking()
$this->model->execute($ids);
}
+
+ protected function prepareIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php
index 78108d267133c..e84ca575b2111 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php
@@ -40,6 +40,11 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase
*/
protected $subject;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var StoreView
*/
@@ -56,8 +61,10 @@ protected function setUp()
true,
array('getId', 'getState', '__wakeup')
);
- $this->model = new StoreGroup($this->indexerMock);
$this->subject = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+ $this->model = new StoreGroup($this->indexerRegistryMock);
}
/**
@@ -135,8 +142,11 @@ public function testAroundSaveWithoutChanges()
protected function mockIndexerMethods()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('invalidate');
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
}
protected function mockPluginProceed($returnValue = false)
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php
index 3d1c930b45094..abd214376760a 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php
@@ -40,6 +40,11 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
*/
protected $model;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
@@ -56,8 +61,10 @@ protected function setUp()
true,
array('getId', 'getState', '__wakeup')
);
- $this->model = new StoreView($this->indexerMock);
$this->subject = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+ $this->model = new StoreView($this->indexerRegistryMock);
}
public function testAroundSaveNewObject()
@@ -77,6 +84,7 @@ public function testAroundSaveNewObject()
public function testAroundSaveHasChanged()
{
+ $this->mockIndexerMethods();
$storeMock = $this->getMock(
'Magento\Store\Model\Store',
array('isObjectNew', 'dataHasChangedFor', '__wakeup'),
@@ -139,8 +147,11 @@ protected function getStateMock()
protected function mockIndexerMethods()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('invalidate');
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
}
protected function mockPluginProceed($returnValue = false)
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
index e0a96d8d76d03..5c64afc0c4697 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
@@ -45,6 +45,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
*/
protected $indexerMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
protected function setUp()
{
$this->fullMock = $this->getMock(
@@ -73,10 +78,12 @@ protected function setUp()
array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
$this->model = new \Magento\Catalog\Model\Indexer\Category\Product(
$this->fullMock,
$this->rowsMock,
- $this->indexerMock
+ $this->indexerRegistryMock
);
}
@@ -84,16 +91,8 @@ public function testExecuteWithIndexerWorking()
{
$ids = array(1, 2, 3);
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- 'catalog_category_product'
- )->will(
- $this->returnSelf()
- );
$this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(true));
+ $this->prepareIndexer();
$rowMock = $this->getMock(
'Magento\Catalog\Model\Indexer\Category\Product\Action\Rows',
@@ -114,16 +113,8 @@ public function testExecuteWithIndexerNotWorking()
{
$ids = array(1, 2, 3);
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- 'catalog_category_product'
- )->will(
- $this->returnSelf()
- );
$this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false));
+ $this->prepareIndexer();
$rowMock = $this->getMock(
'Magento\Catalog\Model\Indexer\Category\Product\Action\Rows',
@@ -138,4 +129,12 @@ public function testExecuteWithIndexerNotWorking()
$this->model->execute($ids);
}
+
+ protected function prepareIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->any())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php
index e1d3a3ee1c63b..63104731cdd5d 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php
@@ -45,6 +45,11 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
*/
protected $indexerMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
protected function setUp()
{
$this->fullMock = $this->getMock(
@@ -73,10 +78,12 @@ protected function setUp()
array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
$this->model = new \Magento\Catalog\Model\Indexer\Product\Category(
$this->fullMock,
$this->rowsMock,
- $this->indexerMock
+ $this->indexerRegistryMock
);
}
@@ -84,16 +91,8 @@ public function testExecuteWithIndexerWorking()
{
$ids = array(1, 2, 3);
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- 'catalog_product_category'
- )->will(
- $this->returnSelf()
- );
$this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(true));
+ $this->prepareIndexer();
$rowMock = $this->getMock(
'Magento\Catalog\Model\Indexer\Product\Category\Action\Rows',
@@ -114,16 +113,8 @@ public function testExecuteWithIndexerNotWorking()
{
$ids = array(1, 2, 3);
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- 'catalog_product_category'
- )->will(
- $this->returnSelf()
- );
$this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false));
+ $this->prepareIndexer();
$rowMock = $this->getMock(
'Magento\Catalog\Model\Indexer\Product\Category\Action\Rows',
@@ -138,4 +129,12 @@ public function testExecuteWithIndexerNotWorking()
$this->model->execute($ids);
}
+
+ protected function prepareIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
index 11d55081e84df..3bd416af67ac5 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
@@ -41,14 +41,14 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
protected $_indexerMock;
/**
- * @var \Magento\Indexer\Model\IndexerFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject
*/
- protected $_indexerFactoryMock;
+ protected $_stateMock;
/**
- * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
*/
- protected $_stateMock;
+ protected $indexerRegistryMock;
public function setUp()
{
@@ -63,15 +63,6 @@ public function setUp()
);
$this->_indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
- $this->_indexerFactoryMock = $this->getMock(
- 'Magento\Indexer\Model\IndexerFactory', array('create'), array(), '', false
- );
-
- $this->_indexerFactoryMock
- ->expects($this->any())
- ->method('create')
- ->will($this->returnValue($this->_indexerMock));
-
$this->_stateMock = $this->getMock(
'Magento\Catalog\Model\Indexer\Product\Flat\State',
array('isFlatEnabled'),
@@ -79,8 +70,9 @@ public function setUp()
'',
false
);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
$this->_model = $this->_objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Processor', array(
- 'indexerFactory' => $this->_indexerFactoryMock,
+ 'indexerRegistry' => $this->indexerRegistryMock,
'state' => $this->_stateMock
));
}
@@ -90,6 +82,7 @@ public function setUp()
*/
public function testGetIndexer()
{
+ $this->prepareIndexer();
$this->assertInstanceOf('\Magento\Indexer\Model\Indexer', $this->_model->getIndexer());
}
@@ -100,6 +93,7 @@ public function testMarkIndexerAsInvalid()
{
$this->_stateMock->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(true));
$this->_indexerMock->expects($this->once())->method('invalidate');
+ $this->prepareIndexer();
$this->_model->markIndexerAsInvalid();
}
@@ -112,4 +106,12 @@ public function testMarkDisabledIndexerAsInvalid()
$this->_indexerMock->expects($this->never())->method('invalidate');
$this->_model->markIndexerAsInvalid();
}
+
+ protected function prepareIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Product\Flat\Processor::INDEXER_ID)
+ ->will($this->returnValue($this->_indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php
deleted file mode 100644
index 11a6da24e4078..0000000000000
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php
+++ /dev/null
@@ -1,128 +0,0 @@
-_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
-
- $this->_priceProcessorMock = $this->getMock(
- 'Magento\Catalog\Model\Indexer\Product\Price\Processor', array(), array(), '', false
- );
-
- $this->_model = $this->_objectManager->getObject(
- '\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule',
- array(
- 'processor' => $this->_priceProcessorMock
- )
- );
- }
-
- public function testAfterApplyAll()
- {
- $this->_priceProcessorMock->expects($this->once())
- ->method('markIndexerAsInvalid');
-
- $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false);
- $this->_model->afterApplyAll($ruleMock);
- }
-
- /**
- * @param int|\Magento\Catalog\Model\Product $product
- * @param int $expectedIdCall
- * @dataProvider affectedProductsDataProvider
- */
- public function testAroundApplyToProduct($product, $expectedIdCall)
- {
- $this->_priceProcessorMock->expects($this->once())
- ->method('reindexRow')
- ->with($expectedIdCall);
-
- $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false);
- $this->_model->aroundApplyToProduct(
- $ruleMock,
- function () {
-
- },
- $product
- );
- }
-
- /**
- * @param int|\Magento\Catalog\Model\Product $product
- * @param int $expectedIdCall
- * @dataProvider affectedProductsDataProvider
- */
- public function testAroundApplyAllRulesToProduct($product, $expectedIdCall)
- {
- $this->_priceProcessorMock->expects($this->once())
- ->method('reindexRow')
- ->with($expectedIdCall);
-
- $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false);
- $this->_model->aroundApplyToProduct(
- $ruleMock,
- function () {
-
- },
- $product
- );
- }
-
- /**
- * @return array
- */
- public function affectedProductsDataProvider()
- {
- $productId = 11;
- $productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false);
- $productMock->expects($this->any())
- ->method('getId')
- ->will($this->returnValue($productId));
-
- return array(
- array($productId, $productId),
- array($productMock, $productId)
- );
- }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php
index 9dc1cf3520212..915cda1b3c3f7 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php
@@ -40,6 +40,11 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase
*/
protected $_subjectMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
public function setUp()
{
$this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
@@ -55,12 +60,16 @@ public function setUp()
'',
false
);
- $indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
$indexerMock->expects($this->once())->method('invalidate');
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
+ ->will($this->returnValue($indexerMock));
$this->_model = $this->_objectManager->getObject(
'\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CustomerGroup',
- array('indexer' => $indexerMock)
+ array('indexerRegistry' => $this->indexerRegistryMock)
);
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php
index e1e7dc8703447..c32e4a143cc8e 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php
@@ -40,6 +40,11 @@ class PriceScopeTest extends \PHPUnit_Framework_TestCase
*/
protected $_indexerMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
public function setUp()
{
$this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
@@ -51,7 +56,7 @@ public function setUp()
'',
false
);
- $this->_indexerMock->expects($this->any())->method('load')->will($this->returnValue($this->_indexerMock));
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
$contextMock = $this->getMock('Magento\Framework\Model\Context', array(), array(), '', false);
$registryMock = $this->getMock('Magento\Framework\Registry', array(), array(), '', false);
@@ -66,7 +71,7 @@ public function setUp()
'registry' => $registryMock,
'storeManager' => $storeManagerMock,
'config' => $configMock,
- 'indexer' => $this->_indexerMock
+ 'indexerRegistry' => $this->indexerRegistryMock
)
);
}
@@ -74,6 +79,7 @@ public function setUp()
public function testProcessValue()
{
$this->_indexerMock->expects($this->once())->method('invalidate');
+ $this->prepareIndexer(1);
$this->_model->setValue('1');
$this->_model->processValue();
}
@@ -81,6 +87,18 @@ public function testProcessValue()
public function testProcessValueNotChanged()
{
$this->_indexerMock->expects($this->never())->method('invalidate');
+ $this->prepareIndexer(0);
$this->_model->processValue();
}
+
+ /**
+ * @param int $countCall
+ */
+ protected function prepareIndexer($countCall)
+ {
+ $this->indexerRegistryMock->expects($this->exactly($countCall))
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
+ ->will($this->returnValue($this->_indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php
index f7a42576989ad..9ceaa1b72e03b 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php
@@ -60,6 +60,11 @@ class ActionTest extends \PHPUnit_Framework_TestCase
*/
protected $eavAttribute;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
public function setUp()
{
$eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface');
@@ -109,6 +114,8 @@ public function setUp()
'',
false
);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
$objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
$this->model = $objectManager->getObject(
'\Magento\Catalog\Model\Product\Action',
@@ -116,7 +123,7 @@ public function setUp()
'eventDispatcher' => $eventManagerMock,
'resource' => $this->resource,
'productWebsiteFactory' => $this->productWebsiteFactory,
- 'categoryIndexer' => $this->categoryIndexer,
+ 'indexerRegistry' => $this->indexerRegistryMock,
'eavConfig' => $this->eavConfig
]
);
@@ -134,15 +141,6 @@ public function testUpdateAttributes()
->with($productIds, $attrData, $storeId)
->will($this->returnSelf());
- $this->categoryIndexer
- ->expects($this->any())
- ->method('getId')
- ->will($this->returnValue(false));
- $this->categoryIndexer
- ->expects($this->any())
- ->method('load')
- ->with('catalog_product_category')
- ->will($this->returnSelf());
$this->categoryIndexer
->expects($this->any())
->method('isScheduled')
@@ -151,6 +149,7 @@ public function testUpdateAttributes()
->expects($this->any())
->method('reindexList')
->will($this->returnValue($productIds));
+ $this->prepareIndexer();
$this->eavConfig
->expects($this->any())
->method('getAttribute')
@@ -181,15 +180,6 @@ public function testUpdateWebsites($type, $methodName)
->with($websiteIds, $productIds)
->will($this->returnSelf());
- $this->categoryIndexer
- ->expects($this->any())
- ->method('getId')
- ->will($this->returnValue(false));
- $this->categoryIndexer
- ->expects($this->any())
- ->method('load')
- ->with('catalog_product_category')
- ->will($this->returnSelf());
$this->categoryIndexer
->expects($this->any())
->method('isScheduled')
@@ -198,6 +188,7 @@ public function testUpdateWebsites($type, $methodName)
->expects($this->any())
->method('reindexList')
->will($this->returnValue($productIds));
+ $this->prepareIndexer();
$this->model->updateWebsites($productIds, $websiteIds, $type);
$this->assertEquals($this->model->getDataByKey('product_ids'), $productIdsUnique);
$this->assertEquals($this->model->getDataByKey('website_ids'), $websiteIds);
@@ -211,4 +202,12 @@ public function updateWebsitesDataProvider()
['$type' => 'remove', '$methodName' => 'removeProducts']
];
}
+
+ protected function prepareIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
+ ->will($this->returnValue($this->categoryIndexer));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php
index edc76ac7c54e2..d769f281d8043 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php
@@ -43,8 +43,7 @@ public function testAfterLoad()
$this->returnValue('category_ids')
);
- $logger = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
- $model = new \Magento\Catalog\Model\Product\Attribute\Backend\Category($logger);
+ $model = new \Magento\Catalog\Model\Product\Attribute\Backend\Category();
$model->setAttribute($categoryAttribute);
$model->afterLoad($product);
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php
index a11d85e686c2b..e73a980a912c2 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php
@@ -42,7 +42,6 @@ protected function setUp()
$this->_helper = $this->getMock('Magento\Catalog\Helper\Data', array('isPriceGlobal'), array(), '', false);
$this->_helper->expects($this->any())->method('isPriceGlobal')->will($this->returnValue(true));
- $loggerMock = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
$currencyFactoryMock = $this->getMock('Magento\Directory\Model\CurrencyFactory', array(), array(), '', false);
$storeManagerMock = $this->getMock('Magento\Framework\StoreManagerInterface', array(), array(), '', false);
$productTypeMock = $this->getMock('Magento\Catalog\Model\Product\Type', array(), array(), '', false);
@@ -51,7 +50,6 @@ protected function setUp()
$this->_model = $this->getMockForAbstractClass(
'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice\AbstractGroupprice',
array(
- 'logger' => $loggerMock,
'currencyFactory' => $currencyFactoryMock,
'storeManager' => $storeManagerMock,
'catalogData' => $this->_helper,
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
index 6803d90bc60e8..30ac0a1b706e4 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
@@ -101,6 +101,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
*/
private $website;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
@@ -193,6 +198,7 @@ public function setUp()
$storeManager->expects($this->any())
->method('getWebsite')
->will($this->returnValue($this->website));
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->model = $this->objectManagerHelper->getObject(
@@ -200,7 +206,6 @@ public function setUp()
[
'context' => $contextMock,
'catalogProductType' => $this->productTypeInstanceMock,
- 'categoryIndexer' => $this->categoryIndexerMock,
'productFlatIndexerProcessor' => $this->productFlatProcessor,
'productPriceIndexerProcessor' => $this->productPriceProcessor,
'catalogProductOption' => $this->optionInstanceMock,
@@ -208,6 +213,7 @@ public function setUp()
'resource' => $this->resource,
'registry' => $this->registry,
'categoryFactory' => $this->categoryFactory,
+ 'indexerRegistry' => $this->indexerRegistryMock,
'data' => array('id' => 1)
]
);
@@ -318,6 +324,7 @@ public function testIndexerAfterDeleteCommitProduct()
$this->categoryIndexerMock->expects($this->once())->method('reindexRow');
$this->productFlatProcessor->expects($this->once())->method('reindexRow');
$this->productPriceProcessor->expects($this->once())->method('reindexRow');
+ $this->prepareCategoryIndexer();
$this->assertSame($this->model, $this->model->delete());
}
@@ -325,6 +332,7 @@ public function testReindex()
{
$this->categoryIndexerMock->expects($this->once())->method('reindexRow');
$this->productFlatProcessor->expects($this->once())->method('reindexRow');
+ $this->prepareCategoryIndexer();
$this->assertNull($this->model->reindex());
}
@@ -465,4 +473,12 @@ protected function configureSaveTest()
$this->model->getResource()->expects($this->any())->method('addCommitCallback')->will($this->returnSelf());
$this->model->getResource()->expects($this->any())->method('commit')->will($this->returnSelf());
}
+
+ protected function prepareCategoryIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
+ ->will($this->returnValue($this->categoryIndexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Plugin/Model/Resource/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Plugin/Model/Resource/ConfigTest.php
new file mode 100644
index 0000000000000..aee4e934944f9
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Plugin/Model/Resource/ConfigTest.php
@@ -0,0 +1,199 @@
+cache = $this->getMock('Magento\Framework\App\CacheInterface');
+ $this->cacheState = $this->getMock('Magento\Framework\App\Cache\StateInterface');
+ $this->subject = $this->getMock('Magento\Catalog\Model\Resource\Config', [], [], '', false);
+ }
+
+ public function testGetAttributesUsedInListingOnCacheDisabled()
+ {
+ $this->cache->expects($this->never())->method('load');
+
+ $this->assertEquals(
+ ['attributes'],
+ $this->getConfig(false)->aroundGetAttributesUsedInListing(
+ $this->subject,
+ $this->mockPluginProceed(['attributes'])
+ )
+ );
+ }
+
+ public function testGetAttributesUsedInListingFromCache()
+ {
+ $entityTypeId = 'type';
+ $storeId = 'store';
+ $attributes = ['attributes'];
+ $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+ $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+ $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $entityTypeId
+ . '_' . $storeId;
+ $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes));
+
+ $this->assertEquals(
+ $attributes,
+ $this->getConfig(true)->aroundGetAttributesUsedInListing(
+ $this->subject,
+ $this->mockPluginProceed()
+ )
+ );
+ }
+
+ public function testGetAttributesUsedInListingWithCacheSave()
+ {
+ $entityTypeId = 'type';
+ $storeId = 'store';
+ $attributes = ['attributes'];
+ $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+ $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+ $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $entityTypeId
+ . '_' . $storeId;
+ $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false);
+ $this->cache->expects($this->any())->method('save')->with(
+ serialize($attributes),
+ $cacheId,
+ [
+ \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+ \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+ ]
+ );
+
+ $this->assertEquals(
+ $attributes,
+ $this->getConfig(true)->aroundGetAttributesUsedInListing(
+ $this->subject,
+ $this->mockPluginProceed($attributes)
+ )
+ );
+ }
+
+ public function testGetAttributesUsedForSortByOnCacheDisabled()
+ {
+ $this->cache->expects($this->never())->method('load');
+
+ $this->assertEquals(
+ ['attributes'],
+ $this->getConfig(false)->aroundGetAttributesUsedForSortBy(
+ $this->subject,
+ $this->mockPluginProceed(['attributes'])
+ )
+ );
+ }
+
+ public function testGetAttributesUsedForSortByFromCache()
+ {
+ $entityTypeId = 'type';
+ $storeId = 'store';
+ $attributes = ['attributes'];
+ $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+ $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+ $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID
+ . $entityTypeId . '_' . $storeId;
+ $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes));
+
+ $this->assertEquals(
+ $attributes,
+ $this->getConfig(true)->aroundGetAttributesUsedForSortBy(
+ $this->subject,
+ $this->mockPluginProceed()
+ )
+ );
+ }
+
+ public function testGetAttributesUsedForSortByWithCacheSave()
+ {
+ $entityTypeId = 'type';
+ $storeId = 'store';
+ $attributes = ['attributes'];
+ $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+ $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+ $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID
+ . $entityTypeId . '_' . $storeId;
+ $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false);
+ $this->cache->expects($this->any())->method('save')->with(
+ serialize($attributes),
+ $cacheId,
+ [
+ \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+ \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+ ]
+ );
+
+ $this->assertEquals(
+ $attributes,
+ $this->getConfig(true)->aroundGetAttributesUsedForSortBy(
+ $this->subject,
+ $this->mockPluginProceed($attributes)
+ )
+ );
+ }
+
+ /**
+ * @param bool $cacheEnabledFlag
+ * @return \Magento\Catalog\Plugin\Model\Resource\Config
+ */
+ protected function getConfig($cacheEnabledFlag)
+ {
+ $this->cacheState->expects($this->any())->method('isEnabled')
+ ->with(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER)->willReturn($cacheEnabledFlag);
+ return (new ObjectManager($this))->getObject(
+ 'Magento\Catalog\Plugin\Model\Resource\Config',
+ [
+ 'cache' => $this->cache,
+ 'cacheState' => $this->cacheState
+ ]
+ );
+ }
+
+ /**
+ * @param mixed $returnValue
+ * @return callable
+ */
+ protected function mockPluginProceed($returnValue = null)
+ {
+ return function () use ($returnValue) {
+ return $returnValue;
+ };
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php
index 6b4218d093f74..3959cc47c8691 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php
@@ -34,7 +34,7 @@ class ProductBuilderTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Catalog\Service\V1\MetadataService */
private $_productMetadataService;
- /** @var \Magento\Framework\Api\AttributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder */
private $_valueBuilder;
protected function setUp()
@@ -57,7 +57,7 @@ protected function setUp()
)
);
$this->_valueBuilder = $this->_objectManager->getObject(
- 'Magento\Framework\Api\AttributeValueBuilder'
+ 'Magento\Framework\Api\AttributeDataBuilder'
);
$this->_productBuilder = $this->_objectManager->getObject(
'Magento\Catalog\Service\V1\Data\ProductBuilder',
diff --git a/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php b/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php
index 01cd873bcad46..4a30b74e6b7e3 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php
@@ -40,6 +40,11 @@ class ImportTest extends \PHPUnit_Framework_TestCase
*/
protected $_indexerMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
public function setUp()
{
$this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
@@ -51,17 +56,21 @@ public function setUp()
'',
false
);
- $this->_indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
$this->_model = $this->_objectManager->getObject(
'Magento\CatalogImportExport\Model\Indexer\Product\Price\Plugin\Import',
- array('indexer' => $this->_indexerMock)
+ array('indexerRegistry' => $this->indexerRegistryMock)
);
}
public function testAfterImportSource()
{
$this->_indexerMock->expects($this->once())->method('invalidate');
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
+ ->will($this->returnValue($this->_indexerMock));
$importMock = $this->getMock('Magento\ImportExport\Model\Import', array(), array(), '', false);
$this->assertEquals('return_value', $this->_model->afterImportSource($importMock, 'return_value'));
diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php
index d1a843d44b12a..f99ebeee9f99e 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php
@@ -496,28 +496,29 @@ public function testSaveStockItemBySku(
$this->stockItemRegistry->expects($this->any())->method('retrieve')
->will($this->returnValueMap([[$productId, $stockItem]]));
- $this->stockItemBuilder->expects($this->any())
- ->method('create')
- ->will($this->returnValue($stockItemDataObject));
-
$stockItemDetailsDo->expects($this->any())
->method('__toArray')
->will($this->returnValue($stockItemDetailsDoData));
- $this->stockItemBuilder->expects($this->any())
- ->method('mergeDataObjectWithArray')
- ->will($this->returnValue($stockItemDataObjectMerged));
-
$stockItemDataObjectMerged->expects($this->any())
->method('__toArray')
->will($this->returnValue($dataToSave));
// 3. Set expectations
$stockItem->expects($this->any())->method('setData')->with($dataToSave)->will($this->returnSelf());
- $this->stockItemBuilder->expects($this->any())
+ $this->stockItemBuilder->expects($this->at(0))
->method('populateWithArray')
->with($stockItemData)
->will($this->returnSelf());
+ $this->stockItemBuilder->expects($this->at(1))
+ ->method('create')
+ ->will($this->returnValue($stockItemDataObject));
+ $this->stockItemBuilder->expects($this->at(2))
+ ->method('mergeDataObjectWithArray')
+ ->will($this->returnValue($this->stockItemBuilder));
+ $this->stockItemBuilder->expects($this->at(3))
+ ->method('create')
+ ->will($this->returnValue($stockItemDataObjectMerged));
// 4. Run tested method
$result = $this->model->saveStockItemBySku($productSku, $stockItemDetailsDo);
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/CronTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/CronTest.php
new file mode 100644
index 0000000000000..6680b635a8976
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/CronTest.php
@@ -0,0 +1,57 @@
+ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+ [], [], '', false);
+
+ $this->cron = (new ObjectManager($this))->getObject('Magento\CatalogRule\Model\Cron', [
+ 'ruleProductProcessor' => $this->ruleProductProcessor,
+ ]);
+ }
+
+ public function testDailyCatalogUpdate()
+ {
+ $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+ $this->cron->dailyCatalogUpdate();
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/AbstractIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/AbstractIndexerTest.php
new file mode 100644
index 0000000000000..6a3f0d3e02474
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/AbstractIndexerTest.php
@@ -0,0 +1,97 @@
+indexBuilder = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+ $this->indexer = $this->getMockForAbstractClass(
+ 'Magento\CatalogRule\Model\Indexer\AbstractIndexer',
+ [$this->indexBuilder]
+ );
+ }
+
+ public function testExecute()
+ {
+ $ids = [1, 2, 5];
+ $this->indexer->expects($this->once())->method('doExecuteList')->with($ids);
+
+ $this->indexer->execute($ids);
+ }
+
+ public function testExecuteFull()
+ {
+ $this->indexBuilder->expects($this->once())->method('reindexFull');
+
+ $this->indexer->executeFull();
+ }
+
+ /**
+ * @expectedException \Magento\CatalogRule\CatalogRuleException
+ * @expectedExceptionMessage Could not rebuild index for empty products array
+ */
+ public function testExecuteListWithEmptyIds()
+ {
+ $this->indexer->executeList([]);
+ }
+
+ public function testExecuteList()
+ {
+ $ids = [1, 2, 5];
+ $this->indexer->expects($this->once())->method('doExecuteList')->with($ids);
+
+ $this->indexer->executeList($ids);
+ }
+
+ /**
+ * @expectedException \Magento\CatalogRule\CatalogRuleException
+ * @expectedExceptionMessage Could not rebuild index for undefined product
+ */
+ public function testExecuteRowWithEmptyId()
+ {
+ $this->indexer->executeRow(null);
+ }
+
+ public function testExecuteRow()
+ {
+ $id = 5;
+ $this->indexer->expects($this->once())->method('doExecuteRow')->with($id);
+
+ $this->indexer->executeRow($id);
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexerTest.php
new file mode 100644
index 0000000000000..ccc438ebffa4a
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexerTest.php
@@ -0,0 +1,88 @@
+indexBuilder = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+ $this->indexer = (new ObjectManager($this))->getObject(
+ 'Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer',
+ [
+ 'indexBuilder' => $this->indexBuilder,
+ ]
+ );
+ }
+ /**
+ * @param array $ids
+ * @param array $idsForIndexer
+ * @dataProvider dataProviderForExecuteList
+ */
+ public function testDoExecuteList($ids, $idsForIndexer)
+ {
+ $this->indexBuilder->expects($this->once())->method('reindexByIds')->with($idsForIndexer);
+
+ $this->indexer->executeList($ids);
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderForExecuteList()
+ {
+ return [
+ [
+ [1, 2, 3, 2, 3],
+ [1, 2, 3],
+ ],
+ [
+ [1, 2, 3],
+ [1, 2, 3],
+ ],
+ ];
+ }
+
+ public function testDoExecuteRow()
+ {
+ $id = 5;
+ $this->indexBuilder->expects($this->once())->method('reindexById')->with($id);
+
+ $this->indexer->executeRow($id);
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexerTest.php
new file mode 100644
index 0000000000000..5e71cbe9ffa65
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexerTest.php
@@ -0,0 +1,66 @@
+indexBuilder = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+ $this->indexer = (new ObjectManager($this))->getObject(
+ 'Magento\CatalogRule\Model\Indexer\Rule\RuleProductIndexer',
+ [
+ 'indexBuilder' => $this->indexBuilder,
+ ]
+ );
+ }
+
+ public function testDoExecuteList()
+ {
+ $this->indexBuilder->expects($this->once())->method('reindexFull');
+
+ $this->indexer->executeList([1, 2, 5]);
+ }
+
+ public function testDoExecuteRow()
+ {
+ $this->indexBuilder->expects($this->once())->method('reindexFull');
+
+ $this->indexer->executeRow(5);
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php
index 95ffddf34d3ed..b76cfac92896a 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php
@@ -58,7 +58,8 @@ protected function setUp()
'getData',
'getId',
'getStoreId',
- 'getResource'
+ 'getResource',
+ 'addAttributeToSelect',
),
array(),
'',
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php
index a169032d5b704..8cb2e927033db 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php
@@ -28,21 +28,45 @@ class JobTest extends \PHPUnit_Framework_TestCase
/**
* Test for method applyAll
*
- * Checks that dispatch event with param value "catalogrule_apply_all" runs while applying all rules
+ * Checks that invalidate Rule indexer
+ *
+ * @return void
*/
public function testApplyAll()
{
- $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
-
- $eventManager = $this->getMock('Magento\Framework\Event\ManagerInterface', array(), array(), '', false);
- $eventManager->expects($this->once())->method('dispatch')->with($this->equalTo('catalogrule_apply_all'));
-
- /** @var $jobModel \Magento\CatalogRule\Model\Rule\Job */
- $jobModel = $objectManagerHelper->getObject(
- 'Magento\CatalogRule\Model\Rule\Job',
- array('eventManager' => $eventManager)
+ $ruleProcessorMock = $this->getMock(
+ 'Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+ ['markIndexerAsInvalid'],
+ [],
+ '',
+ false
);
+ $ruleProcessorMock->expects($this->once())->method('markIndexerAsInvalid');
+ $jobModel = new Job($ruleProcessorMock);
+ $jobModel->applyAll();
+ }
+ /**
+ * @return void
+ */
+ public function testExceptionApplyAll()
+ {
+ $ruleProcessorMock = $this->getMock(
+ 'Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+ ['markIndexerAsInvalid'],
+ [],
+ '',
+ false
+ );
+ $exceptionMessage = 'Test exception message';
+ $exceptionCallback = function () use ($exceptionMessage) {
+ throw new \Magento\Framework\Model\Exception($exceptionMessage);
+ };
+ $ruleProcessorMock->expects($this->once())
+ ->method('markIndexerAsInvalid')
+ ->will($this->returnCallback($exceptionCallback));
+ $jobModel = new Job($ruleProcessorMock);
$jobModel->applyAll();
+ $this->assertEquals($exceptionMessage, $jobModel->getError());
}
}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CategoryTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CategoryTest.php
new file mode 100644
index 0000000000000..cea3a53a36d59
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CategoryTest.php
@@ -0,0 +1,81 @@
+productRuleProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor',
+ [], [], '', false);
+ $this->subject = $this->getMock('Magento\Catalog\Model\Category', ['getAffectedProductIds', '__wakeUp'], [],
+ '', false);
+
+ $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\Category', [
+ 'productRuleProcessor' => $this->productRuleProcessor,
+ ]);
+ }
+
+ public function testAfterSaveWithoutAffectedProductIds()
+ {
+ $this->subject->expects($this->any())->method('getAffectedProductIds')->will($this->returnValue([]));
+ $this->productRuleProcessor->expects($this->never())->method('reindexList');
+
+ $this->assertEquals($this->subject, $this->plugin->afterSave($this->subject, $this->subject));
+ }
+
+ public function testAfterSave()
+ {
+ $productIds = [1, 2, 3];
+
+ $this->subject->expects($this->any())->method('getAffectedProductIds')->will($this->returnValue($productIds));
+ $this->productRuleProcessor->expects($this->once())->method('reindexList')->with($productIds);
+
+ $this->assertEquals($this->subject, $this->plugin->afterSave($this->subject, $this->subject));
+ }
+
+ public function testAfterDelete()
+ {
+ $this->productRuleProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+ $this->assertEquals($this->subject, $this->plugin->afterDelete($this->subject, $this->subject));
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CustomerGroupTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CustomerGroupTest.php
new file mode 100644
index 0000000000000..ee9ab84ffad8a
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CustomerGroupTest.php
@@ -0,0 +1,62 @@
+ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+ [], [], '', false);
+ $this->subject = $this->getMock('Magento\Customer\Model\Group', [], [], '', false);
+
+ $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\CustomerGroup', [
+ 'ruleProductProcessor' => $this->ruleProductProcessor,
+ ]);
+ }
+
+ public function testAfterDelete()
+ {
+ $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+ $this->assertEquals($this->subject, $this->plugin->afterDelete($this->subject, $this->subject));
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/ImportExportTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/ImportExportTest.php
new file mode 100644
index 0000000000000..ed16297c09636
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/ImportExportTest.php
@@ -0,0 +1,64 @@
+ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+ [], [], '', false);
+ $this->subject = $this->getMock('Magento\ImportExport\Model\Import', [], [], '', false);
+
+ $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\ImportExport', [
+ 'ruleProductProcessor' => $this->ruleProductProcessor,
+ ]);
+ }
+
+ public function testAfterImportSource()
+ {
+ $result = true;
+
+ $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+ $this->assertEquals($result, $this->plugin->afterImportSource($this->subject, $result));
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexerTest.php
new file mode 100644
index 0000000000000..fbb9194b94f0c
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexerTest.php
@@ -0,0 +1,90 @@
+priceProcessor = $this->getMock(
+ 'Magento\Catalog\Model\Indexer\Product\Price\Processor',
+ [],
+ [],
+ '',
+ false
+ );
+ $this->subject = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+ $this->plugin = (new ObjectManager($this))->getObject(
+ 'Magento\CatalogRule\Plugin\Indexer\Product\PriceIndexer',
+ [
+ 'priceProcessor' => $this->priceProcessor,
+ ]
+ );
+ }
+
+ public function testAfterSaveWithoutAffectedProductIds()
+ {
+ $this->priceProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+ $this->plugin->afterReindexFull($this->subject, $this->subject);
+ }
+
+ public function testReindexRow()
+ {
+ $productIds = [1,2,3];
+ $proceed = function () {
+ return;
+ };
+ $this->priceProcessor->expects($this->once())->method('reindexList')->with($productIds);
+ $this->plugin->aroundReindexByIds($this->subject, $proceed, $productIds);
+ }
+
+ public function testReindexRows()
+ {
+ $productId = 1;
+ $this->priceProcessor->expects($this->once())->method('reindexRow')->with($productId);
+ $proceed = function () {
+ return;
+ };
+ $this->plugin->aroundReindexById($this->subject, $proceed, $productId);
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/WebsiteTest.php
new file mode 100644
index 0000000000000..7f7657f5f965b
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/WebsiteTest.php
@@ -0,0 +1,62 @@
+ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+ [], [], '', false);
+ $this->subject = $this->getMock('Magento\Store\Model\Website', [], [], '', false);
+
+ $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\Website', [
+ 'ruleProductProcessor' => $this->ruleProductProcessor,
+ ]);
+ }
+
+ public function testAfterDelete()
+ {
+ $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+ $this->assertEquals($this->subject, $this->plugin->afterDelete($this->subject, $this->subject));
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php
index 3b63d00e22044..73eaa529d4ffe 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php
@@ -35,6 +35,11 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
*/
protected $subjectMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var Attribute
*/
@@ -52,7 +57,8 @@ protected function setUp()
true,
['getId', 'getState', '__wakeup']
);
- $this->model = new Attribute($this->indexerMock);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+ $this->model = new Attribute($this->indexerRegistryMock);
}
/**
@@ -82,8 +88,8 @@ public function testAroundSave($isObjectNew, $isSearchableChanged, $invalidateCo
return $this->subjectMock;
};
- $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+ $this->prepareIndexer($invalidateCounter);
$this->assertEquals(
$this->subjectMock,
@@ -128,8 +134,8 @@ public function testAroundDelete($isObjectNew, $isSearchable, $invalidateCounter
return $this->subjectMock;
};
- $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+ $this->prepareIndexer($invalidateCounter);
$this->assertEquals(
$this->subjectMock,
@@ -149,4 +155,15 @@ public function aroundDeleteDataProvider()
[true, true, 0],
];
}
+
+ /**
+ * @param $invalidateCounter
+ */
+ protected function prepareIndexer($invalidateCounter)
+ {
+ $this->indexerRegistryMock->expects($this->exactly($invalidateCounter))
+ ->method('get')
+ ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php
index 62262f4d2387d..320f3ccfca68b 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php
@@ -38,6 +38,11 @@ class ActionTest extends \PHPUnit_Framework_TestCase
*/
protected $subjectMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var Action
*/
@@ -56,15 +61,16 @@ protected function setUp()
true,
array('getId', 'getState', '__wakeup')
);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
- $this->model = new Action($this->indexerMock);
+ $this->model = new Action($this->indexerRegistryMock);
}
public function testAroundUpdateAttributesNonScheduled()
{
- $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
$this->indexerMock->expects($this->once())->method('reindexList')->with(array(1, 2, 3));
+ $this->prepareIndexer();
$closureMock = function ($productIds, $attrData, $storeId) {
$this->assertEquals(array(1, 2, 3), $productIds);
@@ -81,9 +87,9 @@ public function testAroundUpdateAttributesNonScheduled()
public function testAroundUpdateAttributesScheduled()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
$this->indexerMock->expects($this->never())->method('reindexList');
+ $this->prepareIndexer();
$closureMock = function ($productIds, $attrData, $storeId) {
$this->assertEquals(array(1, 2, 3), $productIds);
@@ -100,9 +106,9 @@ public function testAroundUpdateAttributesScheduled()
public function testAroundUpdateWebsitesNonScheduled()
{
- $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
$this->indexerMock->expects($this->once())->method('reindexList')->with(array(1, 2, 3));
+ $this->prepareIndexer();
$closureMock = function ($productIds, $websiteIds, $type) {
$this->assertEquals(array(1, 2, 3), $productIds);
@@ -116,9 +122,9 @@ public function testAroundUpdateWebsitesNonScheduled()
public function testAroundUpdateWebsitesScheduled()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
$this->indexerMock->expects($this->never())->method('reindexList');
+ $this->prepareIndexer();
$closureMock = function ($productIds, $websiteIds, $type) {
$this->assertEquals(array(1, 2, 3), $productIds);
@@ -129,4 +135,12 @@ public function testAroundUpdateWebsitesScheduled()
$this->model->aroundUpdateWebsites($this->subjectMock, $closureMock, array(1, 2, 3), array(4, 5, 6), 'type');
}
+
+ protected function prepareIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php
index 14f65c8d4e4fe..636d013684c1f 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php
@@ -38,6 +38,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
*/
protected $subjectMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var Product
*/
@@ -57,14 +62,16 @@ protected function setUp()
array('getId', 'getState', '__wakeup')
);
- $this->model = new Product($this->indexerMock);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+ $this->model = new Product($this->indexerRegistryMock);
}
public function testAfterSaveNonScheduled()
{
- $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
$this->indexerMock->expects($this->once())->method('reindexRow')->with(1);
+ $this->prepareIndexer();
$this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
@@ -73,9 +80,9 @@ public function testAfterSaveNonScheduled()
public function testAfterSaveScheduled()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
$this->indexerMock->expects($this->never())->method('reindexRow');
+ $this->prepareIndexer();
$this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
@@ -84,9 +91,9 @@ public function testAfterSaveScheduled()
public function testAfterDeleteNonScheduled()
{
- $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
$this->indexerMock->expects($this->once())->method('reindexRow')->with(1);
+ $this->prepareIndexer();
$this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
@@ -95,12 +102,20 @@ public function testAfterDeleteNonScheduled()
public function testAfterDeleteScheduled()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
$this->indexerMock->expects($this->never())->method('reindexRow');
+ $this->prepareIndexer();
$this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->assertEquals($this->subjectMock, $this->model->afterDelete($this->subjectMock));
}
+
+ protected function prepareIndexer()
+ {
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php
index cadbac0a0aaaa..b7fbc93277a62 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php
@@ -35,6 +35,11 @@ class GroupTest extends \PHPUnit_Framework_TestCase
*/
protected $subjectMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var Group
*/
@@ -52,7 +57,8 @@ protected function setUp()
true,
['getId', 'getState', '__wakeup']
);
- $this->model = new Group($this->indexerMock);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+ $this->model = new Group($this->indexerRegistryMock);
}
/**
@@ -82,8 +88,8 @@ public function testAroundSave($isObjectNew, $websiteChanged, $invalidateCounter
return $this->subjectMock;
};
- $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+ $this->prepareIndexer($invalidateCounter);
$this->assertEquals(
$this->subjectMock,
@@ -109,12 +115,23 @@ public function aroundSaveDataProvider()
*/
public function testAfterDelete()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('invalidate');
+ $this->prepareIndexer(1);
$this->assertEquals(
$this->subjectMock,
$this->model->afterDelete($this->subjectMock, $this->subjectMock)
);
}
+
+ /**
+ * @param int $invalidateCounter
+ */
+ protected function prepareIndexer($invalidateCounter)
+ {
+ $this->indexerRegistryMock->expects($this->exactly($invalidateCounter))
+ ->method('get')
+ ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php
index d8235f922d678..9b892621f0ee5 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php
@@ -35,6 +35,11 @@ class ViewTest extends \PHPUnit_Framework_TestCase
*/
protected $subjectMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
/**
* @var View
*/
@@ -52,7 +57,8 @@ protected function setUp()
true,
['getId', 'getState', '__wakeup']
);
- $this->model = new View($this->indexerMock);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+ $this->model = new View($this->indexerRegistryMock);
}
/**
@@ -77,8 +83,8 @@ public function testAroundSave($isObjectNew, $invalidateCounter)
return $this->subjectMock;
};
- $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+ $this->prepareIndexer($invalidateCounter);
$this->assertEquals(
$this->subjectMock,
@@ -102,12 +108,23 @@ public function aroundSaveDataProvider()
*/
public function testAfterDelete()
{
- $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
$this->indexerMock->expects($this->once())->method('invalidate');
+ $this->prepareIndexer(1);
$this->assertEquals(
$this->subjectMock,
$this->model->afterDelete($this->subjectMock, $this->subjectMock)
);
}
+
+ /**
+ * @param int $invalidateCounter
+ */
+ protected function prepareIndexer($invalidateCounter)
+ {
+ $this->indexerRegistryMock->expects($this->exactly($invalidateCounter))
+ ->method('get')
+ ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php
index 2018abe258a62..aac6c01dac918 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php
@@ -45,6 +45,11 @@ class FulltextTest extends \PHPUnit_Framework_TestCase
*/
protected $indexerMock;
+ /**
+ * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $indexerRegistryMock;
+
protected function setUp()
{
$this->fullMock = $this->getMock(
@@ -73,10 +78,12 @@ protected function setUp()
array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
);
+ $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
$this->model = new \Magento\CatalogSearch\Model\Indexer\Fulltext(
$this->fullMock,
$this->rowsMock,
- $this->indexerMock
+ $this->indexerRegistryMock
);
}
@@ -84,15 +91,10 @@ public function testExecuteWithIndexer()
{
$ids = array(1, 2, 3);
- $this->indexerMock->expects(
- $this->once()
- )->method(
- 'load'
- )->with(
- \Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID
- )->will(
- $this->returnSelf()
- );
+ $this->indexerRegistryMock->expects($this->once())
+ ->method('get')
+ ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+ ->will($this->returnValue($this->indexerMock));
$rowMock = $this->getMock(
'Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Rows',
diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
index 83be2df63c1f7..63644bbb2ae7c 100644
--- a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
+++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
@@ -399,6 +399,7 @@ public function testSaveBilling(
$addressMock->expects($this->any())->method('getData')->will($this->returnValue([]));
$quoteMock->expects($this->any())->method('getBillingAddress')->will($this->returnValue($addressMock));
$quoteMock->expects($this->any())->method('getCustomerId')->will($this->returnValue($quoteCustomerId));
+ $quoteMock->expects($this->once())->method('save');
$formMock = $this->getMock('Magento\Customer\Model\Metadata\Form', [], [], '', false);
$formMock->expects($this->atLeastOnce())->method('validateData')->will($this->returnValue($validateDataResult));
$this->requestMock
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/EditTest.php b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/EditTest.php
new file mode 100644
index 0000000000000..07d483b5dcf94
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/EditTest.php
@@ -0,0 +1,115 @@
+registryMock = $this->getMockBuilder('Magento\Framework\Registry')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->escaperMock = $this->getMockBuilder('Magento\Framework\Escaper')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->modelBlockMock = $this->getMockBuilder('Magento\Cms\Model\Block')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'getId',
+ 'getTitle'
+ ]
+ )
+ ->getMock();
+
+ $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+ $this->this = $objectManager->getObject(
+ 'Magento\Cms\Block\Adminhtml\Block\Edit',
+ [
+ 'registry' => $this->registryMock,
+ 'escaper' => $this->escaperMock
+ ]
+ );
+ }
+
+ /**
+ * @covers \Magento\Cms\Block\Adminhtml\Block\Edit::getHeaderText
+ * @param integer|null $modelBlockId
+ *
+ * @dataProvider getHeaderTextDataProvider
+ */
+ public function testGetHeaderText($modelBlockId)
+ {
+ $title = 'some title';
+ $escapedTitle = 'escaped title';
+
+ $this->registryMock->expects($this->atLeastOnce())
+ ->method('registry')
+ ->with('cms_block')
+ ->willReturn($this->modelBlockMock);
+ $this->modelBlockMock->expects($this->atLeastOnce())
+ ->method('getId')
+ ->willReturn($modelBlockId);
+ $this->modelBlockMock->expects($this->any())
+ ->method('getTitle')
+ ->willReturn($title);
+ $this->escaperMock->expects($this->any())
+ ->method('escapeHtml')
+ ->with($title)
+ ->willReturn($escapedTitle);
+
+ $this->assertInternalType('string', $this->this->getHeaderText());
+ }
+
+ public function getHeaderTextDataProvider()
+ {
+ return [
+ 'modelBlockId NOT EMPTY' => ['modelBlockId' => 1],
+ 'modelBlockId IS EMPTY' => ['modelBlockId' => null]
+ ];
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/Widget/ChooserTest.php b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/Widget/ChooserTest.php
new file mode 100644
index 0000000000000..f78e828d2b36f
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/Widget/ChooserTest.php
@@ -0,0 +1,265 @@
+layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->mathRandomMock = $this->getMockBuilder('Magento\Framework\Math\Random')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->urlBuilderMock = $this->getMockBuilder('Magento\Framework\UrlInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->blockFactoryMock = $this->getMockBuilder('Magento\Cms\Model\BlockFactory')
+ ->setMethods(
+ [
+ 'create'
+ ]
+ )
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->elementMock = $this->getMockBuilder('Magento\Framework\Data\Form\Element\AbstractElement')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'getId',
+ 'getValue',
+ 'setData'
+ ]
+ )
+ ->getMock();
+ $this->modelBlockMock = $this->getMockBuilder('Magento\Cms\Model\Block')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'getTitle',
+ 'load'
+ ]
+ )
+ ->getMock();
+ $this->chooserMock = $this->getMockBuilder('Magento\Framework\View\Element\BlockInterface')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'setElement',
+ 'setConfig',
+ 'setFieldsetId',
+ 'setSourceUrl',
+ 'setUniqId',
+ 'setLabel',
+ 'toHtml'
+ ]
+ )
+ ->getMock();
+
+ $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+ $this->context = $objectManager->getObject(
+ 'Magento\Backend\Block\Template\Context',
+ [
+ 'layout' => $this->layoutMock,
+ 'mathRandom' => $this->mathRandomMock,
+ 'urlBuilder' => $this->urlBuilderMock
+ ]
+ );
+ $this->this = $objectManager->getObject(
+ 'Magento\Cms\Block\Adminhtml\Block\Widget\Chooser',
+ [
+ 'context' => $this->context,
+ 'blockFactory' => $this->blockFactoryMock
+ ]
+ );
+ }
+
+ /**
+ * @covers \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser::prepareElementHtml
+ * @param string $elementValue
+ * @param integer|null $modelBlockId
+ *
+ * @dataProvider prepareElementHtmlDataProvider
+ */
+ public function testPrepareElementHtml($elementValue, $modelBlockId)
+ {
+ $elementId = 1;
+ $uniqId = '126hj4h3j73hk7b347jhkl37gb34';
+ $sourceUrl = 'cms/block_widget/chooser/126hj4h3j73hk7b347jhkl37gb34';
+ $config = ['key1' => 'value1'];
+ $fieldsetId = 2;
+ $html = 'some html';
+ $title = 'some title';
+
+ $this->this->setConfig($config);
+ $this->this->setFieldsetId($fieldsetId);
+
+ $this->elementMock->expects($this->atLeastOnce())
+ ->method('getId')
+ ->willReturn($elementId);
+ $this->mathRandomMock->expects($this->atLeastOnce())
+ ->method('getUniqueHash')
+ ->with($elementId)
+ ->willReturn($uniqId);
+ $this->urlBuilderMock->expects($this->atLeastOnce())
+ ->method('getUrl')
+ ->with('cms/block_widget/chooser', ['uniq_id' => $uniqId])
+ ->willReturn($sourceUrl);
+ $this->layoutMock->expects($this->atLeastOnce())
+ ->method('createBlock')
+ ->with('Magento\Widget\Block\Adminhtml\Widget\Chooser')
+ ->willReturn($this->chooserMock);
+ $this->chooserMock->expects($this->atLeastOnce())
+ ->method('setElement')
+ ->with($this->elementMock)
+ ->willReturnSelf();
+ $this->chooserMock->expects($this->atLeastOnce())
+ ->method('setConfig')
+ ->with($config)
+ ->willReturnSelf();
+ $this->chooserMock->expects($this->atLeastOnce())
+ ->method('setFieldsetId')
+ ->with($fieldsetId)
+ ->willReturnSelf();
+ $this->chooserMock->expects($this->atLeastOnce())
+ ->method('setSourceUrl')
+ ->with($sourceUrl)
+ ->willReturnSelf();
+ $this->chooserMock->expects($this->atLeastOnce())
+ ->method('setUniqId')
+ ->with($uniqId)
+ ->willReturnSelf();
+ $this->elementMock->expects($this->atLeastOnce())
+ ->method('getValue')
+ ->willReturn($elementValue);
+ $this->blockFactoryMock->expects($this->any())
+ ->method('create')
+ ->willReturn($this->modelBlockMock);
+ $this->modelBlockMock->expects($this->any())
+ ->method('load')
+ ->with($elementValue)
+ ->willReturnSelf();
+ $this->modelBlockMock->expects($this->any())
+ ->method('getId')
+ ->willReturn($modelBlockId);
+ $this->modelBlockMock->expects($this->any())
+ ->method('getTitle')
+ ->willReturn($title);
+ $this->chooserMock->expects($this->any())
+ ->method('setLabel')
+ ->with($title)
+ ->willReturnSelf();
+ $this->chooserMock->expects($this->atLeastOnce())
+ ->method('toHtml')
+ ->willReturn($html);
+ $this->elementMock->expects($this->atLeastOnce())
+ ->method('setData')
+ ->with('after_element_html', $html)
+ ->willReturnSelf();
+
+ $this->assertEquals($this->elementMock, $this->this->prepareElementHtml($this->elementMock));
+ }
+
+ public function prepareElementHtmlDataProvider()
+ {
+ return [
+ 'elementValue NOT EMPTY, modelBlockId NOT EMPTY' => [
+ 'elementValue' => 'some value',
+ 'modelBlockId' => 1
+ ],
+ 'elementValue NOT EMPTY, modelBlockId IS EMPTY' => [
+ 'elementValue' => 'some value',
+ 'modelBlockId' => null
+ ],
+ 'elementValue IS EMPTY, modelBlockId NEVER REACHED' => [
+ 'elementValue' => '',
+ 'modelBlockId' => 1
+ ]
+ ];
+ }
+
+ /**
+ * @covers \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser::getGridUrl
+ */
+ public function testGetGridUrl()
+ {
+ $url = 'some url';
+
+ $this->urlBuilderMock->expects($this->atLeastOnce())
+ ->method('getUrl')
+ ->with('cms/block_widget/chooser', ['_current' => true])
+ ->willReturn($url);
+
+ $this->assertEquals($url, $this->this->getGridUrl());
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Helper/PageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Helper/PageTest.php
new file mode 100644
index 0000000000000..b09ffb1d7e265
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Helper/PageTest.php
@@ -0,0 +1,550 @@
+actionMock = $this->getMockBuilder('Magento\Framework\App\Action\Action')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->pageFactoryMock = $this->getMockBuilder('Magento\Cms\Model\PageFactory')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'create'
+ ]
+ )
+ ->getMock();
+ $this->pageMock = $this->getMockBuilder('Magento\Cms\Model\Page')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'getId',
+ 'setStoreId',
+ 'load',
+ 'getCustomThemeFrom',
+ 'getCustomThemeTo',
+ 'getCustomTheme',
+ 'getPageLayout',
+ 'getIdentifier',
+ 'getCustomPageLayout',
+ 'getCustomLayoutUpdateXml',
+ 'getLayoutUpdateXml',
+ 'getContentHeading'
+ ]
+ )
+ ->getMock();
+ $this->storeManagerMock = $this->getMockBuilder('Magento\Framework\StoreManagerInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->localeDateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\TimezoneInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->designMock = $this->getMockBuilder('Magento\Framework\View\DesignInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->pageConfigMock = $this->getMockBuilder('Magento\Framework\View\Page\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->viewMock = $this->getMockBuilder('Magento\Framework\App\ViewInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->escaperMock = $this->getMockBuilder('Magento\Framework\Escaper')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->urlBuilderMock = $this->getMockBuilder('Magento\Framework\UrlInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->storeMock = $this->getMockBuilder('Magento\Store\Model\Store')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->resultPageMock = $this->getMockBuilder('Magento\Framework\View\Result\Page')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->layoutProcessorMock = $this->getMockBuilder('Magento\Framework\View\Layout\ProcessorInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->blockMock = $this->getMockBuilder('Magento\Framework\View\Element\BlockInterface')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'setContentHeading',
+ 'toHtml'
+ ]
+ )
+ ->getMock();
+ $this->messagesBlockMock = $this->getMockBuilder('Magento\Framework\View\Element\Messages')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->messageManagerMock = $this->getMockBuilder('Magento\Framework\Message\ManagerInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->messageCollectionMock = $this->getMockBuilder('Magento\Framework\Message\Collection')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+ $this->context = $objectManager->getObject(
+ 'Magento\Framework\App\Helper\Context',
+ [
+ 'eventManager' => $this->eventManagerMock,
+ 'urlBuilder' => $this->urlBuilderMock
+ ]
+ );
+ $this->this = $objectManager->getObject(
+ 'Magento\Cms\Helper\Page',
+ [
+ 'context' => $this->context,
+ 'pageFactory' => $this->pageFactoryMock,
+ 'page' => $this->pageMock,
+ 'storeManager' => $this->storeManagerMock,
+ 'localeDate' => $this->localeDateMock,
+ 'design' => $this->designMock,
+ 'pageConfig' => $this->pageConfigMock,
+ 'view' => $this->viewMock,
+ 'escaper' => $this->escaperMock,
+ 'messageManager' => $this->messageManagerMock
+ ]
+ );
+ }
+
+ /**
+ * @covers \Magento\Cms\Helper\Page::renderPageExtended
+ * @param integer|null $pageId
+ * @param integer|null $internalPageId
+ * @param integer $pageLoadResultIndex
+ * @param string $customPageLayout
+ * @param string $handle
+ * @param string $customLayoutUpdateXml
+ * @param string $layoutUpdate
+ * @param boolean $expectedResult
+ *
+ * @dataProvider renderPageExtendedDataProvider
+ */
+ public function testRenderPageExtended(
+ $pageId,
+ $internalPageId,
+ $pageLoadResultIndex,
+ $customPageLayout,
+ $handle,
+ $customLayoutUpdateXml,
+ $layoutUpdate,
+ $expectedResult
+ ) {
+ $storeId = 321;
+ $customThemeFrom = 'customThemeFrom';
+ $customThemeTo = 'customThemeTo';
+ $isScopeDateInInterval = true;
+ $customTheme = 'customTheme';
+ $pageLayout = 'pageLayout';
+ $pageIdentifier = 111;
+ $layoutUpdateXml = 'layoutUpdateXml';
+ $contentHeading = 'contentHeading';
+ $escapedContentHeading = 'escapedContentHeading';
+ $defaultGroup = 'defaultGroup';
+ $pageLoadResultCollection = [
+ null,
+ $this->pageMock
+ ];
+
+ $this->pageMock->expects($this->any())
+ ->method('getId')
+ ->willReturn($internalPageId);
+ $this->storeManagerMock->expects($this->any())
+ ->method('getStore')
+ ->willReturn($this->storeMock);
+ $this->storeMock->expects($this->any())
+ ->method('getId')
+ ->willReturn($storeId);
+ $this->pageMock->expects($this->any())
+ ->method('setStoreId')
+ ->with($storeId)
+ ->willReturnSelf();
+ $this->pageMock->expects($this->any())
+ ->method('load')
+ ->with($pageId)
+ ->willReturn($pageLoadResultCollection[$pageLoadResultIndex]);
+ $this->pageMock->expects($this->any())
+ ->method('getCustomThemeFrom')
+ ->willReturn($customThemeFrom);
+ $this->pageMock->expects($this->any())
+ ->method('getCustomThemeTo')
+ ->willReturn($customThemeTo);
+ $this->localeDateMock->expects($this->any())
+ ->method('isScopeDateInInterval')
+ ->with(null, $customThemeFrom, $customThemeTo)
+ ->willReturn($isScopeDateInInterval);
+ $this->pageMock->expects($this->any())
+ ->method('getCustomTheme')
+ ->willReturn($customTheme);
+ $this->designMock->expects($this->any())
+ ->method('setDesignTheme')
+ ->with($customTheme)
+ ->willReturnSelf();
+ $this->pageMock->expects($this->any())
+ ->method('getPageLayout')
+ ->willReturn($pageLayout);
+ $this->pageMock->expects($this->any())
+ ->method('getCustomPageLayout')
+ ->willReturn($customPageLayout);
+ $this->resultPageMock->expects($this->any())
+ ->method('getConfig')
+ ->willReturn($this->pageConfigMock);
+ $this->pageConfigMock->expects($this->any())
+ ->method('setPageLayout')
+ ->with($handle)
+ ->willReturnSelf();
+ $this->viewMock->expects($this->any())
+ ->method('getPage')
+ ->willReturn($this->resultPageMock);
+ $this->resultPageMock->expects($this->any())
+ ->method('initLayout')
+ ->willReturnSelf();
+ $this->resultPageMock->expects($this->any())
+ ->method('getLayout')
+ ->willReturn($this->layoutMock);
+ $this->layoutMock->expects($this->any())
+ ->method('getUpdate')
+ ->willReturn($this->layoutProcessorMock);
+ $this->layoutProcessorMock->expects($this->any())
+ ->method('addHandle')
+ ->with('cms_page_view')
+ ->willReturnSelf();
+ $this->pageMock->expects($this->any())
+ ->method('getIdentifier')
+ ->willReturn($pageIdentifier);
+ $this->viewMock->expects($this->any())
+ ->method('addPageLayoutHandles')
+ ->with(['id' => $pageIdentifier])
+ ->willReturn(true);
+ $this->eventManagerMock->expects($this->any())
+ ->method('dispatch')
+ ->with(
+ 'cms_page_render',
+ [
+ 'page' => $this->pageMock,
+ 'controller_action' => $this->actionMock
+ ]
+ );
+ $this->viewMock->expects($this->any())
+ ->method('loadLayoutUpdates')
+ ->willReturnSelf();
+ $this->pageMock->expects($this->any())
+ ->method('getCustomLayoutUpdateXml')
+ ->willReturn($customLayoutUpdateXml);
+ $this->pageMock->expects($this->any())
+ ->method('getLayoutUpdateXml')
+ ->willReturn($layoutUpdateXml);
+ $this->layoutProcessorMock->expects($this->any())
+ ->method('addUpdate')
+ ->with($layoutUpdate)
+ ->willReturnSelf();
+ $this->viewMock->expects($this->any())
+ ->method('generateLayoutXml')
+ ->willReturnSelf();
+ $this->viewMock->expects($this->any())
+ ->method('generateLayoutBlocks')
+ ->willReturnSelf();
+ $this->layoutMock->expects($this->any())
+ ->method('getBlock')
+ ->with('page_content_heading')
+ ->willReturn($this->blockMock);
+ $this->pageMock->expects($this->any())
+ ->method('getContentHeading')
+ ->willReturn($contentHeading);
+ $this->escaperMock->expects($this->any())
+ ->method('escapeHtml')
+ ->with($contentHeading)
+ ->willReturn($escapedContentHeading);
+ $this->blockMock->expects($this->any())
+ ->method('setContentHeading')
+ ->with($escapedContentHeading)
+ ->willReturnSelf();
+ $this->layoutMock->expects($this->any())
+ ->method('getMessagesBlock')
+ ->willReturn($this->messagesBlockMock);
+ $this->messageManagerMock->expects($this->any())
+ ->method('getDefaultGroup')
+ ->willReturn($defaultGroup);
+ $this->messagesBlockMock->expects($this->any())
+ ->method('addStorageType')
+ ->with($defaultGroup);
+ $this->messageManagerMock->expects($this->any())
+ ->method('getMessages')
+ ->with(true)
+ ->willReturn($this->messageCollectionMock);
+ $this->messagesBlockMock->expects($this->any())
+ ->method('addMessages')
+ ->with($this->messageCollectionMock)
+ ->willReturnSelf();
+ $this->viewMock->expects($this->any())
+ ->method('renderLayout')
+ ->willReturnSelf();
+
+ $this->assertEquals(
+ $expectedResult,
+ $this->this->renderPageExtended($this->actionMock, $pageId)
+ );
+ }
+
+ public function renderPageExtendedDataProvider()
+ {
+ return [
+ 'ids NOT EQUAL BUT page->load() NOT SUCCESSFUL' => [
+ 'pageId' => 123,
+ 'internalPageId' => 234,
+ 'pageLoadResultIndex' => 0,
+ 'customPageLayout' => 'DOES NOT MATTER',
+ 'handle' => 'DOES NOT MATTER',
+ 'customLayoutUpdateXml' => 'DOES NOT MATTER',
+ 'layoutUpdate' => 'DOES NOT MATTER',
+ 'expectedResult' => false
+ ],
+ 'page->load IS SUCCESSFUL BUT internalPageId IS EMPTY' => [
+ 'pageId' => 123,
+ 'internalPageId' => null,
+ 'pageLoadResultIndex' => 1,
+ 'customPageLayout' => 'DOES NOT MATTER',
+ 'handle' => 'DOES NOT MATTER',
+ 'customLayoutUpdateXml' => 'DOES NOT MATTER',
+ 'layoutUpdate' => 'DOES NOT MATTER',
+ 'expectedResult' => false
+ ],
+ 'getPageLayout() AND getLayoutUpdateXml() ARE USED' => [
+ 'pageId' => 123,
+ 'internalPageId' => 234,
+ 'pageLoadResultIndex' => 1,
+ 'customPageLayout' => 'empty',
+ 'handle' => 'pageLayout',
+ 'customLayoutUpdateXml' => '',
+ 'layoutUpdate' => 'layoutUpdateXml',
+ 'expectedResult' => true
+ ],
+ 'getCustomPageLayout() AND getCustomLayoutUpdateXml() ARE USED' => [
+ 'pageId' => 123,
+ 'internalPageId' => 234,
+ 'pageLoadResultIndex' => 1,
+ 'customPageLayout' => 'customPageLayout',
+ 'handle' => 'customPageLayout',
+ 'customLayoutUpdateXml' => 'customLayoutUpdateXml',
+ 'layoutUpdate' => 'customLayoutUpdateXml',
+ 'expectedResult' => true
+ ]
+ ];
+ }
+
+ /**
+ * @covers \Magento\Cms\Helper\Page::getPageUrl
+ * @param integer|null $pageId
+ * @param integer|null $internalPageId
+ * @param integer $pageLoadResultIndex
+ * @param string|null $expectedResult
+ *
+ * @dataProvider getPageUrlDataProvider
+ */
+ public function testGetPageUrl(
+ $pageId,
+ $internalPageId,
+ $pageLoadResultIndex,
+ $expectedResult
+ ) {
+ $storeId = 321;
+ $pageIdentifier = 111;
+ $url = '/some/url';
+ $pageLoadResultCollection = [
+ null,
+ $this->pageMock
+ ];
+
+ $this->pageFactoryMock->expects($this->any())
+ ->method('create')
+ ->willReturn($this->pageMock);
+ $this->pageMock->expects($this->any())
+ ->method('getId')
+ ->willReturn($internalPageId);
+ $this->storeManagerMock->expects($this->any())
+ ->method('getStore')
+ ->willReturn($this->storeMock);
+ $this->storeMock->expects($this->any())
+ ->method('getId')
+ ->willReturn($storeId);
+ $this->pageMock->expects($this->any())
+ ->method('setStoreId')
+ ->with($storeId)
+ ->willReturnSelf();
+ $this->pageMock->expects($this->any())
+ ->method('load')
+ ->with($pageId)
+ ->willReturn($pageLoadResultCollection[$pageLoadResultIndex]);
+ $this->pageMock->expects($this->any())
+ ->method('getIdentifier')
+ ->willReturn($pageIdentifier);
+ $this->urlBuilderMock->expects($this->any())
+ ->method('getUrl')
+ ->with(null, ['_direct' => $pageIdentifier])
+ ->willReturn($url);
+
+ $this->assertEquals($expectedResult, $this->this->getPageUrl($pageId));
+ }
+
+ public function getPageUrlDataProvider()
+ {
+ return [
+ 'ids NOT EQUAL BUT page->load() NOT SUCCESSFUL' => [
+ 'pageId' => 123,
+ 'internalPageId' => 234,
+ 'pageLoadResultIndex' => 0,
+ 'expectedResult' => null
+ ],
+ 'page->load() IS SUCCESSFUL BUT internalId IS EMPTY' => [
+ 'pageId' => 123,
+ 'internalPageId' => null,
+ 'pageLoadResultIndex' => 1,
+ 'expectedResult' => null
+ ],
+ 'SUCCESS' => [
+ 'pageId' => 123,
+ 'internalPageId' => 234,
+ 'pageLoadResultIndex' => 1,
+ 'expectedResult' => '/some/url'
+ ]
+ ];
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/Config/Source/PageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/Config/Source/PageTest.php
new file mode 100644
index 0000000000000..60b841eb6d4c4
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/Config/Source/PageTest.php
@@ -0,0 +1,98 @@
+pageCollectionFactory = $this
+ ->getMockBuilder('Magento\Cms\Model\Resource\Page\CollectionFactory')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'create'
+ ]
+ )
+ ->getMock();
+ $this->pageCollection = $this
+ ->getMockBuilder('Magento\Cms\Model\Resource\Page\Collection')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+ $this->this = $objectManager->getObject(
+ 'Magento\Cms\Model\Config\Source\Page',
+ [
+ 'pageCollectionFactory' => $this->pageCollectionFactory
+ ]
+ );
+
+ $reflection = new \ReflectionClass($this->this);
+ $mathRandomProperty = $reflection->getProperty('_options');
+ $mathRandomProperty->setAccessible(true);
+ $mathRandomProperty->setValue($this->this, null);
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Config\Source\Page::toOptionArray
+ */
+ public function testToOptionArray()
+ {
+ $resultOptions = ['val1' => 'val2'];
+
+ $this->pageCollectionFactory
+ ->expects($this->atLeastOnce())
+ ->method('create')
+ ->willReturn($this->pageCollection);
+ $this->pageCollection
+ ->expects($this->atLeastOnce())
+ ->method('load')
+ ->willReturnSelf();
+ $this->pageCollection
+ ->expects($this->atLeastOnce())
+ ->method('toOptionIdArray')
+ ->willReturn($resultOptions);
+
+ $this->assertEquals($resultOptions, $this->this->toOptionArray());
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/ObserverTest.php
new file mode 100644
index 0000000000000..00ee0630c11a3
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/ObserverTest.php
@@ -0,0 +1,207 @@
+cmsPageMock = $this
+ ->getMockBuilder('Magento\Cms\Helper\Page')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->scopeConfigMock = $this
+ ->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->observerMock = $this
+ ->getMockBuilder('Magento\Framework\Event\Observer')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->eventMock = $this
+ ->getMockBuilder('Magento\Framework\Event')
+ ->setMethods(
+ [
+ 'getStatus',
+ 'getRedirect'
+ ]
+ )
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->objectMock = $this
+ ->getMockBuilder('Magento\Framework\Object')
+ ->setMethods(
+ [
+ 'setLoaded',
+ 'setForwardModule',
+ 'setForwardController',
+ 'setForwardAction',
+ 'setRedirectUrl',
+ 'setRedirect',
+ 'setPath',
+ 'setArguments'
+ ]
+ )
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+ $this->this = $objectManager->getObject(
+ 'Magento\Cms\Model\Observer',
+ [
+ 'cmsPage' => $this->cmsPageMock,
+ 'scopeConfig' => $this->scopeConfigMock
+ ]
+ );
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Observer::noRoute
+ */
+ public function testNoRoute()
+ {
+ $this->observerMock
+ ->expects($this->atLeastOnce())
+ ->method('getEvent')
+ ->willReturn($this->eventMock);
+ $this->eventMock
+ ->expects($this->atLeastOnce())
+ ->method('getStatus')
+ ->willReturn($this->objectMock);
+ $this->objectMock
+ ->expects($this->atLeastOnce())
+ ->method('setLoaded')
+ ->with(true)
+ ->willReturnSelf();
+ $this->objectMock
+ ->expects($this->atLeastOnce())
+ ->method('setForwardModule')
+ ->with('cms')
+ ->willReturnSelf();
+ $this->objectMock
+ ->expects($this->atLeastOnce())
+ ->method('setForwardController')
+ ->with('index')
+ ->willReturnSelf();
+ $this->objectMock
+ ->expects($this->atLeastOnce())
+ ->method('setForwardAction')
+ ->with('noroute')
+ ->willReturnSelf();
+
+ $this->assertEquals($this->this, $this->this->noRoute($this->observerMock));
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Observer::noCookies
+ * @param string $pageUrl
+ * @dataProvider noCookiesDataProvider
+ */
+ public function testNoCookies($pageUrl)
+ {
+ $pageId = 1;
+
+ $this->observerMock
+ ->expects($this->atLeastOnce())
+ ->method('getEvent')
+ ->willReturn($this->eventMock);
+ $this->eventMock
+ ->expects($this->atLeastOnce())
+ ->method('getRedirect')
+ ->willReturn($this->objectMock);
+ $this->scopeConfigMock
+ ->expects($this->atLeastOnce())
+ ->method('getValue')
+ ->with('web/default/cms_no_cookies', 'store')
+ ->willReturn($pageId);
+ $this->cmsPageMock
+ ->expects($this->atLeastOnce())
+ ->method('getPageUrl')
+ ->with($pageId)
+ ->willReturn($pageUrl);
+ $this->objectMock
+ ->expects($this->any())
+ ->method('setRedirectUrl')
+ ->with($pageUrl)
+ ->willReturnSelf();
+ $this->objectMock
+ ->expects($this->any())
+ ->method('setRedirect')
+ ->with(true)
+ ->willReturnSelf();
+ $this->objectMock
+ ->expects($this->any())
+ ->method('setPath')
+ ->with('cms/index/noCookies')
+ ->willReturnSelf();
+ $this->objectMock
+ ->expects($this->any())
+ ->method('setArguments')
+ ->with([])
+ ->willReturnSelf();
+
+ $this->assertEquals($this->this, $this->this->noCookies($this->observerMock));
+ }
+
+ public function noCookiesDataProvider()
+ {
+ return [
+ 'url IS empty' => ['pageUrl' => ''],
+ 'url NOT empty' => ['pageUrl' => '/some/url']
+ ];
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/PageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/PageTest.php
new file mode 100644
index 0000000000000..a7ed38aa7fa3a
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/PageTest.php
@@ -0,0 +1,135 @@
+eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->context = $objectManager->getObject(
+ 'Magento\Framework\Model\Context',
+ [
+ 'eventDispatcher' => $this->eventManagerMock
+ ]
+ );
+ $this->resourcePageMock = $this->getMockBuilder('Magento\Cms\Model\Resource\Page')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'getIdFieldName',
+ 'checkIdentifier'
+ ]
+ )
+ ->getMock();
+ $this->thisMock = $this->getMockBuilder('Magento\Cms\Model\Page')
+ ->setConstructorArgs(
+ [
+ $this->context,
+ $this->getMockBuilder('Magento\Framework\Registry')
+ ->disableOriginalConstructor()
+ ->getMock(),
+ $this->getMockBuilder('Magento\Framework\Model\Resource\AbstractResource')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ '_construct',
+ '_getReadAdapter',
+ '_getWriteAdapter'
+ ]
+ )
+ ->getMock(),
+ $this->getMockBuilder('Magento\Framework\Data\Collection\Db')
+ ->disableOriginalConstructor()
+ ->getMock()
+ ]
+ )
+ ->setMethods(
+ [
+ '_construct',
+ '_getResource',
+ 'load'
+ ]
+ )
+ ->getMock();
+
+ $this->thisMock->expects($this->any())
+ ->method('_getResource')
+ ->willReturn($this->resourcePageMock);
+ $this->thisMock->expects($this->any())
+ ->method('load')
+ ->willReturnSelf();
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Page::noRoutePage
+ */
+ public function testNoRoutePage()
+ {
+ $this->assertEquals($this->thisMock, $this->thisMock->noRoutePage());
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Page::checkIdentifier
+ */
+ public function testCheckIdentifier()
+ {
+ $identifier = 1;
+ $storeId = 2;
+ $fetchOneResult = 'some result';
+
+ $this->resourcePageMock->expects($this->atLeastOnce())
+ ->method('checkIdentifier')
+ ->with($identifier, $storeId)
+ ->willReturn($fetchOneResult);
+
+ $this->assertInternalType('string', $this->thisMock->checkIdentifier($identifier, $storeId));
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php
new file mode 100644
index 0000000000000..e790c58ede6c2
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php
@@ -0,0 +1,251 @@
+backendUrlMock = $this->getMockBuilder('Magento\Backend\Model\UrlInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->assetRepoMock = $this->getMockBuilder('Magento\Framework\View\Asset\Repository')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->authorizationMock = $this->getMockBuilder('Magento\Framework\AuthorizationInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->variableConfigMock = $this->getMockBuilder('Magento\Core\Model\Variable\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->widgetConfigMock = $this->getMockBuilder('Magento\Widget\Model\Widget\Config')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->scopeConfigMock = $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->windowSize = [
+ 'width' => 1200,
+ 'height' => 800
+ ];
+
+ $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+ $this->this = $objectManager->getObject(
+ 'Magento\Cms\Model\Wysiwyg\Config',
+ [
+ 'backendUrl' => $this->backendUrlMock,
+ 'assetRepo' => $this->assetRepoMock,
+ 'authorization' => $this->authorizationMock,
+ 'variableConfig' => $this->variableConfigMock,
+ 'widgetConfig' => $this->widgetConfigMock,
+ 'scopeConfig' => $this->scopeConfigMock,
+ 'windowSize' => $this->windowSize
+ ]
+ );
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Wysiwyg\Config::getConfig
+ * @param array $data
+ * @param boolean $isAuthorizationAllowed
+ * @param array $expectedResults
+ *
+ * @dataProvider getConfigDataProvider
+ */
+ public function testGetConfig($data, $isAuthorizationAllowed, $expectedResults)
+ {
+ $wysiwygPluginSettings = [
+ 'wysiwygPluginSettings' => 'wysiwyg is here'
+ ];
+
+ $pluginSettings = [
+ 'pluginSettings' => 'plugins are here'
+ ];
+
+ $this->backendUrlMock->expects($this->atLeastOnce())
+ ->method('getUrl')
+ ->withConsecutive(
+ ['cms/wysiwyg/directive'],
+ ['cms/wysiwyg_images/index']
+ );
+ $this->assetRepoMock->expects($this->atLeastOnce())
+ ->method('getUrl')
+ ->withConsecutive(
+ ['mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'],
+ ['mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css']
+ );
+ $this->authorizationMock->expects($this->atLeastOnce())
+ ->method('isAllowed')
+ ->with('Magento_Cms::media_gallery')
+ ->willReturn($isAuthorizationAllowed);
+ $this->variableConfigMock->expects($this->any())
+ ->method('getWysiwygPluginSettings')
+ ->willReturn($wysiwygPluginSettings);
+ $this->widgetConfigMock->expects($this->any())
+ ->method('getPluginSettings')
+ ->willReturn($pluginSettings);
+
+ $config = $this->this->getConfig($data);
+ $this->assertInstanceOf('Magento\Framework\Object', $config);
+ $this->assertEquals($expectedResults[0], $config->getData('someData'));
+ $this->assertEquals($expectedResults[1], $config->getData('wysiwygPluginSettings'));
+ $this->assertEquals($expectedResults[2], $config->getData('pluginSettings'));
+ }
+
+ public function getConfigDataProvider()
+ {
+ return [
+ 'add_variables IS FALSE, add_widgets IS FALSE, isAuthorizationAllowed IS FALSE' => [
+ 'data' => [
+ 'add_variables' => false,
+ 'add_widgets' => false
+ ],
+ 'isAuthorizationAllowed' => false,
+ 'expectedResults' => [null, null, null]
+ ],
+ 'add_variables IS TRUE, add_widgets IS TRUE, isAuthorizationAllowed IS TRUE' => [
+ 'data' => [
+ 'someData' => 'important data',
+ 'add_variables' => true,
+ 'add_widgets' => true
+ ],
+ 'isAuthorizationAllowed' => true,
+ 'expectedResults' => ['important data', 'wysiwyg is here', 'plugins are here']
+ ]
+ ];
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Wysiwyg\Config::getSkinImagePlaceholderUrl
+ */
+ public function testGetSkinImagePlaceholderUrl()
+ {
+ $url = '/some/url';
+
+ $this->assetRepoMock->expects($this->atLeastOnce())
+ ->method('getUrl')
+ ->with('Magento_Cms::images/wysiwyg_skin_image.png')
+ ->willReturn($url);
+
+ $this->assertEquals($url, $this->this->getSkinImagePlaceholderUrl());
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Wysiwyg\Config::isEnabled
+ * @param string $wysiwygState
+ * @param boolean $expectedResult
+ *
+ * @dataProvider isEnabledDataProvider
+ */
+ public function testIsEnabled($wysiwygState, $expectedResult)
+ {
+ $storeId = 1;
+ $this->this->setStoreId($storeId);
+
+ $this->scopeConfigMock->expects($this->atLeastOnce())
+ ->method('getValue')
+ ->with('cms/wysiwyg/enabled', 'store', $storeId)
+ ->willReturn($wysiwygState);
+
+ $this->assertEquals($expectedResult, $this->this->isEnabled());
+ }
+
+ public function isEnabledDataProvider()
+ {
+ return [
+ ['wysiwygState' => 'enabled', 'expectedResult' => true],
+ ['wysiwygState' => 'hidden', 'expectedResult' => true],
+ ['wysiwygState' => 'masked', 'expectedResult' => false]
+ ];
+ }
+
+ /**
+ * @covers \Magento\Cms\Model\Wysiwyg\Config::isHidden
+ * @param string $status
+ * @param boolean $expectedResult
+ *
+ * @dataProvider isHiddenDataProvider
+ */
+ public function testIsHidden($status, $expectedResult)
+ {
+ $this->scopeConfigMock->expects($this->atLeastOnce())
+ ->method('getValue')
+ ->with('cms/wysiwyg/enabled', 'store')
+ ->willReturn($status);
+
+ $this->assertEquals($expectedResult, $this->this->isHidden());
+ }
+
+ public function isHiddenDataProvider()
+ {
+ return [
+ ['status' => 'hidden', 'expectedResult' => true],
+ ['status' => 'enabled', 'expectedResult' => false],
+ ['status' => 'masked', 'expectedResult' => false]
+ ];
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php
index d8904af20d853..4c2a71c03e4a1 100644
--- a/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php
+++ b/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php
@@ -96,7 +96,7 @@ public function testGetUserName()
->will($this->returnValue(true));
$objectBuilder = $this->getMockForAbstractClass(
- '\Magento\Framework\Api\AbstractSimpleObjectBuilder',
+ '\Magento\Framework\Api\ExtensibleObjectBuilder',
['getData'],
'',
false
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php
index 9fee2ea16f267..ddbffcc52042b 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php
@@ -28,7 +28,7 @@
use Magento\Customer\Service\V1\Data\Eav\AttributeMetadata;
use Magento\Customer\Service\V1\Data\CustomerBuilder;
use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
class ConverterTest extends \PHPUnit_Framework_TestCase
{
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php
index 05880064c98ea..919e1a00a71c3 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php
@@ -35,10 +35,8 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
- $logger = $this->getMockBuilder('Magento\Framework\Logger')->disableOriginalConstructor()->getMock();
$string = new String();
- /** @var \Magento\Framework\Logger $logger */
- $this->testable = new Password($logger, $string);
+ $this->testable = new Password($string);
}
public function testValidatePositive()
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php
index 11cfa14ff0708..41fa4c9a13f97 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php
@@ -38,12 +38,10 @@ class StoreTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
- $logger = $this->getMockBuilder('Magento\Framework\Logger')->disableOriginalConstructor()->getMock();
- /** @var \Magento\Framework\Logger $logger */
$storeManager = $this->storeManager = $this->getMockBuilder('Magento\Framework\StoreManagerInterface')
->getMock();
/** @var \Magento\Framework\StoreManagerInterface $storeManager */
- $this->testable = new Store($logger, $storeManager);
+ $this->testable = new Store($storeManager);
}
public function testBeforeSaveWithId()
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php
index 7247b735f5047..efad936ac75b5 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php
@@ -38,12 +38,10 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
- $logger = $this->getMockBuilder('Magento\Framework\Logger')->disableOriginalConstructor()->getMock();
- /** @var \Magento\Framework\Logger $logger */
$storeManager = $this->storeManager = $this->getMockBuilder('Magento\Framework\StoreManagerInterface')
->getMock();
/** @var \Magento\Framework\StoreManagerInterface $storeManager */
- $this->testable = new Website($logger, $storeManager);
+ $this->testable = new Website($storeManager);
}
public function testBeforeSaveWithId()
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php
index 826708a45bf7f..649237cc942b4 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php
@@ -116,7 +116,7 @@ public function setUp()
);
$this->moduleManagerMock = $this->getMock('Magento\Framework\Module\Manager', array(), array(), '', false);
$this->visitorMock = $this->getMock('Magento\Customer\Model\Visitor', array(), array(), '', false);
- $this->customerFactoryMock->expects($this->once())
+ $this->customerFactoryMock->expects($this->any())
->method('create')
->will($this->returnValue($this->customerMock));
$this->cacheConfigMock = $this->getMock('Magento\PageCache\Model\Config', array(), array(), '', false);
@@ -274,7 +274,8 @@ public function testAfterGenerateXmlPageCacheEnabled()
$this->customerMock
->expects($this->once())
->method('setGroupId')
- ->with($this->equalTo(null));
+ ->with($this->equalTo(null))
+ ->willReturnSelf();
$this->sessionMock
->expects($this->once())
->method('setData')
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
index 37555bc3c3d11..1879111bbed5f 100755
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
@@ -30,7 +30,7 @@
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Customer\Service\V1\Data\CustomerBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\FilterBuilder;
use Magento\Framework\Mail\Exception as MailException;
use Magento\Framework\Api\ExtensibleDataObjectConverter;
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
index 1b37a67682c00..a698d471b5ed3 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
@@ -27,7 +27,7 @@
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Customer\Service\V1\Data\RegionBuilder;
use Magento\Customer\Service\V1\Data\CustomerBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
/**
* \Magento\Customer\Service\V1\CustomerAddressService
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php
index 9660223cb5c57..7be2d3ddb8918 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php
@@ -127,7 +127,7 @@ public function testToFlatArrayCustomAttributes()
);
$addressData = $this->_sampleAddressDataObject();
- $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
/** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressDataBuilder */
$addressDataBuilder = $this->_objectManager->getObject(
'Magento\Customer\Service\V1\Data\AddressBuilder',
@@ -137,7 +137,8 @@ public function testToFlatArrayCustomAttributes()
'metadataService' => $this->addressMetadataService
]
);
- $addressData = $addressDataBuilder->mergeDataObjectWithArray($addressData, $updatedAddressData);
+ $addressData = $addressDataBuilder->mergeDataObjectWithArray($addressData, $updatedAddressData)
+ ->create();
$result = AddressConverter::toFlatArray($addressData);
$this->assertEquals($expected, $result);
@@ -150,7 +151,7 @@ protected function _sampleAddressDataObject()
{
$regionBuilder = $this->_objectManager->getObject('\Magento\Customer\Service\V1\Data\RegionBuilder')
->setRegion('Texas')->setRegionId(1)->setRegionCode('TX');
- $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
/** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressData */
$addressData = $this->_objectManager->getObject(
'Magento\Customer\Service\V1\Data\AddressBuilder',
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php
index 5c075fdff02be..6128c7e4ab579 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php
@@ -27,7 +27,7 @@
use Magento\Customer\Service\V1\Data\AddressBuilder;
use Magento\Customer\Service\V1\Data\RegionBuilder;
use Magento\Framework\Api\AttributeValue;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
class AddressTest extends \PHPUnit_Framework_TestCase
{
@@ -94,7 +94,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Customer\Service\V1\CustomerMetadataService */
private $_customerMetadataService;
- /** @var \Magento\Framework\Api\AttributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder */
private $_valueBuilder;
/**
@@ -125,7 +125,7 @@ protected function setUp()
)
);
$this->_valueBuilder = $this->objectManagerHelper
- ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ ->getObject('Magento\Framework\Api\AttributeDataBuilder');
$this->_addressBuilder = $this->objectManagerHelper->getObject(
'Magento\Customer\Service\V1\Data\AddressBuilder',
[
@@ -313,10 +313,12 @@ public function testSetCustomAttributes()
];
$attributeValue1 = $this->_valueBuilder
- ->populateWithArray($customerAttributes['warehouse_zip'])
+ ->setValue('78777')
+ ->setAttributeCode('warehouse_zip')
->create();
$attributeValue2 = $this->_valueBuilder
- ->populateWithArray($customerAttributes['warehouse_alternate'])
+ ->setValue('90051')
+ ->setAttributeCode('warehouse_alternate')
->create();
$address = $this->_addressBuilder
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php
index e987df4569d73..8d7774cb6be94 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php
@@ -39,7 +39,7 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Customer\Service\V1\AddressMetadataService */
private $_addressMetadataService;
- /** @var \Magento\Framework\Api\AttributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder */
private $_valueBuilder;
protected function setUp()
@@ -81,7 +81,7 @@ protected function setUp()
)
);
$this->_valueBuilder = $this->_objectManager->getObject(
- 'Magento\Framework\Api\AttributeValueBuilder'
+ 'Magento\Framework\Api\AttributeDataBuilder'
);
$this->_customerBuilder = $this->_objectManager->getObject(
'Magento\Customer\Service\V1\Data\CustomerBuilder',
@@ -110,7 +110,8 @@ public function testMergeDataObjects()
$middlename2 = 'Middlename2';
$secondDataObject = $this->_customerBuilder->setLastname($lastname2)->setMiddlename($middlename2)->create();
- $mergedDataObject = $this->_customerBuilder->mergeDataObjects($firstDataObject, $secondDataObject);
+ $mergedDataObject = $this->_customerBuilder->mergeDataObjects($firstDataObject, $secondDataObject)
+ ->create();
$this->assertNotSame(
$firstDataObject,
$mergedDataObject,
@@ -147,11 +148,13 @@ public function testMergeDataObjectsWitArray()
$email1
)->create();
+
$lastname2 = 'Lastname2';
$middlename2 = 'Middlename2';
$dataForMerge = array('lastname' => $lastname2, 'middlename' => $middlename2);
- $mergedDataObject = $this->_customerBuilder->mergeDataObjectWithArray($firstDataObject, $dataForMerge);
+ $mergedDataObject = $this->_customerBuilder->mergeDataObjectWithArray($firstDataObject, $dataForMerge)
+ ->create();
$this->assertNotSame(
$firstDataObject,
$mergedDataObject,
@@ -286,10 +289,12 @@ public function testSetCustomAttributes()
];
$attributeValue1 = $this->_valueBuilder
- ->populateWithArray($customerAttributes['warehouse_zip'])
+ ->setValue('78777')
+ ->setAttributeCode('warehouse_zip')
->create();
$attributeValue2 = $this->_valueBuilder
- ->populateWithArray($customerAttributes['warehouse_alternate'])
+ ->setValue('90051')
+ ->setAttributeCode('warehouse_alternate')
->create();
$address = $this->_customerBuilder->setCustomAttributes([$attributeValue1, $attributeValue2])
@@ -362,7 +367,7 @@ public function testMergeDataObjectWithArrayCustomData()
]
]
]
- );
+ )->create();
$expectedData = array(
'email' => 'test@example.com',
@@ -438,7 +443,8 @@ public function testMergeDataObjectsCustomData()
);
$customer1 = $this->_customerBuilder->populateWithArray($customer1Data)->create();
$customer2 = $this->_customerBuilder->populateWithArray($customer2Data)->create();
- $customer3 = $this->_customerBuilder->mergeDataObjects($customer1, $customer2);
+ $customer3 = $this->_customerBuilder->mergeDataObjects($customer1, $customer2)
+ ->create();
$this->assertEquals('78666', $customer3->getCustomAttribute('warehouse_zip')->getValue());
$this->assertEquals('90051', $customer3->getCustomAttribute('warehouse_alternate')->getValue());
foreach ($customer3->getCustomAttributes() as $customAttribute) {
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php
index 91bab28761ab4..a19e6ce5831ed 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php
@@ -95,7 +95,7 @@ public function setUp()
new \Magento\Framework\Object(['attribute_code' => 'locale'])
])
);
- $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
$this->_customerBuilder = $this->_objectManager->getObject(
'Magento\Customer\Service\V1\Data\CustomerBuilder',
[
diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php
new file mode 100644
index 0000000000000..258d918729343
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php
@@ -0,0 +1,288 @@
+coreData = $this->getMockBuilder('\Magento\Core\Helper\Data')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->scopeConfig = $this->getMockBuilder('\Magento\Framework\App\Config')
+ ->disableOriginalConstructor()
+ ->setMethods(['isSetFlag'])
+ ->getMock();
+
+ $this->purchasedFactory = $this->getMockBuilder('\Magento\Downloadable\Model\Link\PurchasedFactory')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->productFactory = $this->getMockBuilder('\Magento\Catalog\Model\ProductFactory')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->itemFactory = $this->getMockBuilder('\Magento\Downloadable\Model\Link\Purchased\ItemFactory')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->checkoutSession = $this->getMockBuilder('\Magento\Checkout\Model\Session')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->itemsFactory = $this->getMockBuilder(
+ '\Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory'
+ )
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->objectCopyService = $this->getMockBuilder('\Magento\Framework\Object\Copy')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->resultMock = $this->getMockBuilder('\Magento\Framework\Object')
+ ->disableOriginalConstructor()
+ ->setMethods(['setIsAllowed'])
+ ->getMock();
+
+ $this->storeMock = $this->getMockBuilder('\Magento\Framework\Object')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->eventMock = $this->getMockBuilder('\Magento\Framework\Event')
+ ->disableOriginalConstructor()
+ ->setMethods(['getStore', 'getResult', 'getQuote'])
+ ->getMock();
+
+ $this->observerMock = $this->getMockBuilder('\Magento\Framework\Event\Observer')
+ ->disableOriginalConstructor()
+ ->setMethods(['getEvent'])
+ ->getMock();
+
+ $this->observer = (new ObjectManagerHelper($this))->getObject(
+ '\Magento\Downloadable\Model\Observer',
+ array(
+ 'coreData' => $this->coreData,
+ 'scopeConfig' => $this->scopeConfig,
+ 'purchasedFactory' => $this->purchasedFactory,
+ 'productFactory' => $this->productFactory,
+ 'itemFactory' => $this->itemFactory,
+ 'checkoutSession' => $this->checkoutSession,
+ 'itemsFactory' => $this->itemsFactory,
+ 'objectCopyService' => $this->objectCopyService
+ )
+ );
+ }
+
+ /**
+ *
+ * @dataProvider dataProviderForTestisAllowedGuestCheckoutConfigSetToTrue
+ *
+ * @param $productType
+ * @param $isAllowed
+ */
+ public function testIsAllowedGuestCheckoutConfigSetToTrue($productType, $isAllowed)
+ {
+ $this->resultMock->expects($this->at(0))
+ ->method('setIsAllowed')
+ ->with(true);
+
+ if ($isAllowed) {
+ $this->resultMock->expects($this->at(1))
+ ->method('setIsAllowed')
+ ->with(false);
+ }
+
+ $product = $this->getMockBuilder('\Magento\Catalog\Model\Product')
+ ->disableOriginalConstructor()
+ ->setMethods(['getTypeId'])
+ ->getMock();
+
+ $product->expects($this->once())
+ ->method('getTypeId')
+ ->willReturn($productType);
+
+ $item = $this->getMockBuilder('\Magento\Sales\Model\Quote\Item')
+ ->disableOriginalConstructor()
+ ->setMethods(['getProduct'])
+ ->getMock();
+
+ $item->expects($this->once())
+ ->method('getProduct')
+ ->willReturn($product);
+
+ $quote = $this->getMockBuilder('\Magento\Sales\Model\Quote')
+ ->disableOriginalConstructor()
+ ->setMethods(['getAllItems'])
+ ->getMock();
+
+ $quote->expects($this->once())
+ ->method('getAllItems')
+ ->willReturn([$item]);
+
+ $this->eventMock->expects($this->once())
+ ->method('getStore')
+ ->will($this->returnValue($this->storeMock));
+
+ $this->eventMock->expects($this->once())
+ ->method('getResult')
+ ->will($this->returnValue($this->resultMock));
+
+ $this->eventMock->expects($this->once())
+ ->method('getQuote')
+ ->will($this->returnValue($quote));
+
+ $this->scopeConfig->expects($this->exactly(1))
+ ->method('isSetFlag')
+ ->with(Observer::XML_PATH_DISABLE_GUEST_CHECKOUT, ScopeInterface::SCOPE_STORE, $this->storeMock)
+ ->willReturn(true);
+
+ $this->observerMock->expects($this->exactly(3))
+ ->method('getEvent')
+ ->will($this->returnValue($this->eventMock));
+
+ $this->assertInstanceOf(
+ '\Magento\Downloadable\Model\Observer',
+ $this->observer->isAllowedGuestCheckout($this->observerMock)
+ );
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderForTestisAllowedGuestCheckoutConfigSetToTrue()
+ {
+ return [
+ 1 => [Type::TYPE_DOWNLOADABLE, true],
+ 2 => ['unknown', false],
+ ];
+ }
+
+ /**
+ *
+ */
+ public function testIsAllowedGuestCheckoutConfigSetToFalse()
+ {
+ $this->resultMock->expects($this->once())
+ ->method('setIsAllowed')
+ ->with(true);
+
+ $this->eventMock->expects($this->once())
+ ->method('getStore')
+ ->will($this->returnValue($this->storeMock));
+
+ $this->eventMock->expects($this->once())
+ ->method('getResult')
+ ->will($this->returnValue($this->resultMock));
+
+ $this->scopeConfig->expects($this->exactly(1))
+ ->method('isSetFlag')
+ ->with(Observer::XML_PATH_DISABLE_GUEST_CHECKOUT, ScopeInterface::SCOPE_STORE, $this->storeMock)
+ ->willReturn(false);
+
+ $this->observerMock->expects($this->exactly(2))
+ ->method('getEvent')
+ ->will($this->returnValue($this->eventMock));
+
+ $this->assertInstanceOf(
+ '\Magento\Downloadable\Model\Observer',
+ $this->observer->isAllowedGuestCheckout($this->observerMock)
+ );
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php
index c815194b56ba3..f25d75da2a9d9 100644
--- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php
+++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php
@@ -112,12 +112,10 @@ protected function _getAttributes()
);
$mock->setAttributeId($code);
- $logger = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
/** @var $backendModel \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */
$backendModel = $this->getMock(
'Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend',
- array('getBackend', 'getBackendTable'),
- array($logger)
+ array('getBackend', 'getBackendTable')
);
$backendModel->setAttribute($mock);
@@ -249,7 +247,6 @@ public function testSave($attributeCode, $attributeSetId, $productData, $product
$attribute = $this->_getAttributeMock($attributeCode, $attributeSetId);
- $logger = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
/** @var $backendModel \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */
$backendModel = $this->getMock(
'Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend',
@@ -260,8 +257,7 @@ public function testSave($attributeCode, $attributeSetId, $productData, $product
'isStatic',
'getEntityValueId',
'getEntityIdField'
- ),
- array($logger)
+ )
);
$backendModel->expects(
diff --git a/dev/tests/unit/testsuite/Magento/Eav/Plugin/Model/Resource/Entity/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Plugin/Model/Resource/Entity/AttributeTest.php
new file mode 100644
index 0000000000000..30b8cbb836f08
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Eav/Plugin/Model/Resource/Entity/AttributeTest.php
@@ -0,0 +1,129 @@
+cache = $this->getMock('Magento\Framework\App\CacheInterface');
+ $this->cacheState = $this->getMock('Magento\Framework\App\Cache\StateInterface');
+ $this->subject = $this->getMock('Magento\Eav\Model\Resource\Entity\Attribute', [], [], '', false);
+ }
+
+ public function testGetStoreLabelsByAttributeIdOnCacheDisabled()
+ {
+ $this->cache->expects($this->never())->method('load');
+
+ $this->assertEquals(
+ 'attributeId',
+ $this->getAttribute(false)->aroundGetStoreLabelsByAttributeId(
+ $this->subject,
+ $this->mockPluginProceed('attributeId'),
+ 'attributeId'
+ )
+ );
+ }
+
+ public function testGetStoreLabelsByAttributeIdFromCache()
+ {
+ $attributeId = 1;
+ $attributes = ['k' => 'v'];
+ $cacheId = \Magento\Eav\Plugin\Model\Resource\Entity\Attribute::STORE_LABEL_ATTRIBUTE . $attributeId;
+ $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes));
+
+ $this->assertEquals(
+ $attributes,
+ $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId(
+ $this->subject,
+ $this->mockPluginProceed(),
+ $attributeId
+ )
+ );
+ }
+
+ public function testGetStoreLabelsByAttributeIdWithCacheSave()
+ {
+ $attributeId = 1;
+ $cacheId = \Magento\Eav\Plugin\Model\Resource\Entity\Attribute::STORE_LABEL_ATTRIBUTE . $attributeId;
+ $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false);
+ $this->cache->expects($this->any())->method('save')->with(
+ serialize([$attributeId]),
+ $cacheId,
+ [
+ \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+ \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+ ]
+ );
+
+ $this->assertEquals(
+ [$attributeId],
+ $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId(
+ $this->subject,
+ $this->mockPluginProceed([$attributeId]),
+ $attributeId
+ )
+ );
+ }
+
+ /**
+ * @param bool $cacheEnabledFlag
+ * @return \Magento\Eav\Plugin\Model\Resource\Entity\Attribute
+ */
+ protected function getAttribute($cacheEnabledFlag)
+ {
+ $this->cacheState->expects($this->any())->method('isEnabled')
+ ->with(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER)->willReturn($cacheEnabledFlag);
+ return (new ObjectManager($this))->getObject(
+ 'Magento\Eav\Plugin\Model\Resource\Entity\Attribute',
+ [
+ 'cache' => $this->cache,
+ 'cacheState' => $this->cacheState
+ ]
+ );
+ }
+
+ /**
+ * @param mixed $returnValue
+ * @return callable
+ */
+ protected function mockPluginProceed($returnValue = null)
+ {
+ return function () use ($returnValue) {
+ return $returnValue;
+ };
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/BuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/BuilderTest.php
deleted file mode 100644
index 2d4ccee5d96e4..0000000000000
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/BuilderTest.php
+++ /dev/null
@@ -1,156 +0,0 @@
-ioObjectMock = $this->getMock(
- 'Magento\Framework\Code\Generator\Io',
- [],
- [],
- '',
- false
- );
- $this->fileResolverMock = $this->getMock(
- 'Magento\Framework\Code\Generator\FileResolver',
- [],
- [],
- '',
- false
- );
- $this->classGenerator = $this->getMock(
- 'Magento\Framework\Code\Generator\CodeGenerator\Zend',
- [],
- [],
- '',
- false
- );
-
- $objectManager = new ObjectManager($this);
- $this->generator = $objectManager->getObject(
- self::GENERATOR_CLASS_NAME,
- [
- 'sourceClassName' => self::SOURCE_CLASS_NAME,
- 'resultClassName' => self::RESULT_CLASS_NAME,
- 'ioObject' => $this->ioObjectMock,
- 'classGenerator' => $this->classGenerator,
- 'fileResolver' => $this->fileResolverMock
- ]
- );
- }
-
- /**
- * generate repository name
- */
- public function testGenerate()
- {
- $generatedCode = 'Generated code';
- $sourceFileName = 'Sample.php';
- $resultFileName = self::OUTPUT_FILE_NAME;
-
- //Mocking _validateData call
- $this->fileResolverMock->expects($this->at(0))
- ->method('getFile')
- ->with(self::SOURCE_CLASS_NAME)
- ->will($this->returnValue($sourceFileName));
- $this->fileResolverMock->expects($this->at(1))
- ->method('getFile')
- ->with(self::RESULT_CLASS_NAME)
- ->will($this->returnValue(false));
-
- $this->ioObjectMock->expects($this->once())
- ->method('makeGenerationDirectory')
- ->will($this->returnValue(true));
- $this->ioObjectMock->expects($this->once())
- ->method('makeResultFileDirectory')
- ->with(self::RESULT_CLASS_NAME)
- ->will($this->returnValue(true));
- $this->ioObjectMock->expects($this->once())
- ->method('fileExists')
- ->with($resultFileName)
- ->will($this->returnValue(false));
-
- //Mocking _generateCode call
- $this->classGenerator->expects($this->once())
- ->method('setName')
- ->with(self::RESULT_CLASS_NAME)
- ->will($this->returnSelf());
- $this->classGenerator->expects($this->once())
- ->method('addProperties')
- ->will($this->returnSelf());
- $this->classGenerator->expects($this->once())
- ->method('addMethods')
- ->will($this->returnSelf());
- $this->classGenerator->expects($this->once())
- ->method('setClassDocBlock')
- ->will($this->returnSelf());
- $this->classGenerator->expects($this->once())
- ->method('generate')
- ->will($this->returnValue($generatedCode));
-
- //Mocking generation
- $this->ioObjectMock->expects($this->any())
- ->method('getResultFileName')
- ->with(self::RESULT_CLASS_NAME)
- ->will($this->returnValue($resultFileName));
- $this->ioObjectMock->expects($this->once())
- ->method('writeResultFile')
- ->with($resultFileName, $generatedCode);
-
- $this->assertTrue($this->generator->generate());
- }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
index eeb35b66f7af8..2470fc9dbb4a9 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
@@ -146,8 +146,9 @@ public function testGenerate()
//Verify if the generated code is as expected
$this->ioObjectMock->expects($this->once())
->method('writeResultFile')
- ->with($resultFileName, $generatedCode);
+ ->with($resultFileName, $generatedCode)
+ ->will($this->returnValue(true));
- $this->assertTrue($this->generator->generate());
+ $this->assertTrue($this->generator->generate(), implode("\n", $this->generator->getErrors()));
}
}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateBuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateBuilderTest.php
deleted file mode 100644
index c2f7d9ccea9b4..0000000000000
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateBuilderTest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-ioObjectMock = $this->getMock(
- '\Magento\Framework\Code\Generator\Io',
- [],
- [],
- '',
- false
- );
- }
-
- /**
- * generate repository class
- */
- public function testGenerate()
- {
- require_once __DIR__ . '/_files/Sample.php';
- /** @var \Magento\Framework\Api\Code\Generator\Builder $model */
- $model = $this->getMock(
- '\Magento\Framework\Api\Code\Generator\Builder',
- [
- '_validateData'
- ],
- [
- '\Magento\Framework\Api\Code\Generator\Sample',
- null,
- $this->ioObjectMock,
- null,
- null
- ]
- );
- $sampleBuilderCode = file_get_contents(__DIR__ . '/_files/SampleBuilder.txt');
- $this->ioObjectMock->expects($this->once())
- ->method('getResultFileName')
- ->with('\Magento\Framework\Api\Code\Generator\SampleBuilder')
- ->will($this->returnValue('SampleBuilder.php'));
- $this->ioObjectMock->expects($this->once())
- ->method('writeResultFile')
- ->with('SampleBuilder.php', $sampleBuilderCode);
-
- $model->expects($this->once())
- ->method('_validateData')
- ->will($this->returnValue(true));
- $this->assertTrue($model->generate());
- }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php
index 0a991beb96c26..3f9381ad6d8bf 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php
@@ -55,6 +55,7 @@ protected function setUp()
public function testGenerate()
{
require_once __DIR__ . '/_files/Sample.php';
+ /** @var \Magento\Framework\Api\Code\Generator\SearchResultsBuilder $model */
$model = $this->getMock(
'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
[
@@ -80,6 +81,6 @@ public function testGenerate()
$model->expects($this->once())
->method('_validateData')
->will($this->returnValue(true));
- $this->assertTrue($model->generate());
+ $this->assertTrue($model->generate(), implode("\n", $model->getErrors()));
}
}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt
index 5fd08f8ccfcb3..829ed168b5deb 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt
@@ -4,7 +4,7 @@ namespace Magento\Framework\Api\Code\Generator;
* DataBuilder class for
* \Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface
*/
-class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtensibleDataBuilder
+class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\Builder
{
/**
* @param array $items
@@ -12,7 +12,7 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
*/
public function setItems($items)
{
- $this->set('items', $items);
+ $this->_set('items', $items);
return $this;
}
@@ -22,7 +22,7 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
*/
public function setName($name)
{
- $this->set('name', $name);
+ $this->_set('name', $name);
return $this;
}
@@ -32,7 +32,7 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
*/
public function setCount($count)
{
- $this->set('count', $count);
+ $this->_set('count', $count);
return $this;
}
@@ -42,19 +42,24 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
*/
public function setCreatedAt($createdAt)
{
- $this->set('created_at', $createdAt);
+ $this->_set('created_at', $createdAt);
return $this;
}
/**
* Initialize the builder
*
- * @param \Magento\Framework\ObjectManager $objectManager
+ * @param \Magento\Framework\Api\ObjectFactory $objectFactory
* @param \Magento\Framework\Api\MetadataServiceInterface $metadataService
+ * @param \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder
+ * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
+ * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+ * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
* @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
+ * @param string|null $modelClassInterface
*/
- public function __construct(\Magento\Framework\ObjectManager $objectManager, \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Framework\ObjectManager\Config $objectManagerConfig)
+ public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder, \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, \Magento\Framework\Reflection\TypeProcessor $typeProcessor, \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, \Magento\Framework\ObjectManager\Config $objectManagerConfig, $modelClassInterface = null)
{
- parent::__construct($objectManager, $metadataService, $objectManagerConfig, 'Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface');
+ parent::__construct($objectFactory, $metadataService, $attributeValueBuilder, $objectProcessor, $typeProcessor, $dataBuilderFactory, $objectManagerConfig, 'Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface');
}
}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt
index 4bacbf1bd8f97..96578961ade1f 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt
@@ -10,7 +10,7 @@ class SampleSearchResultsBuilder extends \Magento\Framework\Api\AbstractSearchRe
*
* @param
*/
- public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\AttributeValueBuilder $valueBuilder, \Magento\Framework\Api\Config\MetadataConfig $metadataService, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\Code\Generator\SampleBuilder $itemObjectBuilder)
+ public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\AttributeDataBuilder $valueBuilder, \Magento\Framework\Api\Config\MetadataConfig $metadataService, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\Code\Generator\SampleBuilder $itemObjectBuilder)
{
parent::__construct($objectFactory, $valueBuilder, $metadataService, $searchCriteriaBuilder, $itemObjectBuilder);
}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php
index c748e9820c346..8505df47f3143 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php
@@ -40,7 +40,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase
public function testConstructorAndGettersWithString()
{
$helper = new \Magento\TestFramework\Helper\ObjectManager($this);
- $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+ $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
->setAttributeCode(self::ATTRIBUTE_CODE)
->setValue(self::STRING_VALUE);
$attribute = new AttributeValue($attributeBuilder);
@@ -52,7 +52,7 @@ public function testConstructorAndGettersWithString()
public function testConstructorAndGettersWithInteger()
{
$helper = new \Magento\TestFramework\Helper\ObjectManager($this);
- $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+ $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
->setAttributeCode(self::ATTRIBUTE_CODE)
->setValue(self::INTEGER_VALUE);
$attribute = new AttributeValue($attributeBuilder);
@@ -64,7 +64,7 @@ public function testConstructorAndGettersWithInteger()
public function testConstructorAndGettersWithFloat()
{
$helper = new \Magento\TestFramework\Helper\ObjectManager($this);
- $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+ $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
->setAttributeCode(self::ATTRIBUTE_CODE)
->setValue(self::FLOAT_VALUE);
$attribute = new AttributeValue($attributeBuilder);
@@ -76,7 +76,7 @@ public function testConstructorAndGettersWithFloat()
public function testConstructorAndGettersWithBoolean()
{
$helper = new \Magento\TestFramework\Helper\ObjectManager($this);
- $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+ $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
->setAttributeCode(self::ATTRIBUTE_CODE)
->setValue(self::BOOLEAN_VALUE);
$attribute = new AttributeValue($attributeBuilder);
diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php b/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
index 2cf42e36ab561..d788d532e7c91 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
@@ -44,16 +44,16 @@ class VersionTest extends \PHPUnit_Framework_TestCase
private $versionStorage;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Framework\Stdlib\DateTime|\PHPUnit_Framework_MockObject_MockObject
*/
- private $versionGenerator;
+ private $dateTime;
protected function setUp()
{
$this->appState = $this->getMock('Magento\Framework\App\State', array(), array(), '', false);
$this->versionStorage = $this->getMock('Magento\Framework\App\View\Deployment\Version\StorageInterface');
- $this->versionGenerator = $this->getMock('Magento\Framework\App\View\Deployment\Version\GeneratorInterface');
- $this->object = new Version($this->appState, $this->versionStorage, $this->versionGenerator);
+ $this->dateTime = $this->getMock('Magento\Framework\Stdlib\DateTime');
+ $this->object = new Version($this->appState, $this->versionStorage, $this->dateTime);
}
public function testGetValueDeveloperMode()
@@ -64,7 +64,7 @@ public function testGetValueDeveloperMode()
->will($this->returnValue(\Magento\Framework\App\State::MODE_DEVELOPER))
;
$this->versionStorage->expects($this->never())->method($this->anything());
- $this->versionGenerator->expects($this->once())->method('generate')->will($this->returnValue('123'));
+ $this->dateTime->expects($this->once())->method('toTimestamp')->will($this->returnValue('123'));
$this->assertEquals('123', $this->object->getValue());
$this->object->getValue(); // Ensure computation occurs only once and result is cached in memory
}
@@ -82,7 +82,7 @@ public function testGetValueFromStorage($appMode)
;
$this->versionStorage->expects($this->once())->method('load')->will($this->returnValue('123'));
$this->versionStorage->expects($this->never())->method('save');
- $this->versionGenerator->expects($this->never())->method('generate');
+ $this->dateTime->expects($this->never())->method('toTimestamp');
$this->assertEquals('123', $this->object->getValue());
$this->object->getValue(); // Ensure caching in memory
}
@@ -109,7 +109,7 @@ public function testGetValueDefaultModeSaving()
->method('load')
->will($this->throwException($storageException))
;
- $this->versionGenerator->expects($this->once())->method('generate')->will($this->returnValue('123'));
+ $this->dateTime->expects($this->once())->method('toTimestamp')->will($this->returnValue('123'));
$this->versionStorage->expects($this->once())->method('save')->with('123');
$this->assertEquals('123', $this->object->getValue());
$this->object->getValue(); // Ensure caching in memory
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
index 7fbeaa0c98eb4..cf97f4bbf09de 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
@@ -61,7 +61,8 @@ public function sampleTokenizeStringProvider()
{
return [
[" direct_url='about-magento-demo-store'", ['direct_url' => 'about-magento-demo-store']],
- [" direct_url='about-magento-demo-store\\[newDemo]", ['direct_url' => 'about-magento-demo-store[newDemo]']],
+ [" direct_url='about-magento-demo-store\\[newDemo]",
+ ['direct_url' => 'about-magento-demo-store\\[newDemo]']],
[" ", []]
];
}
@@ -70,7 +71,7 @@ public function sampleGetValueStringProvider()
{
return [
[" direct_url='about-magento-demo-store'", "direct_url='about-magento-demo-store'"],
- [" direct_url='about-magento-demo-store\\[newDemo]", "direct_url='about-magento-demo-store[newDemo]"],
+ [" direct_url='about-magento-demo-store\\[newDemo]", "direct_url='about-magento-demo-store\\[newDemo]"],
[' ', '']
];
}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php b/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php
index b0984d320f7b1..634f28525ab7e 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php
@@ -158,7 +158,7 @@ public function testGetDataWithCustomAttributes()
*/
public function testRestrictedCustomAttributesGet()
{
- $this->model->getData(\Magento\Framework\Model\AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY);
+ $this->model->getData(\Magento\Framework\Api\ExtensibleDataInterface::CUSTOM_ATTRIBUTES);
}
/**
@@ -166,7 +166,7 @@ public function testRestrictedCustomAttributesGet()
*/
public function testRestrictedCustomAttributesSet()
{
- $this->model->setData(\Magento\Framework\Model\AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY, 'value');
+ $this->model->setData(\Magento\Framework\Api\ExtensibleDataInterface::CUSTOM_ATTRIBUTES, 'value');
}
/**
@@ -177,8 +177,8 @@ public function testRestrictedCustomAttributesSet()
protected function addCustomAttributesToModel($attributesAsArray, $model)
{
$objectManager = new ObjectManagerHelper($this);
- /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
- $attributeValueBuilder = $objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
+ $attributeValueBuilder = $objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
$addedAttributes = [];
foreach ($attributesAsArray as $attributeCode => $attributeValue) {
$addedAttributes[$attributeCode] = $attributeValueBuilder
diff --git a/dev/tests/unit/testsuite/Magento/Indexer/Model/IndexerRegistryTest.php b/dev/tests/unit/testsuite/Magento/Indexer/Model/IndexerRegistryTest.php
new file mode 100644
index 0000000000000..70fb6e837d7d0
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Indexer/Model/IndexerRegistryTest.php
@@ -0,0 +1,45 @@
+getMock('Magento\Indexer\Model\IndexerInterface');
+ $firstIndexer->expects($this->once())->method('load')->with('first-indexer')->willReturnSelf();
+
+ $secondIndexer = $this->getMock('Magento\Indexer\Model\IndexerInterface');
+ $secondIndexer->expects($this->once())->method('load')->with('second-indexer')->willReturnSelf();
+
+ $objectManager = $this->getMock('Magento\Framework\ObjectManager', [], [], '', false);
+ $objectManager->expects($this->at(0))->method('create')->willReturn($firstIndexer);
+ $objectManager->expects($this->at(1))->method('create')->willReturn($secondIndexer);
+
+ $unit = new IndexerRegistry($objectManager);
+ $this->assertSame($firstIndexer, $unit->get('first-indexer'));
+ $this->assertSame($secondIndexer, $unit->get('second-indexer'));
+ $this->assertSame($firstIndexer, $unit->get('first-indexer'));
+ }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php
index 1b68e24970933..c70b6db1d42f1 100644
--- a/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php
+++ b/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php
@@ -239,4 +239,12 @@ public function testHasAdditionalInformation()
$this->assertTrue($this->info->hasAdditionalInformation('key2'));
$this->assertTrue($this->info->hasAdditionalInformation());
}
+
+ public function testInitAdditionalInformationWithUnserialize()
+ {
+ $data = serialize(['key1' => 'data1', 'key2' => 'data2']);
+ $this->info->setData('additional_information', $data);
+
+ $this->assertEquals(unserialize($data), $this->info->getAdditionalInformation());
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php b/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php
index 9320cabcfb8d4..5805a04fdd498 100644
--- a/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php
+++ b/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php
@@ -29,46 +29,139 @@
class CombineTest extends \PHPUnit_Framework_TestCase
{
/**
- * @var \Magento\Rule\Model\Condition\Combine
+ * @var \Magento\Rule\Model\Condition\Combine | \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_combine;
+ private $combine;
/**
- * @var ObjectManagerHelper
+ * @var \Magento\Rule\Model\ConditionFactory | \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_objectManagerHelper;
+ private $conditionFactoryMock;
/**
- * @var \Magento\Rule\Model\Condition\Context|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Framework\Logger | \PHPUnit_Framework_MockObject_MockObject
*/
- protected $_contextMock;
+ private $loggerMock;
+ /**
+ * @var \Magento\SalesRule\Model\Rule\Condition\Product | \PHPUnit_Framework_MockObject_MockObject
+ */
+ private $conditionObjectMock;
+
+ /**
+ * Sets up the Mocks.
+ * This method is called before a test is executed.
+ */
protected function setUp()
{
- $this->_objectManagerHelper = new ObjectManagerHelper($this);
- $this->_combine = $this->_objectManagerHelper->getObject('Magento\Rule\Model\Condition\Combine');
+ $this->conditionFactoryMock = $this->getMockBuilder('\Magento\Rule\Model\ConditionFactory')
+ ->disableOriginalConstructor()
+ ->setMethods([])
+ ->getMock();
+
+ $this->loggerMock = $this->getMockBuilder('\Magento\Framework\Logger')
+ ->disableOriginalConstructor()
+ ->setMethods([])
+ ->getMock();
+
+ $this->conditionObjectMock = $this->getMockBuilder('\Magento\SalesRule\Model\Rule\Condition\Product')
+ ->disableOriginalConstructor()
+ ->setMethods([])
+ ->getMock();
+
+ $this->combine = (new ObjectManagerHelper($this))->getObject(
+ '\Magento\Rule\Model\Condition\Combine',
+ [
+ "conditionFactory" => $this->conditionFactoryMock,
+ "logger" => $this->loggerMock,
+ ]
+ );
}
/**
+ *
* @covers \Magento\Rule\Model\Condition\AbstractCondition::getValueName
+ *
* @dataProvider optionValuesData
+ *
* @param string|array $value
* @param string $expectingData
*/
public function testGetValueName($value, $expectingData)
{
- $this->_combine->setValueOption(array('option_key' => 'option_value'))->setValue($value);
- $this->assertEquals($expectingData, $this->_combine->getValueName());
+ $this->combine
+ ->setValueOption(['option_key' => 'option_value'])
+ ->setValue($value);
+
+ $this->assertEquals($expectingData, $this->combine->getValueName());
}
+ /**
+ * @return array
+ */
public function optionValuesData()
{
- return array(
- array('option_key', 'option_value'),
- array('option_value', 'option_value'),
- array(array('option_key'), 'option_value'),
- array('', '...'),
- );
+ return [
+ ['option_key', 'option_value'],
+ ['option_value', 'option_value'],
+ [['option_key'], 'option_value'],
+ ['', '...'],
+ ];
+ }
+
+ public function testLoadArray()
+ {
+ $array['conditions'] = [
+ [
+ 'type' => 'test',
+ 'attribute' => '',
+ 'operator' => '',
+ 'value' => '',
+ ]
+ ];
+
+ $this->conditionObjectMock->expects($this->once())
+ ->method('loadArray')
+ ->with($array['conditions'][0], 'conditions');
+
+ $this->conditionFactoryMock->expects($this->once())
+ ->method('create')
+ ->with($array['conditions'][0]['type'])
+ ->willReturn($this->conditionObjectMock);
+
+ $this->loggerMock->expects($this->never())
+ ->method('logException');
+
+ $result = $this->combine->loadArray($array);
+
+ $this->assertInstanceOf('\Magento\Rule\Model\Condition\Combine', $result);
}
+ public function testLoadArrayLoggerCatchException()
+ {
+ $array['conditions'] = [
+ [
+ 'type' => '',
+ 'attribute' => '',
+ 'operator' => '',
+ 'value' => '',
+ ]
+ ];
+
+ $this->conditionObjectMock->expects($this->never())
+ ->method('loadArray');
+
+ $this->conditionFactoryMock->expects($this->once())
+ ->method('create')
+ ->with($array['conditions'][0]['type'])
+ ->willThrowException(new \Exception('everything is fine, it is test'));
+
+ $this->loggerMock->expects($this->once())
+ ->method('logException')
+ ->with();
+
+ $result = $this->combine->loadArray($array);
+
+ $this->assertInstanceOf('\Magento\Rule\Model\Condition\Combine', $result);
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php b/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php
index c918965894158..d9f6fcde1a551 100644
--- a/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php
@@ -56,11 +56,29 @@ protected function setUp()
);
}
- public function testCreate()
+ public function testExceptingToCallMethodCreateInObjectManager()
{
- $type = '1';
- $data = ['data2', 'data3'];
- $this->objectManagerMock->expects($this->once())->method('create')->with($type, $data);
- $this->conditionFactory->create($type, $data);
+ $type = 'type';
+ $this->objectManagerMock
+ ->expects($this->once())
+ ->method('create')
+ ->with($type)
+ ->willReturn(new \stdClass());
+
+ $this->conditionFactory->create($type);
+ }
+
+ public function testExceptingClonedObject()
+ {
+ $origin = new \stdClass();
+
+ $this->objectManagerMock->expects($this->once())
+ ->method('create')
+ ->with('clone')
+ ->willReturn($origin);
+
+ $cloned = $this->conditionFactory->create('clone');
+
+ $this->assertNotSame($cloned, $origin);
}
}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
index 3112c42692d3b..a79c683beb11f 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -196,7 +196,7 @@ public function testSetAccountData()
)->method(
'mergeDataObjectWithArray'
)->will(
- $this->returnArgument(0)
+ $this->returnValue($this->customerBuilderMock)
);
$this->customerGroupServiceMock->expects(
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php
index 77d2fdf618424..1ffc446822084 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php
@@ -95,7 +95,7 @@ protected function setUp()
$this->customerHelperMock = $this->getMock('Magento\Customer\Helper\Data', array(), array(), '', false);
$this->customerBuilderMock = $this->getMock(
'Magento\Customer\Service\V1\Data\CustomerBuilder',
- array('mergeDataObjectWithArray'),
+ array('mergeDataObjectWithArray', 'create'),
array(),
'',
false
@@ -165,9 +165,9 @@ protected function setUp()
public function testDispatchWithDisableAutoGroupChange()
{
- /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
$attributeValueBuilder = $this->objectManager
- ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ ->getObject('Magento\Framework\Api\AttributeDataBuilder');
$attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(true);
$this->customerDataMock->expects(
$this->exactly(2)
@@ -184,9 +184,9 @@ public function testDispatchWithDisableAutoGroupChange()
public function testDispatchWithDisableVatValidator()
{
- /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
$attributeValueBuilder = $this->objectManager
- ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ ->getObject('Magento\Framework\Api\AttributeDataBuilder');
$attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
$this->customerDataMock->expects(
$this->exactly(2)
@@ -213,9 +213,9 @@ public function testDispatchWithDisableVatValidator()
public function testDispatchWithCustomerCountryNotInEUAndNotLoggedCustomerInGroup()
{
- /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
$attributeValueBuilder = $this->objectManager
- ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ ->getObject('Magento\Framework\Api\AttributeDataBuilder');
$attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
/** Preconditions */
$this->customerDataMock->expects(
@@ -271,9 +271,9 @@ public function testDispatchWithCustomerCountryNotInEUAndNotLoggedCustomerInGrou
public function testDispatchWithDefaultCustomerGroupId()
{
- /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
$attributeValueBuilder = $this->objectManager
- ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ ->getObject('Magento\Framework\Api\AttributeDataBuilder');
$attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
/** Preconditions */
$this->customerDataMock->expects(
@@ -339,6 +339,13 @@ public function testDispatchWithDefaultCustomerGroupId()
)->with(
$this->customerDataMock,
array('group_id' => 'defaultCustomerGroupId')
+ )->will(
+ $this->returnValue($this->customerBuilderMock)
+ );
+ $this->customerBuilderMock->expects(
+ $this->once()
+ )->method(
+ 'create'
)->will(
$this->returnValue($this->customerDataMock)
);
@@ -351,9 +358,9 @@ public function testDispatchWithDefaultCustomerGroupId()
public function testDispatchWithCustomerCountryInEU()
{
- /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+ /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
$attributeValueBuilder = $this->objectManager
- ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+ ->getObject('Magento\Framework\Api\AttributeDataBuilder');
$attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
/** Preconditions */
$this->customerDataMock->expects($this->exactly(2))
@@ -402,6 +409,9 @@ public function testDispatchWithCustomerCountryInEU()
$this->customerBuilderMock->expects($this->once())
->method('mergeDataObjectWithArray')
->with($this->customerDataMock, array('group_id' => 'customerGroupId'))
+ ->will($this->returnValue($this->customerBuilderMock));
+ $this->customerBuilderMock->expects($this->once())
+ ->method('create')
->will($this->returnValue($this->customerDataMock));
$this->model->dispatch($this->observerMock);
}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php
index d1ce3fd60c7f8..6687dd630de0b 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php
@@ -104,6 +104,16 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
*/
protected $quoteItemCollectionFactoryMock;
+ /**
+ * @var \Magento\Sales\Model\Quote\PaymentFactory
+ */
+ protected $paymentFactoryMock;
+
+ /**
+ * @var \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory
+ */
+ protected $quotePaymentCollectionFactoryMock;
+
/**
* @var \Magento\Framework\App\Config | \PHPUnit_Framework_MockObject_MockObject
*/
@@ -183,6 +193,20 @@ protected function setUp()
'',
false
);
+ $this->quotePaymentCollectionFactoryMock = $this->getMock(
+ 'Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory',
+ ['create'],
+ [],
+ '',
+ false
+ );
+ $this->paymentFactoryMock = $this->getMock(
+ 'Magento\Sales\Model\Quote\PaymentFactory',
+ ['create'],
+ [],
+ '',
+ false
+ );
$this->scopeConfig = $this->getMockBuilder('Magento\Framework\App\Config')
->disableOriginalConstructor()
->getMock();
@@ -202,6 +226,8 @@ protected function setUp()
'customerGroupService' => $this->customerGroupServiceMock,
'objectFactory' => $this->objectFactoryMock,
'quoteItemCollectionFactory' => $this->quoteItemCollectionFactoryMock,
+ 'quotePaymentCollectionFactory' => $this->quotePaymentCollectionFactoryMock,
+ 'quotePaymentFactory' => $this->paymentFactoryMock,
'scopeConfig' => $this->scopeConfig
]
);
@@ -871,4 +897,83 @@ public function testValidateMiniumumAmountNegative()
$this->assertFalse($this->quote->validateMinimumAmount());
}
+
+ public function testGetPaymentIsNotDeleted()
+ {
+ $this->quote->setId(1);
+ $payment = $this->getMock(
+ 'Magento\Sales\Model\Quote\Payment',
+ ['setQuote', 'isDeleted', '__wakeup'],
+ [],
+ '',
+ false
+ );
+ $payment->expects($this->once())
+ ->method('setQuote');
+ $payment->expects($this->once())
+ ->method('isDeleted')
+ ->willReturn(false);
+ $quotePaymentCollectionMock = $this->getMock(
+ 'Magento\Sales\Model\Resource\Quote\Payment\Collection',
+ ['setQuoteFilter', 'getFirstItem'],
+ [],
+ '',
+ false
+ );
+ $quotePaymentCollectionMock->expects($this->once())
+ ->method('setQuoteFilter')
+ ->with(1)
+ ->will($this->returnSelf());
+ $quotePaymentCollectionMock->expects($this->once())
+ ->method('getFirstItem')
+ ->willReturn($payment);
+ $this->quotePaymentCollectionFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($quotePaymentCollectionMock);
+
+ $this->assertInstanceOf('\Magento\Sales\Model\Quote\Payment', $this->quote->getPayment());
+ }
+
+ public function testGetPaymentIsDeleted()
+ {
+ $this->quote->setId(1);
+ $payment = $this->getMock(
+ 'Magento\Sales\Model\Quote\Payment',
+ ['setQuote', 'isDeleted', 'getId', '__wakeup'],
+ [],
+ '',
+ false
+ );
+ $payment->expects($this->exactly(2))
+ ->method('setQuote');
+ $payment->expects($this->once())
+ ->method('isDeleted')
+ ->willReturn(true);
+ $payment->expects($this->once())
+ ->method('getId')
+ ->willReturn(1);
+ $quotePaymentCollectionMock = $this->getMock(
+ 'Magento\Sales\Model\Resource\Quote\Payment\Collection',
+ ['setQuoteFilter', 'getFirstItem'],
+ [],
+ '',
+ false
+ );
+ $quotePaymentCollectionMock->expects($this->once())
+ ->method('setQuoteFilter')
+ ->with(1)
+ ->will($this->returnSelf());
+ $quotePaymentCollectionMock->expects($this->once())
+ ->method('getFirstItem')
+ ->willReturn($payment);
+ $this->quotePaymentCollectionFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($quotePaymentCollectionMock);
+
+ $this->paymentFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($payment);
+
+ $this->assertInstanceOf('\Magento\Sales\Model\Quote\Payment', $this->quote->getPayment());
+ }
}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php
index de530ce459e0c..d7f45cb70a120 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php
@@ -118,7 +118,7 @@ public function testRefresh()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->any())
->method('getTableName')
- ->will($this->returnValue('sales_flat_creditmemo_grid'));
+ ->will($this->returnValue('sales_creditmemo_grid'));
$this->adapterMock->expects($this->once())
->method('select')
->will($this->returnValue($this->selectMock));
@@ -144,7 +144,7 @@ public function testRefresh()
->will($this->returnValue($this->statementMock));
$this->adapterMock->expects($this->once())
->method('insertFromSelect')
- ->with($this->selectMock, 'sales_flat_creditmemo_grid', [], 1)
+ ->with($this->selectMock, 'sales_creditmemo_grid', [], 1)
->will($this->returnValue('sql-query'));
$this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
}
@@ -159,10 +159,10 @@ public function testPurge()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->once())
->method('getTableName')
- ->will($this->returnValue('sales_flat_creditmemo_grid'));
+ ->will($this->returnValue('sales_creditmemo_grid'));
$this->adapterMock->expects($this->once())
->method('delete')
- ->with('sales_flat_creditmemo_grid', ['fi.field = ?' => 1])
+ ->with('sales_creditmemo_grid', ['fi.field = ?' => 1])
->will($this->returnValue(1));
$this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php
index cc1f2f4b5583e..58a808b550e0b 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php
@@ -118,7 +118,7 @@ public function testRefresh()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->any())
->method('getTableName')
- ->will($this->returnValue('sales_flat_order_grid'));
+ ->will($this->returnValue('sales_order_grid'));
$this->adapterMock->expects($this->once())
->method('select')
->will($this->returnValue($this->selectMock));
@@ -141,7 +141,7 @@ public function testRefresh()
->will($this->returnValue($this->statementMock));
$this->adapterMock->expects($this->once())
->method('insertFromSelect')
- ->with($this->selectMock, 'sales_flat_order_grid', [], 1)
+ ->with($this->selectMock, 'sales_order_grid', [], 1)
->will($this->returnValue('sql-query'));
$this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
}
@@ -156,10 +156,10 @@ public function testPurge()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->once())
->method('getTableName')
- ->will($this->returnValue('sales_flat_order_grid'));
+ ->will($this->returnValue('sales_order_grid'));
$this->adapterMock->expects($this->once())
->method('delete')
- ->with('sales_flat_order_grid', ['fi.field = ?' => 1])
+ ->with('sales_order_grid', ['fi.field = ?' => 1])
->will($this->returnValue(1));
$this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php
index f769982945d2d..07bf8902b2f99 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php
@@ -118,7 +118,7 @@ public function testRefresh()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->any())
->method('getTableName')
- ->will($this->returnValue('sales_flat_invoice_grid'));
+ ->will($this->returnValue('sales_invoice_grid'));
$this->adapterMock->expects($this->once())
->method('select')
->will($this->returnValue($this->selectMock));
@@ -144,7 +144,7 @@ public function testRefresh()
->will($this->returnValue($this->statementMock));
$this->adapterMock->expects($this->once())
->method('insertFromSelect')
- ->with($this->selectMock, 'sales_flat_invoice_grid', [], 1)
+ ->with($this->selectMock, 'sales_invoice_grid', [], 1)
->will($this->returnValue('sql-query'));
$this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
}
@@ -159,10 +159,10 @@ public function testPurge()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->once())
->method('getTableName')
- ->will($this->returnValue('sales_flat_invoice_grid'));
+ ->will($this->returnValue('sales_invoice_grid'));
$this->adapterMock->expects($this->once())
->method('delete')
- ->with('sales_flat_invoice_grid', ['fi.field = ?' => 1])
+ ->with('sales_invoice_grid', ['fi.field = ?' => 1])
->will($this->returnValue(1));
$this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
}
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php
index bcc51895cf157..83ff86ee8f903 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php
@@ -118,7 +118,7 @@ public function testRefresh()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->any())
->method('getTableName')
- ->will($this->returnValue('sales_flat_shipment_grid'));
+ ->will($this->returnValue('sales_shipment_grid'));
$this->adapterMock->expects($this->once())
->method('select')
->will($this->returnValue($this->selectMock));
@@ -144,7 +144,7 @@ public function testRefresh()
->will($this->returnValue($this->statementMock));
$this->adapterMock->expects($this->once())
->method('insertFromSelect')
- ->with($this->selectMock, 'sales_flat_shipment_grid', [], 1)
+ ->with($this->selectMock, 'sales_shipment_grid', [], 1)
->will($this->returnValue('sql-query'));
$this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
}
@@ -159,10 +159,10 @@ public function testPurge()
->will($this->returnValue($this->adapterMock));
$this->appResourceMock->expects($this->once())
->method('getTableName')
- ->will($this->returnValue('sales_flat_shipment_grid'));
+ ->will($this->returnValue('sales_shipment_grid'));
$this->adapterMock->expects($this->once())
->method('delete')
- ->with('sales_flat_shipment_grid', ['fi.field = ?' => 1])
+ ->with('sales_shipment_grid', ['fi.field = ?' => 1])
->will($this->returnValue(1));
$this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
}
diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php
index 9ce463b7600c4..461567d1384fa 100644
--- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php
+++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php
@@ -23,6 +23,8 @@
*/
namespace Magento\SalesRule\Model\Quote\Nominal;
+use Magento\TestFramework\Helper\ObjectManager;
+
/**
* Class DiscountTest
*/
@@ -34,14 +36,64 @@ class DiscountTest extends \PHPUnit_Framework_TestCase
protected $discount;
/**
- * @var \Magento\TestFramework\Helper\ObjectManager
+ * @var ObjectManager
*/
protected $objectManager;
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManager
+ */
+ protected $storeManagerMock;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\SalesRule\Model\Validator
+ */
+ protected $validatorMock;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Event\Manager
+ */
+ protected $eventManagerMock;
+
public function setUp()
{
- $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
- $this->discount = $this->objectManager->getObject('Magento\SalesRule\Model\Quote\Nominal\Discount', []);
+ $this->objectManager = new ObjectManager($this);
+
+ $this->storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->validatorMock = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'canApplyRules',
+ 'reset',
+ 'init',
+ 'initTotals',
+ 'sortItemsByPriority',
+ 'setSkipActionsValidation',
+ 'process',
+ 'processShippingAmount',
+ 'canApplyDiscount',
+ '__wakeup'
+ ]
+ )
+ ->getMock();
+
+ $this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\Manager')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ /** @var \Magento\SalesRule\Model\Quote\Nominal\Discount $discount */
+ $this->discount = $this->objectManager->getObject(
+ 'Magento\SalesRule\Model\Quote\Nominal\Discount',
+ [
+ 'storeManager' => $this->storeManagerMock,
+ 'validator' => $this->validatorMock,
+ 'eventManager' => $this->eventManagerMock
+ ]
+ );
}
public function testFetch()
@@ -52,33 +104,50 @@ public function testFetch()
$this->assertInternalType('array', $this->discount->fetch($addressMock));
}
- public function testGetAddressItems()
+ public function testGetNominalAddressItems()
{
+ $item = $this->getMockBuilder('Magento\Sales\Model\Quote\Item')
+ ->disableOriginalConstructor()
+ ->setMethods(['__wakeup'])
+ ->getMock();
+
+ $this->validatorMock->expects($this->once())
+ ->method('sortItemsByPriority')
+ ->willReturnArgument(0);
+
+ $storeMock = $this->getMockBuilder('Magento\Store\Model\Store')
+ ->disableOriginalConstructor()
+ ->setMethods(['getStore', '__wakeup'])
+ ->getMock();
+
+ $this->storeManagerMock->expects($this->once())
+ ->method('getStore')
+ ->willReturn($storeMock);
+
$quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote')
->disableOriginalConstructor()
->getMock();
+
$addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address')
->disableOriginalConstructor()
+ ->setMethods(['getQuote', 'getAllNominalItems', 'getShippingAmount', '__wakeup'])
->getMock();
+
$addressMock->expects($this->any())
->method('getQuote')
->willReturn($quoteMock);
- $storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManager')
- ->disableOriginalConstructor()
- ->getMock();
- $validatorMock = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
- ->disableOriginalConstructor()
- ->getMock();
- /** @var \Magento\SalesRule\Model\Quote\Discount $discount */
- $discount = $this->objectManager->getObject(
- 'Magento\SalesRule\Model\Quote\Discount',
- ['storeManager' => $storeManagerMock, 'validator' => $validatorMock]
- );
+ $addressMock->expects($this->once())
+ ->method('getAllNominalItems')
+ ->willReturn([$item]);
+
+ $addressMock->expects($this->once())
+ ->method('getShippingAmount')
+ ->willReturn(true);
$this->assertInstanceOf(
- 'Magento\Sales\Model\Quote\Address\Total\AbstractTotal',
- $discount->collect($addressMock)
+ 'Magento\SalesRule\Model\Quote\Discount',
+ $this->discount->collect($addressMock)
);
}
}
diff --git a/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php b/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php
index 86aae952ca9c2..823f60046314e 100644
--- a/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php
@@ -550,6 +550,10 @@ private function createService()
)->disableOriginalConstructor()
->getMock();
+ $filterBuilder = $this->objectManager->getObject(
+ 'Magento\Framework\Api\FilterBuilder'
+ );
+
$taxClassService = $this->objectManager->getObject(
'Magento\Tax\Service\V1\TaxClassService',
[
@@ -557,7 +561,8 @@ private function createService()
'taxClassCollectionFactory' => $this->taxClassCollectionFactory,
'classModelRegistry' => $this->classModelRegistryMock,
'searchResultsBuilder' => $this->searchResultBuilder,
- 'converter' => $this->converterMock
+ 'converter' => $this->converterMock,
+ 'filterBuilder' => $filterBuilder
]
);
diff --git a/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php b/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php
index 1377603819091..1a8757d6189a4 100644
--- a/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php
+++ b/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php
@@ -84,7 +84,7 @@ public function testNoRewriteExist()
$this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
$this->store->expects($this->any())->method('getId')->will($this->returnValue('current-store-id'));
- $this->assertEquals(null, $this->router->match($this->request));
+ $this->assertNull($this->router->match($this->request));
}
public function testRewriteAfterStoreSwitcher()
@@ -107,28 +107,24 @@ public function testRewriteAfterStoreSwitcher()
$urlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('new-request-path'));
$this->urlFinder->expects($this->any())->method('findOneByData')->will(
- $this->returnValueMap(
+ $this->returnValueMap([
+ [
+ [UrlRewrite::REQUEST_PATH => 'request-path', UrlRewrite::STORE_ID => 'old-store-id'],
+ $oldUrlRewrite
+ ],
[
[
- [UrlRewrite::REQUEST_PATH => 'request-path', UrlRewrite::STORE_ID => 'old-store-id'],
- $oldUrlRewrite
+ UrlRewrite::ENTITY_TYPE => 'entity-type',
+ UrlRewrite::ENTITY_ID => 'entity-id',
+ UrlRewrite::STORE_ID => 'current-store-id',
+ UrlRewrite::IS_AUTOGENERATED => 1,
],
- [
- [
- UrlRewrite::ENTITY_TYPE => 'entity-type',
- UrlRewrite::ENTITY_ID => 'entity-id',
- UrlRewrite::STORE_ID => 'current-store-id',
- UrlRewrite::IS_AUTOGENERATED => 1,
- ],
- $urlRewrite
- ]
+ $urlRewrite
]
- )
+ ])
);
$this->response->expects($this->once())->method('setRedirect')
- ->with('request-path-302', OptionProvider::TEMPORARY);
- $this->url->expects($this->once())->method('getUrl')->with('', array('_direct' => 'new-request-path'))
- ->will($this->returnValue('request-path-302'));
+ ->with('new-request-path', OptionProvider::TEMPORARY);
$this->request->expects($this->once())->method('setDispatched')->with(true);
$this->actionFactory->expects($this->once())->method('create')
->with('Magento\Framework\App\Action\Redirect', ['request' => $this->request]);
@@ -136,7 +132,7 @@ public function testRewriteAfterStoreSwitcher()
$this->router->match($this->request);
}
- public function testNoRewriteAfterStoreSwitcher()
+ public function testNoRewriteAfterStoreSwitcherWhenNoOldRewrite()
{
$this->request->expects($this->any())->method('getPathInfo')->will($this->returnValue('request-path'));
$this->request->expects($this->any())->method('getParam')->with('___from_store')
@@ -155,7 +151,47 @@ public function testNoRewriteAfterStoreSwitcher()
->disableOriginalConstructor()->getMock();
$urlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('request-path'));
- $this->assertEquals(null, $this->router->match($this->request));
+ $this->assertNull($this->router->match($this->request));
+ }
+
+ public function testNoRewriteAfterStoreSwitcherWhenOldRewriteEqualsToNewOne()
+ {
+ $this->request->expects($this->any())->method('getPathInfo')->will($this->returnValue('request-path'));
+ $this->request->expects($this->any())->method('getParam')->with('___from_store')
+ ->will($this->returnValue('old-store'));
+ $oldStore = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock();
+ $this->storeManager->expects($this->any())->method('getStore')
+ ->will($this->returnValueMap([['old-store', $oldStore], [null, $this->store]]));
+ $oldStore->expects($this->any())->method('getId')->will($this->returnValue('old-store-id'));
+ $this->store->expects($this->any())->method('getId')->will($this->returnValue('current-store-id'));
+ $oldUrlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+ ->disableOriginalConstructor()->getMock();
+ $oldUrlRewrite->expects($this->any())->method('getEntityType')->will($this->returnValue('entity-type'));
+ $oldUrlRewrite->expects($this->any())->method('getEntityId')->will($this->returnValue('entity-id'));
+ $oldUrlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('old-request-path'));
+ $urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+ ->disableOriginalConstructor()->getMock();
+ $urlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('old-request-path'));
+
+ $this->urlFinder->expects($this->any())->method('findOneByData')->will(
+ $this->returnValueMap([
+ [
+ [UrlRewrite::REQUEST_PATH => 'request-path', UrlRewrite::STORE_ID => 'old-store-id'],
+ $oldUrlRewrite
+ ],
+ [
+ [
+ UrlRewrite::ENTITY_TYPE => 'entity-type',
+ UrlRewrite::ENTITY_ID => 'entity-id',
+ UrlRewrite::STORE_ID => 'current-store-id',
+ UrlRewrite::IS_AUTOGENERATED => 1,
+ ],
+ $urlRewrite
+ ]
+ ])
+ );
+
+ $this->assertNull($this->router->match($this->request));
}
public function testMatchWithRedirect()
@@ -177,6 +213,57 @@ public function testMatchWithRedirect()
$this->router->match($this->request);
}
+ public function testMatchWithCustomInternalRedirect()
+ {
+ $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
+ $urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+ ->disableOriginalConstructor()->getMock();
+ $urlRewrite->expects($this->any())->method('getEntityType')->will($this->returnValue('custom'));
+ $urlRewrite->expects($this->any())->method('getRedirectType')->will($this->returnValue('redirect-code'));
+ $urlRewrite->expects($this->any())->method('getTargetPath')->will($this->returnValue('target-path'));
+ $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite));
+ $this->response->expects($this->once())->method('setRedirect')->with('a', 'redirect-code');
+ $this->url->expects($this->once())->method('getUrl')->with('', ['_direct' => 'target-path'])->willReturn('a');
+ $this->request->expects($this->once())->method('setDispatched')->with(true);
+ $this->actionFactory->expects($this->once())->method('create')
+ ->with('Magento\Framework\App\Action\Redirect', ['request' => $this->request]);
+
+ $this->router->match($this->request);
+ }
+
+ /**
+ * @param string $targetPath
+ * @dataProvider externalRedirectTargetPathDataProvider
+ */
+ public function testMatchWithCustomExternalRedirect($targetPath)
+ {
+ $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
+ $urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+ ->disableOriginalConstructor()->getMock();
+ $urlRewrite->expects($this->any())->method('getEntityType')->will($this->returnValue('custom'));
+ $urlRewrite->expects($this->any())->method('getRedirectType')->will($this->returnValue('redirect-code'));
+ $urlRewrite->expects($this->any())->method('getTargetPath')->will($this->returnValue($targetPath));
+ $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite));
+ $this->response->expects($this->once())->method('setRedirect')->with($targetPath, 'redirect-code');
+ $this->url->expects($this->never())->method('getUrl');
+ $this->request->expects($this->once())->method('setDispatched')->with(true);
+ $this->actionFactory->expects($this->once())->method('create')
+ ->with('Magento\Framework\App\Action\Redirect', ['request' => $this->request]);
+
+ $this->router->match($this->request);
+ }
+
+ /**
+ * @return array
+ */
+ public function externalRedirectTargetPathDataProvider()
+ {
+ return [
+ ['http://example.com'],
+ ['https://example.com'],
+ ];
+ }
+
public function testMatch()
{
$this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php
index dead3735e8ac0..901e832d4efd0 100644
--- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php
+++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php
@@ -37,7 +37,7 @@ public function __construct(\Magento\TestFramework\Helper\ObjectManager $objectM
* Returns a builder for a given class name.
*
* @param string $className
- * @return \Magento\Framework\Api\ExtensibleDataBuilderInterface Builder Instance
+ * @return \Magento\Framework\Api\BuilderInterface Builder Instance
*/
public function getDataBuilder($className)
{
diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php
index 91aac919d29cf..ebb368ecd9ff4 100644
--- a/dev/tools/Magento/Tools/Di/compiler.php
+++ b/dev/tools/Magento/Tools/Di/compiler.php
@@ -34,7 +34,6 @@
use Magento\Tools\Di\Code\Scanner;
use Magento\Tools\Di\Definition\Compressor;
use Magento\Tools\Di\Definition\Serializer;
-use Magento\Framework\Api\Code\Generator\Builder;
use Magento\Framework\Api\Code\Generator\Mapper;
use Magento\Framework\Api\Code\Generator\SearchResults;
use Magento\Framework\Api\Code\Generator\SearchResultsBuilder;
@@ -108,9 +107,9 @@
\Magento\Framework\Interception\Code\Generator\Interceptor::ENTITY_TYPE =>
'Magento\Framework\Interception\Code\Generator\Interceptor',
SearchResultsBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
+ DataBuilder::ENTITY_TYPE_BUILDER => 'Magento\Framework\Api\Code\Generator\DataBuilder',
Proxy::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Proxy',
Factory::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Factory',
- Builder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\Builder',
Mapper::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\Mapper',
Repository::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Repository',
Converter::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Converter',
diff --git a/dev/tools/Magento/Tools/Di/entity_generator.php b/dev/tools/Magento/Tools/Di/entity_generator.php
index 58e72db1b02e5..c917c8f1de552 100644
--- a/dev/tools/Magento/Tools/Di/entity_generator.php
+++ b/dev/tools/Magento/Tools/Di/entity_generator.php
@@ -29,7 +29,6 @@
use Magento\Framework\ObjectManager\Code\Generator\Proxy;
use Magento\Framework\Interception\Code\Generator\Interceptor;
use Magento\Framework\Exception;
-use Magento\Framework\Api\Code\Generator\Builder;
use Magento\Framework\Api\Code\Generator\DataBuilder;
use Magento\Framework\Api\Code\Generator\Mapper;
use Magento\Framework\ObjectManager\Code\Generator\Repository;
@@ -97,14 +96,13 @@
DataBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\DataBuilder',
SearchResultsBuilder::ENTITY_TYPE =>
'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
+ DataBuilder::ENTITY_TYPE_BUILDER => 'Magento\Framework\Api\Code\Generator\DataBuilder',
Proxy::ENTITY_TYPE =>
'Magento\Framework\ObjectManager\Code\Generator\Proxy',
Factory::ENTITY_TYPE =>
'Magento\Framework\ObjectManager\Code\Generator\Factory',
Interceptor::ENTITY_TYPE =>
'Magento\Framework\Interception\Code\Generator\Interceptor',
- Builder::ENTITY_TYPE =>
- 'Magento\Framework\Api\Code\Generator\Builder',
Mapper::ENTITY_TYPE =>
'Magento\Framework\Api\Code\Generator\Mapper',
Repository::ENTITY_TYPE =>
diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php
index da13cd6e98c8b..8e67cfa4f18a3 100644
--- a/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php
+++ b/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php
@@ -37,7 +37,7 @@
'cat_pro',
'table_name',
'rule_customer',
- 'sales_flat_',
+ 'sales_',
'catalog_product_link_attribute_',
'catalog_category_flat_',
'catalog_category_entity_',
diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php
index adddc9928605e..6148df634c406 100644
--- a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php
+++ b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php
@@ -298,47 +298,47 @@
'sales/bestsellers_aggregated_yearly' => 'sales_bestsellers_aggregated_yearly',
'sales/billing_agreement' => 'paypal_billing_agreement',
'sales/billing_agreement_order' => 'paypal_billing_agreement_order',
- 'sales/creditmemo' => 'sales_flat_creditmemo',
- 'sales/creditmemo_comment' => 'sales_flat_creditmemo_comment',
- 'sales/creditmemo_grid' => 'sales_flat_creditmemo_grid',
- 'sales/creditmemo_item' => 'sales_flat_creditmemo_item',
- 'sales/invoice' => 'sales_flat_invoice',
- 'sales/invoice_comment' => 'sales_flat_invoice_comment',
- 'sales/invoice_grid' => 'sales_flat_invoice_grid',
- 'sales/invoice_item' => 'sales_flat_invoice_item',
+ 'sales/creditmemo' => 'sales_creditmemo',
+ 'sales/creditmemo_comment' => 'sales_creditmemo_comment',
+ 'sales/creditmemo_grid' => 'sales_creditmemo_grid',
+ 'sales/creditmemo_item' => 'sales_creditmemo_item',
+ 'sales/invoice' => 'sales_invoice',
+ 'sales/invoice_comment' => 'sales_invoice_comment',
+ 'sales/invoice_grid' => 'sales_invoice_grid',
+ 'sales/invoice_item' => 'sales_invoice_item',
'sales/invoiced_aggregated' => 'sales_invoiced_aggregated',
'sales/invoiced_aggregated_order' => 'sales_invoiced_aggregated_order',
- 'sales/order' => 'sales_flat_order',
- 'sales/order_address' => 'sales_flat_order_address',
+ 'sales/order' => 'sales_order',
+ 'sales/order_address' => 'sales_order_address',
'sales/order_aggregated_created' => 'sales_order_aggregated_created',
'sales/order_aggregated_updated' => 'sales_order_aggregated_updated',
'sales/order_entity' => 'sales_order_entity',
- 'sales/order_grid' => 'sales_flat_order_grid',
- 'sales/order_item' => 'sales_flat_order_item',
- 'sales/order_item_option' => 'sales_flat_order_item_option',
- 'sales/order_payment' => 'sales_flat_order_payment',
+ 'sales/order_grid' => 'sales_order_grid',
+ 'sales/order_item' => 'sales_order_item',
+ 'sales/order_item_option' => 'sales_order_item_option',
+ 'sales/order_payment' => 'sales_order_payment',
'sales/order_status' => 'sales_order_status',
- 'sales/order_status_history' => 'sales_flat_order_status_history',
+ 'sales/order_status_history' => 'sales_order_status_history',
'sales/order_status_label' => 'sales_order_status_label',
'sales/order_status_state' => 'sales_order_status_state',
'sales/order_tax' => 'sales_order_tax',
'sales/payment_transaction' => 'sales_payment_transaction',
- 'sales/quote' => 'sales_flat_quote',
- 'sales/quote_address' => 'sales_flat_quote_address',
- 'sales/quote_address_item' => 'sales_flat_quote_address_item',
- 'sales/quote_address_shipping_rate' => 'sales_flat_quote_shipping_rate',
- 'sales/quote_item' => 'sales_flat_quote_item',
- 'sales/quote_item_option' => 'sales_flat_quote_item_option',
- 'sales/quote_payment' => 'sales_flat_quote_payment',
+ 'sales/quote' => 'sales_quote',
+ 'sales/quote_address' => 'sales_quote_address',
+ 'sales/quote_address_item' => 'sales_quote_address_item',
+ 'sales/quote_address_shipping_rate' => 'sales_quote_shipping_rate',
+ 'sales/quote_item' => 'sales_quote_item',
+ 'sales/quote_item_option' => 'sales_quote_item_option',
+ 'sales/quote_payment' => 'sales_quote_payment',
'sales/recurring_payment' => 'recurring_payment',
'sales/recurring_payment_order' => 'recurring_payment_order',
'sales/refunded_aggregated' => 'sales_refunded_aggregated',
'sales/refunded_aggregated_order' => 'sales_refunded_aggregated_order',
- 'sales/shipment' => 'sales_flat_shipment',
- 'sales/shipment_comment' => 'sales_flat_shipment_comment',
- 'sales/shipment_grid' => 'sales_flat_shipment_grid',
- 'sales/shipment_item' => 'sales_flat_shipment_item',
- 'sales/shipment_track' => 'sales_flat_shipment_track',
+ 'sales/shipment' => 'sales_shipment',
+ 'sales/shipment_comment' => 'sales_shipment_comment',
+ 'sales/shipment_grid' => 'sales_shipment_grid',
+ 'sales/shipment_item' => 'sales_shipment_item',
+ 'sales/shipment_track' => 'sales_shipment_track',
'sales/shipping_aggregated' => 'sales_shipping_aggregated',
'sales/shipping_aggregated_order' => 'sales_shipping_aggregated_order',
'sales_entity/order' => 'sales_order',
diff --git a/dev/tools/Magento/Tools/View/Deployer.php b/dev/tools/Magento/Tools/View/Deployer.php
index 2db6fbe071897..1ef9dad1c2a10 100644
--- a/dev/tools/Magento/Tools/View/Deployer.php
+++ b/dev/tools/Magento/Tools/View/Deployer.php
@@ -47,8 +47,8 @@ class Deployer
/** @var Version\StorageInterface */
private $versionStorage;
- /** @var Version\GeneratorInterface */
- private $versionGenerator;
+ /** @var \Magento\Framework\Stdlib\DateTime */
+ private $dateTime;
/** @var \Magento\Framework\View\Asset\Repository */
private $assetRepo;
@@ -68,21 +68,21 @@ class Deployer
/**
* @param Files $filesUtil
* @param Deployer\Log $logger
+ * @param Version\StorageInterface $versionStorage
+ * @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param bool $isDryRun
- * @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
- * @param \Magento\Framework\App\View\Deployment\Version\GeneratorInterface $versionGenerator
*/
public function __construct(
Files $filesUtil,
Deployer\Log $logger,
Version\StorageInterface $versionStorage,
- Version\GeneratorInterface $versionGenerator,
+ \Magento\Framework\Stdlib\DateTime $dateTime,
$isDryRun = false
) {
$this->filesUtil = $filesUtil;
$this->logger = $logger;
$this->versionStorage = $versionStorage;
- $this->versionGenerator = $versionGenerator;
+ $this->dateTime = $dateTime;
$this->isDryRun = $isDryRun;
}
@@ -121,7 +121,7 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales)
}
}
}
- $version = $this->versionGenerator->generate();
+ $version = $this->dateTime->toTimestamp(true);
$this->logger->logMessage("New version of deployed files: {$version}");
if (!$this->isDryRun) {
$this->versionStorage->save($version);
diff --git a/dev/tools/performance-toolkit/benchmark.jmx b/dev/tools/performance-toolkit/benchmark.jmx
index 5a31d4e0c4863..b6686c0670af6 100644
--- a/dev/tools/performance-toolkit/benchmark.jmx
+++ b/dev/tools/performance-toolkit/benchmark.jmx
@@ -116,6 +116,36 @@
1
=
+
+ jmeter_agent_port
+ ${__P(jmeter_agent_port,3450)}
+ =
+
+
+ db_server_ip
+ ${__P(db_server_ip,10.62.51.150)}
+ =
+
+
+ web_server_1_ip
+ ${__P(web_server_1_ip,10.62.51.185)}
+ =
+
+
+ web_server_2_ip
+ ${__P(web_server_2_ip,10.62.51.186)}
+ =
+
+
+ performance_metrics_collector_file_name
+ ${__P(performance_metrics_collector_file_name,performance_metrics_collector_file)}
+ =
+
+
+ response_time_file_name
+ ${__P(response_time_file_name,response_time_file_name)}
+ =
+
@@ -2275,12 +2305,26 @@ vars.put("category_name", props.get("category_name"));
- false
+ true
method
guest
=
true
+
+ true
+ 1
+ =
+ true
+ isAjax
+
+
+ true
+ 1
+ =
+ true
+ ajax
+
@@ -2300,6 +2344,15 @@ vars.put("category_name", props.get("category_name"));
+
+
+
+ Referer
+ http://mage2.com/checkout/onepage/
+
+
+
+
[]
@@ -2310,35 +2363,6 @@ vars.put("category_name", props.get("category_name"));
-
-
-
-
- false
- billing
- =
- true
- toStep
-
-
-
-
-
-
-
- http
-
- ${base_path}checkout/onepage/progress/
- GET
- true
- false
- true
- false
- Java
- false
-
-
-
@@ -2349,23 +2373,37 @@ vars.put("category_name", props.get("category_name"));=
true
-
+
true
- billing[firstname]
- Name
+ billing[city]
+ Culver City
=
true
-
+
true
- billing[lastname]
- Lastname
+ billing[company]
+
=
true
-
+
true
- billing[company]
+ billing[confirm_password]
+
+ =
+ true
+
+
+ true
+ billing[country_id]
+ US
+ =
+ true
+
+
+ true
+ billing[customer_password]
=
true
@@ -2377,31 +2415,31 @@ vars.put("category_name", props.get("category_name"));=
true
-
+
true
- billing[street][]
- 10441 Jefferson Blvd, ste 200
+ billing[fax]
+
=
true
-
+
true
- billing[street][]
-
+ billing[firstname]
+ Name
=
true
-
+
true
- billing[city]
- Culver City
+ billing[lastname]
+ Lastname
=
true
-
+
true
- billing[region_id]
- 12
+ billing[postcode]
+ 90232
=
true
@@ -2412,61 +2450,61 @@ vars.put("category_name", props.get("category_name"));=
true
-
+
true
- billing[postcode]
- 90232
+ billing[region_id]
+ 12
=
true
-
+
true
- billing[country_id]
- US
+ 1
=
true
+ billing[save_in_address_book]
-
+
true
- billing[telephone]
- 1-310-945-0345
+ billing[street][]
+ 10441 Jefferson Blvd, ste 200
=
true
-
+
true
- billing[fax]
+ billing[street][]
=
true
-
+
true
- billing[customer_password]
-
+ billing[telephone]
+ 1-310-945-0345
=
true
-
+
true
- billing[confirm_password]
-
+ billing[use_for_shipping]
+ 1
=
true
-
+
true
- billing[use_for_shipping]
1
=
true
+ ajax
-
+
true
1
=
true
- billing[save_in_address_book]
+ isAjax
@@ -2487,6 +2525,15 @@ vars.put("category_name", props.get("category_name"));
+
+
+
+ Referer
+ http://mage2.com/checkout/onepage/
+
+
+
+
"goto_section":"shipping_method"
@@ -2497,45 +2544,30 @@ vars.put("category_name", props.get("category_name"));
-
-
-
-
- false
- shipping_method
- =
- true
- toStep
-
-
-
-
-
-
-
- http
-
- ${base_path}checkout/onepage/progress/
- GET
- true
- false
- true
- false
- Java
- false
-
-
-
- false
+ true
shipping_method
flatrate_flatrate
=
true
+
+ true
+ 1
+ =
+ true
+ ajax
+
+
+ true
+ 1
+ =
+ true
+ isAjax
+
@@ -2555,6 +2587,15 @@ vars.put("category_name", props.get("category_name"));
+
+
+
+ Referer
+ http://mage2.com/checkout/onepage/
+
+
+
+
"goto_section":"payment"
@@ -2565,35 +2606,6 @@ vars.put("category_name", props.get("category_name"));
-
-
-
-
- false
- payment
- =
- true
- toStep
-
-
-
-
-
-
-
- http
- UTF-8
- ${base_path}checkout/onepage/progress/
- GET
- true
- false
- true
- false
- Java
- false
-
-
-
@@ -2611,6 +2623,20 @@ vars.put("category_name", props.get("category_name"));true
form_key
+
+ true
+ 1
+ =
+ true
+ ajax
+
+
+ true
+ 1
+ =
+ true
+ isAjax
+
@@ -2640,53 +2666,38 @@ vars.put("category_name", props.get("category_name"));
-
+
-
- false
- review
- =
- true
- toStep
-
-
-
-
-
-
-
- http
- UTF-8
- ${base_path}checkout/onepage/progress/
- GET
- true
- false
- true
- false
- Java
- false
-
-
-
-
-
-
-
- true
- payment[method]
- checkmo
+
+ true
+ payment[method]
+ checkmo
=
true
- false
+ true
${form_key}
=
true
form_key
false
+
+ true
+ 1
+ =
+ true
+ ajax
+
+
+ true
+ 1
+ =
+ true
+ isAjax
+
@@ -3306,28 +3317,28 @@ if (emailsCount < 1) {
- false
+ true
context
checkout
=
true
- false
+ true
${customer_email}
=
true
login[username]
- false
+ true
${customer_password}
=
true
login[password]
- false
+ true
${form_key}
=
true
@@ -3472,6 +3483,20 @@ if (emailsCount < 1) {
true
billing[save_in_address_book]
+
+ true
+ 1
+ =
+ true
+ ajax
+
+
+ true
+ 1
+ =
+ true
+ isAjax
+
@@ -3501,90 +3526,44 @@ if (emailsCount < 1) {
-
-
-
-
-
-
-
-
- http
- UTF-8
- ${base_path}checkout/onepage/getAdditional/
- POST
- true
- false
- true
- false
- Java
- false
-
-
-
-
-
- <!-- BLOCK shipping_method_additional -->
-
- Assertion.response_data
- false
- 2
-
-
-
-
-
-
-
- false
- shipping_method
- =
- true
- toStep
-
-
-
-
-
-
-
- http
-
- ${base_path}checkout/onepage/progress/
- GET
- true
- false
- true
- false
- Java
- false
-
-
-
- false
+ true
quote_item
=
true
giftoptions[1496][type]
- false
+ true
quote
=
true
giftoptions[451][type]
- false
+ true
shipping_method
flatrate_flatrate
=
true
+
+ true
+ 1
+ =
+ true
+ ajax
+
+
+ true
+ 1
+ =
+ true
+ isAjax
+
@@ -3614,35 +3593,6 @@ if (emailsCount < 1) {
-
-
-
-
- false
- payment
- =
- true
- toStep
-
-
-
-
-
-
-
- http
- UTF-8
- ${base_path}checkout/onepage/progress/
- GET
- true
- false
- true
- false
- Java
- false
-
-
-
@@ -3660,6 +3610,20 @@ if (emailsCount < 1) {
true
form_key
+
+ true
+ 1
+ =
+ true
+ ajax
+
+
+ true
+ 1
+ =
+ true
+ isAjax
+
@@ -3689,35 +3653,6 @@ if (emailsCount < 1) {
-
-
-
-
- false
- review
- =
- true
- toStep
-
-
-
-
-
-
-
- http
- UTF-8
- ${base_path}checkout/onepage/progress/
- GET
- true
- false
- true
- false
- Java
- false
-
-
-
@@ -3729,13 +3664,27 @@ if (emailsCount < 1) {
true
- false
+ true
${form_key}
=
true
form_key
false
+
+ true
+ 1
+ =
+ true
+ ajax
+
+
+ true
+ 1
+ =
+ true
+ isAjax
+
@@ -4571,6 +4520,148 @@ props.remove("customer_emails_list");
+
+ false
+
+ saveConfig
+
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ false
+ true
+ true
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+ 0
+ true
+
+
+ ${performance_metrics_collector_file_name}
+ 1000
+ false
+
+
+
+
+ ${db_server_ip}
+ ${jmeter_agent_port}
+ CPU
+
+
+
+ ${db_server_ip}
+ ${jmeter_agent_port}
+ Memory
+
+
+
+ ${db_server_ip}
+ ${jmeter_agent_port}
+ Disks I/O
+ unit=kb:readbytes
+
+
+ ${web_server_1_ip}
+ ${jmeter_agent_port}
+ CPU
+
+
+
+ ${web_server_1_ip}
+ ${jmeter_agent_port}
+ Memory
+
+
+
+ ${web_server_1_ip}
+ ${jmeter_agent_port}
+ Disks I/O
+ unit=kb:readbytes
+
+
+ ${web_server_2_ip}
+ ${jmeter_agent_port}
+ CPU
+
+
+
+ ${web_server_2_ip}
+ ${jmeter_agent_port}
+ Memory
+
+
+
+ ${web_server_2_ip}
+ ${jmeter_agent_port}
+ Disks I/O
+ unit=kb:readbytes
+
+
+ ${db_server_ip}
+ ${jmeter_agent_port}
+ Disks I/O
+ unit=kb:writebytes
+
+
+ ${web_server_1_ip}
+ ${jmeter_agent_port}
+ Disks I/O
+ unit=kb:writebytes
+
+
+ ${web_server_2_ip}
+ ${jmeter_agent_port}
+ Disks I/O
+ unit=kb:writebytes
+
+
+
+
+
+ false
+
+ saveConfig
+
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ false
+ true
+ true
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ false
+ 0
+ true
+
+
+ ${response_time_file_name}
+
+
diff --git a/dev/tools/performance-toolkit/fixtures/eav_variations.php b/dev/tools/performance-toolkit/fixtures/eav_variations.php
index 1b5ce595984b0..0dd001ff26aae 100644
--- a/dev/tools/performance-toolkit/fixtures/eav_variations.php
+++ b/dev/tools/performance-toolkit/fixtures/eav_variations.php
@@ -96,3 +96,9 @@
$model->setAttributeSetId(ATTRIBUTE_SET_ID);
$model->save();
+
+/* @var $cache \Magento\Framework\App\CacheInterface */
+$cache = $this->getObjectManager()->get('Magento\Framework\App\CacheInterface');
+
+$cacheKey = \Magento\Eav\Model\Config::ATTRIBUTES_CACHE_ID . \Magento\Catalog\Model\Product::ENTITY;
+$cache->remove($cacheKey);
diff --git a/dev/tools/performance-toolkit/fixtures/stores.php b/dev/tools/performance-toolkit/fixtures/stores.php
index 9c958b7d3631e..bc9a50c8a421a 100644
--- a/dev/tools/performance-toolkit/fixtures/stores.php
+++ b/dev/tools/performance-toolkit/fixtures/stores.php
@@ -55,13 +55,14 @@
$websiteId = $defaultWebsiteId;
}
$website = clone $defaultWebsite;
- $websiteCode = sprintf('website_%d', $i+1);
- $websiteName = sprintf('Website %d', $i+1);
+ $websiteCode = sprintf('website_%d', $i + 1);
+ $websiteName = sprintf('Website %d', $i + 1);
$website->addData(
array(
- 'website_id' => $websiteId,
- 'code' => $websiteCode,
- 'name' => $websiteName
+ 'website_id' => $websiteId,
+ 'code' => $websiteCode,
+ 'name' => $websiteName,
+ 'is_default' => (int)$i == 0,
)
);
$website->save();
@@ -77,7 +78,7 @@
$parentCategoryId = null;
$categoryPath = '1';
- $storeGroupName = sprintf('Store Group %d - website_id_%d', $i+1, $websiteId);
+ $storeGroupName = sprintf('Store Group %d - website_id_%d', $i + 1, $websiteId);
if ($i == 0 && $websiteId == $defaultWebsiteId) {
$groupId = $defaultStoreGroupId;
@@ -124,8 +125,8 @@
$storeId = $defaultStoreViewId;
}
$store = clone $defaultStoreView;
- $storeCode = sprintf('store_view_%d_w_%d_g_%d', $i+1, $websiteId, $groupId);
- $storeName = sprintf('Store view %d - website_id_%d - group_id_%d', $i+1, $websiteId, $groupId);
+ $storeCode = sprintf('store_view_%d_w_%d_g_%d', $i + 1, $websiteId, $groupId);
+ $storeName = sprintf('Store view %d - website_id_%d - group_id_%d', $i + 1, $websiteId, $groupId);
$store->addData(
array(
'store_id' => $storeId,
diff --git a/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php b/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php
index cbaf3b9e39a7f..f9f8fa97e9646 100644
--- a/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php
+++ b/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php
@@ -34,7 +34,7 @@ class Application
/**
* Area code
*/
- const AREA_CODE = 'install';
+ const AREA_CODE = 'adminhtml';
/**
* Application object
@@ -186,6 +186,7 @@ public function getObjectManager()
public function resetObjectManager()
{
$this->_objectManager = null;
+ $this->bootstrap();
return $this;
}
}
diff --git a/dev/tools/performance-toolkit/framework/labels.xml b/dev/tools/performance-toolkit/framework/labels.xml
index 6aa5360ebb6ec..585a2782c969c 100644
--- a/dev/tools/performance-toolkit/framework/labels.xml
+++ b/dev/tools/performance-toolkit/framework/labels.xml
@@ -33,6 +33,6 @@
Categories
Catalog Price Rules
Cart Price Rules
- Regitered Customers
+ Registered Customers
diff --git a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php
index 6281d9a64250f..ffff1e55e19d7 100644
--- a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php
+++ b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php
@@ -40,23 +40,23 @@ abstract class AbstractExtensibleObject extends AbstractSimpleObject implements
* Get an attribute value.
*
* @param string $attributeCode
- * @return \Magento\Framework\Api\AttributeValue|null null if the attribute has not been set
+ * @return \Magento\Framework\Api\AttributeInterface|null null if the attribute has not been set
*/
public function getCustomAttribute($attributeCode)
{
- return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY])
- && isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode])
- ? $this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode]
+ return isset($this->_data[self::CUSTOM_ATTRIBUTES])
+ && isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode])
+ ? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]
: null;
}
/**
* Retrieve custom attributes values.
*
- * @return \Magento\Framework\Api\AttributeValue[]|null
+ * @return \Magento\Framework\Api\AttributeInterface[]|null
*/
public function getCustomAttributes()
{
- return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY]) ? $this->_data[self::CUSTOM_ATTRIBUTES_KEY] : array();
+ return isset($this->_data[self::CUSTOM_ATTRIBUTES]) ? $this->_data[self::CUSTOM_ATTRIBUTES] : [];
}
}
diff --git a/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php b/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php
index bb6c00ef7b8b1..bf6dea476f8f1 100644
--- a/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php
+++ b/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php
@@ -24,11 +24,6 @@
namespace Magento\Framework\Api;
-use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
-use Magento\Framework\Api\MetadataServiceInterface;
-use Magento\Framework\Api\ObjectFactory;
-
/**
* Builder for the SearchResults Service Data Object
*
@@ -46,7 +41,7 @@ abstract class AbstractSearchResultsBuilder extends ExtensibleObjectBuilder
/**
* Item data object builder
*
- * @var ExtensibleObjectBuilder $itemObjectBuilder
+ * @var BuilderInterface $itemObjectBuilder
*/
protected $itemObjectBuilder;
@@ -54,17 +49,17 @@ abstract class AbstractSearchResultsBuilder extends ExtensibleObjectBuilder
* Constructor
*
* @param ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param SearchCriteriaBuilder $searchCriteriaBuilder
- * @param ExtensibleObjectBuilder $itemObjectBuilder
+ * @param BuilderInterface $itemObjectBuilder
*/
public function __construct(
ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
SearchCriteriaBuilder $searchCriteriaBuilder,
- ExtensibleObjectBuilder $itemObjectBuilder
+ BuilderInterface $itemObjectBuilder
) {
parent::__construct($objectFactory, $valueBuilder, $metadataService);
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
diff --git a/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php b/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php
index 5910f4db1cef4..d34e48b4e190f 100644
--- a/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php
+++ b/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php
@@ -37,9 +37,9 @@ abstract class AbstractSimpleObject
/**
* Initialize internal storage
*
- * @param AbstractSimpleObjectBuilder $builder
+ * @param SimpleBuilderInterface $builder
*/
- public function __construct(AbstractSimpleObjectBuilder $builder)
+ public function __construct(SimpleBuilderInterface $builder)
{
$this->_data = $builder->getData();
}
diff --git a/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php b/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php
index 1b025c16317d7..1ea3f9428d2db 100644
--- a/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php
+++ b/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php
@@ -27,7 +27,7 @@
* Base Builder Class for simple data Objects
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
-abstract class AbstractSimpleObjectBuilder
+abstract class AbstractSimpleObjectBuilder implements SimpleBuilderInterface
{
/**
* @var array
@@ -48,37 +48,6 @@ public function __construct(ObjectFactory $objectFactory)
$this->objectFactory = $objectFactory;
}
- /**
- * Populates the fields with an existing entity.
- *
- * @param AbstractSimpleObject $prototype the prototype to base on
- * @return $this
- * @throws \LogicException If $prototype object class is not the same type as object that is constructed
- */
- public function populate(AbstractSimpleObject $prototype)
- {
- $objectType = $this->_getDataObjectType();
- if (!($prototype instanceof $objectType)) {
- throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
- }
- return $this->populateWithArray($prototype->__toArray());
- }
-
- /**
- * Populates the fields with data from the array.
- *
- * Keys for the map are snake_case attribute/field names.
- *
- * @param array $data
- * @return $this
- */
- public function populateWithArray(array $data)
- {
- $this->data = array();
- $this->_setDataValues($data);
- return $this;
- }
-
/**
* Initializes Data Object with the data from array
*
@@ -101,46 +70,6 @@ protected function _setDataValues(array $data)
return $this;
}
- /**
- * Merge second Data Object data with first Data Object data and create new Data Object object based on merge
- * result.
- *
- * @param AbstractSimpleObject $firstDataObject
- * @param AbstractSimpleObject $secondDataObject
- * @return AbstractSimpleObject
- * @throws \LogicException
- */
- public function mergeDataObjects(AbstractSimpleObject $firstDataObject, AbstractSimpleObject $secondDataObject)
- {
- $objectType = $this->_getDataObjectType();
- if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) {
- throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
- }
- $this->_setDataValues($firstDataObject->__toArray());
- $this->_setDataValues($secondDataObject->__toArray());
- return $this->create();
- }
-
- /**
- * Merged data provided in array format with Data Object data and create new Data Object object based on merge
- * result.
- *
- * @param AbstractSimpleObject $dataObject
- * @param array $data
- * @return AbstractSimpleObject
- * @throws \LogicException
- */
- public function mergeDataObjectWithArray(AbstractSimpleObject $dataObject, array $data)
- {
- $objectType = $this->_getDataObjectType();
- if (!($dataObject instanceof $objectType)) {
- throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
- }
- $this->_setDataValues($dataObject->__toArray());
- $this->_setDataValues($data);
- return $this->create();
- }
-
/**
* Builds the Data Object
*
diff --git a/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php b/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php
index 11bb7df963907..1acde51103007 100644
--- a/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php
+++ b/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php
@@ -26,7 +26,7 @@
/**
* Custom Attribute Data object builder
*/
-class AttributeDataBuilder extends CompositeExtensibleDataBuilder
+class AttributeDataBuilder extends AbstractSimpleObjectBuilder
{
/**
* Set attribute code
@@ -36,7 +36,7 @@ class AttributeDataBuilder extends CompositeExtensibleDataBuilder
*/
public function setAttributeCode($attributeCode)
{
- return $this->set(AttributeInterface::ATTRIBUTE_CODE, $attributeCode);
+ return $this->_set(AttributeValue::ATTRIBUTE_CODE, $attributeCode);
}
/**
@@ -47,26 +47,16 @@ public function setAttributeCode($attributeCode)
*/
public function setValue($value)
{
- return $this->set(AttributeInterface::VALUE, $value);
+ return $this->_set(AttributeValue::VALUE, $value);
}
/**
- * Initialize the builder
+ * Return the Data type class name
*
- * @param \Magento\Framework\ObjectManager $objectManager
- * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService
- * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
+ * @return string
*/
- public function __construct(
- \Magento\Framework\ObjectManager $objectManager,
- \Magento\Framework\Api\MetadataServiceInterface $metadataService,
- \Magento\Framework\ObjectManager\Config $objectManagerConfig
- ) {
- parent::__construct(
- $objectManager,
- $metadataService,
- $objectManagerConfig,
- 'Magento\Framework\Api\AttributeInterface'
- );
+ protected function _getDataObjectType()
+ {
+ return '\Magento\Framework\Api\AttributeValue';
}
}
diff --git a/lib/internal/Magento/Framework/Api/AttributeValue.php b/lib/internal/Magento/Framework/Api/AttributeValue.php
index d2c957125684a..a7a2f0e868407 100644
--- a/lib/internal/Magento/Framework/Api/AttributeValue.php
+++ b/lib/internal/Magento/Framework/Api/AttributeValue.php
@@ -24,13 +24,22 @@
namespace Magento\Framework\Api;
-use Magento\Framework\Api\AttributeInterface;
-
/**
* Custom Attribute Data object
*/
class AttributeValue extends AbstractSimpleObject implements AttributeInterface
{
+
+ /**
+ * Initialize internal storage
+ *
+ * @param AttributeDataBuilder $builder
+ */
+ public function __construct(AttributeDataBuilder $builder)
+ {
+ $this->_data = $builder->getData();
+ }
+
/**
* Get attribute code
*
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilder.php b/lib/internal/Magento/Framework/Api/Builder.php
similarity index 50%
rename from lib/internal/Magento/Framework/Api/ExtensibleDataBuilder.php
rename to lib/internal/Magento/Framework/Api/Builder.php
index 229e95ee06c3e..3d77405ca30ee 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Builder.php
@@ -24,15 +24,18 @@
namespace Magento\Framework\Api;
-use Magento\Framework\Api\ExtensibleDataBuilderInterface;
-use Magento\Framework\Model\AbstractExtensibleModel;
-use Magento\Framework\ObjectManager;
-
/**
- * Implementation for \Magento\Framework\Api\ExtensibleDataBuilderInterface.
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
+class Builder implements BuilderInterface
{
+ /**#@+
+ * Constant which defines if builder is created for building data objects or data models.
+ */
+ const TYPE_DATA_OBJECT = 'data_object';
+ const TYPE_DATA_MODEL = 'data_model';
+ /**#@-*/
+
/**
* @var string
*/
@@ -44,9 +47,9 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
protected $data;
/**
- * @var ObjectManager
+ * @var ObjectFactory
*/
- protected $objectManager;
+ protected $objectFactory;
/**
* @var MetadataServiceInterface
@@ -84,32 +87,38 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
protected $dataBuilderFactory;
/**
- * Initialize the builder
- *
- * @param ObjectManager $objectManager
+ * @var \Magento\Framework\ObjectManager\Config
+ */
+ protected $objectManagerConfig;
+
+ /**
+ * @param ObjectFactory $objectFactory
* @param MetadataServiceInterface $metadataService
- * @param \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder
+ * @param AttributeDataBuilder $attributeValueBuilder
* @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
* @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
* @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
+ * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
* @param string $modelClassInterface
*/
public function __construct(
- ObjectManager $objectManager,
+ ObjectFactory $objectFactory,
MetadataServiceInterface $metadataService,
\Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder,
\Magento\Framework\Reflection\DataObjectProcessor $objectProcessor,
\Magento\Framework\Reflection\TypeProcessor $typeProcessor,
\Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory,
- $modelClassInterface
+ \Magento\Framework\ObjectManager\Config $objectManagerConfig,
+ $modelClassInterface = null
) {
- $this->objectManager = $objectManager;
+ $this->objectFactory = $objectFactory;
$this->metadataService = $metadataService;
$this->modelClassInterface = $modelClassInterface;
$this->objectProcessor = $objectProcessor;
$this->attributeValueBuilder = $attributeValueBuilder;
$this->typeProcessor = $typeProcessor;
$this->dataBuilderFactory = $dataBuilderFactory;
+ $this->objectManagerConfig = $objectManagerConfig;
}
/**
@@ -117,12 +126,15 @@ public function __construct(
*/
public function setCustomAttribute($attributeCode, $attributeValue)
{
- $attribute = $this->attributeValueBuilder
- ->setAttributeCode($attributeCode)
- ->setValue($attributeValue)
- ->create();
- // Store as an associative array for easier lookup and processing
- $this->data[AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute;
+ $customAttributesCodes = $this->getCustomAttributesCodes();
+ if (in_array($attributeCode, $customAttributesCodes)) {
+ $attribute = $this->attributeValueBuilder
+ ->setAttributeCode($attributeCode)
+ ->setValue($attributeValue)
+ ->create();
+ //Stores as an associative array for easier lookup and processing
+ $this->data[ExtensibleDataInterface::CUSTOM_ATTRIBUTES][$attributeCode] = $attribute;
+ }
return $this;
}
@@ -131,9 +143,16 @@ public function setCustomAttribute($attributeCode, $attributeValue)
*/
public function setCustomAttributes(array $attributes)
{
+ $customAttributesCodes = $this->getCustomAttributesCodes();
/** @var \Magento\Framework\Api\AttributeInterface $attribute */
foreach ($attributes as $attribute) {
- $this->data[AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY][$attribute->getAttributeCode()] = $attribute;
+ if (!$attribute instanceof AttributeValue) {
+ throw new \LogicException('Custom Attribute array elements can only be type of AttributeValue');
+ }
+ $attributeCode = $attribute->getAttributeCode();
+ if (in_array($attributeCode, $customAttributesCodes)) {
+ $this->data[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute;
+ }
}
return $this;
}
@@ -143,19 +162,24 @@ public function setCustomAttributes(array $attributes)
*/
public function create()
{
- return $this->objectManager->create(
- $this->modelClassInterface,
- ['data' => $this->data]
- );
+ if ($this->getDataType() == self::TYPE_DATA_MODEL) {
+ $dataObject = $this->objectFactory->create(
+ $this->_getDataObjectType(),
+ ['data' => $this->data]
+ );
+ } else {
+ $dataObjectType = $this->_getDataObjectType();
+ $dataObject = $this->objectFactory->create(
+ $dataObjectType,
+ ['builder' => $this]
+ );
+ }
+ $this->data = array();
+ return $dataObject;
}
/**
- * Populates the fields with data from the array.
- *
- * Keys for the map are snake_case attribute/field names.
- *
- * @param array $data
- * @return $this
+ * {@inheritdoc}
*/
public function populateWithArray(array $data)
{
@@ -164,6 +188,106 @@ public function populateWithArray(array $data)
return $this;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function populate(ExtensibleDataInterface $prototype)
+ {
+ $objectType = $this->_getDataObjectType();
+ if (!($prototype instanceof $objectType)) {
+ throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+ }
+ $prototypeArray = $this->objectProcessor->buildOutputDataArray($prototype, $objectType);
+ return $this->populateWithArray($prototypeArray);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function mergeDataObjects(
+ ExtensibleDataInterface $firstDataObject,
+ ExtensibleDataInterface $secondDataObject
+ ) {
+ $objectType = $this->_getDataObjectType();
+ if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) {
+ throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+ }
+ $firstObjectArray = $this->objectProcessor->buildOutputDataArray($firstDataObject, $objectType);
+ $secondObjectArray = $this->objectProcessor->buildOutputDataArray($secondDataObject, $objectType);
+ $this->_setDataValues($firstObjectArray);
+ $this->_setDataValues($secondObjectArray);
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data)
+ {
+ $objectType = $this->_getDataObjectType();
+ if (!($dataObject instanceof $objectType)) {
+ throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+ }
+ $dataArray = $this->objectProcessor->buildOutputDataArray($dataObject, $objectType);
+ $this->_setDataValues($dataArray);
+ $this->_setDataValues($data);
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getData()
+ {
+ return $this->data;
+ }
+
+ /**
+ * @param string $key
+ * @param mixed $value
+ *
+ * @return $this
+ */
+ protected function _set($key, $value)
+ {
+ $this->data[$key] = $value;
+ return $this;
+ }
+
+ /**
+ * Identify type of objects which should be built with generated builder. Value can be one of self::TYPE_DATA_*.
+ *
+ * @return string
+ * @throws \LogicException
+ */
+ protected function getDataType()
+ {
+ $dataType = $this->_getDataObjectType();
+ if (is_subclass_of($dataType, '\Magento\Framework\Api\AbstractSimpleObject')) {
+ return self::TYPE_DATA_OBJECT;
+ } else if (is_subclass_of($dataType, '\Magento\Framework\Model\AbstractExtensibleModel')) {
+ return self::TYPE_DATA_MODEL;
+ }
+
+ $sourceClassPreference = $this->objectManagerConfig->getPreference($dataType);
+ if (empty($sourceClassPreference)) {
+ throw new \LogicException(
+ "Preference for {$this->_getDataObjectType()} is not defined."
+ );
+ }
+
+ if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Api\AbstractSimpleObject')) {
+ return self::TYPE_DATA_OBJECT;
+ } else if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Model\AbstractExtensibleModel')) {
+ return self::TYPE_DATA_MODEL;
+ } else {
+ throw new \LogicException(
+ 'Preference of ' . $this->_getDataObjectType()
+ . ' must extend from AbstractSimpleObject or AbstractExtensibleModel'
+ );
+ }
+ }
+
/**
* Template method used to configure the attribute codes for the custom attributes
*
@@ -177,7 +301,7 @@ protected function getCustomAttributesCodes()
$attributeCodes = [];
/** @var \Magento\Framework\Api\MetadataObjectInterface[] $customAttributesMetadata */
$customAttributesMetadata = $this->metadataService
- ->getCustomAttributesMetadata($this->modelClassInterface);
+ ->getCustomAttributesMetadata($this->_getDataObjectType());
if (is_array($customAttributesMetadata)) {
foreach ($customAttributesMetadata as $attribute) {
$attributeCodes[] = $attribute->getAttributeCode();
@@ -187,20 +311,6 @@ protected function getCustomAttributesCodes()
return $attributeCodes;
}
- /**
- * Set data item value.
- *
- * @param string $key
- * @param mixed $value
- * @return $this
- * @deprecated This method should not be used in the client code and will be removed after Service Layer refactoring
- */
- public function set($key, $value)
- {
- $this->data[$key] = $value;
- return $this;
- }
-
/**
* Initializes Data Object with the data from array
*
@@ -209,7 +319,7 @@ public function set($key, $value)
*/
protected function _setDataValues(array $data)
{
- $dataObjectMethods = get_class_methods($this->modelClassInterface);
+ $dataObjectMethods = get_class_methods($this->_getDataObjectType());
foreach ($data as $key => $value) {
/* First, verify is there any getter for the key on the Service Data Object */
$camelCaseKey = \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key);
@@ -217,14 +327,14 @@ protected function _setDataValues(array $data)
'get' . $camelCaseKey,
'is' . $camelCaseKey
);
- if ($key == AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY
+ if ($key === ExtensibleDataInterface::CUSTOM_ATTRIBUTES
&& is_array($data[$key])
&& !empty($data[$key])
) {
foreach ($data[$key] as $customAttribute) {
$this->setCustomAttribute(
- $customAttribute[AttributeValue::ATTRIBUTE_CODE],
- $customAttribute[AttributeValue::VALUE]
+ $customAttribute[AttributeInterface::ATTRIBUTE_CODE],
+ $customAttribute[AttributeInterface::VALUE]
);
}
} elseif ($methodName = array_intersect($possibleMethods, $dataObjectMethods)) {
@@ -249,7 +359,7 @@ protected function _setDataValues(array $data)
*/
protected function setComplexValue($methodName, $key, array $value)
{
- $returnType = $this->objectProcessor->getMethodReturnType($this->modelClassInterface, $methodName);
+ $returnType = $this->objectProcessor->getMethodReturnType($this->_getDataObjectType(), $methodName);
if ($this->typeProcessor->isTypeSimple($returnType)) {
$this->data[$key] = $value;
return $this;
@@ -273,4 +383,25 @@ protected function setComplexValue($methodName, $key, array $value)
$this->data[$key] = $object;
return $this;
}
+
+ /**
+ * Get data object type based on suffix
+ *
+ * @return string
+ */
+ protected function _getDataObjectType()
+ {
+ if ($this->modelClassInterface) {
+ return $this->modelClassInterface;
+ }
+ $currentClass = get_class($this);
+ $dataBuilderSuffix = 'DataBuilder';
+ if (substr($currentClass, -strlen($dataBuilderSuffix)) === $dataBuilderSuffix) {
+ $dataObjectType = substr($currentClass, 0, -strlen($dataBuilderSuffix)) . 'Interface';
+ } else {
+ $builderSuffix = 'Builder';
+ $dataObjectType = substr($currentClass, 0, -strlen($builderSuffix));
+ }
+ return $dataObjectType;
+ }
}
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilderInterface.php b/lib/internal/Magento/Framework/Api/BuilderInterface.php
similarity index 60%
rename from lib/internal/Magento/Framework/Api/ExtensibleDataBuilderInterface.php
rename to lib/internal/Magento/Framework/Api/BuilderInterface.php
index d7de617e06e5f..58f730c640443 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilderInterface.php
+++ b/lib/internal/Magento/Framework/Api/BuilderInterface.php
@@ -24,10 +24,7 @@
namespace Magento\Framework\Api;
-/**
- * Base builder interface for \Magento\Framework\Api\ExtensibleDataInterface types.
- */
-interface ExtensibleDataBuilderInterface
+interface BuilderInterface extends SimpleBuilderInterface
{
/**
* Set custom attribute value.
@@ -48,7 +45,7 @@ public function setCustomAttribute($attributeCode, $attributeValue);
public function setCustomAttributes(array $attributes);
/**
- * Return created DataInterface object
+ * Return created ExtensibleDataInterface object
*
* @return \Magento\Framework\Api\ExtensibleDataInterface
*/
@@ -63,4 +60,36 @@ public function create();
* @return $this
*/
public function populateWithArray(array $data);
+
+ /**
+ * Populates the fields with an existing entity.
+ *
+ * @param ExtensibleDataInterface $prototype the prototype to base on
+ * @return $this
+ * @throws \LogicException If $prototype object class is not the same type as object that is constructed
+ */
+ public function populate(ExtensibleDataInterface $prototype);
+
+ /**
+ * Populate builder with the two data interfaces, merging them
+ *
+ * @param ExtensibleDataInterface $firstDataObject
+ * @param ExtensibleDataInterface $secondDataObject
+ * @return $this
+ * @throws \LogicException
+ */
+ public function mergeDataObjects(
+ ExtensibleDataInterface $firstDataObject,
+ ExtensibleDataInterface $secondDataObject
+ );
+
+ /**
+ * Populate builder with the data interface and array, merging them
+ *
+ * @param ExtensibleDataInterface $dataObject
+ * @param array $data
+ * @return $this
+ * @throws \LogicException
+ */
+ public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data);
}
diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/Builder.php b/lib/internal/Magento/Framework/Api/Code/Generator/Builder.php
deleted file mode 100644
index 76928c8432c72..0000000000000
--- a/lib/internal/Magento/Framework/Api/Code/Generator/Builder.php
+++ /dev/null
@@ -1,158 +0,0 @@
-_getSourceClassName());
- $publicMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC);
- foreach ($publicMethods as $method) {
- if (!($method->isConstructor() ||
- $method->isFinal() ||
- $method->isStatic() ||
- $method->isDestructor()) &&
- !in_array(
- $method->getName(),
- array('__sleep', '__wakeup', '__clone')
- ) &&
- $method->class !== 'Magento\Framework\Api\AbstractExtensibleObject'
- ) {
- if (substr($method->getName(), 0, 3) == 'get') {
- $methods[] = $this->_getMethodInfo($reflectionClass, $method);
- }
-
- }
- }
- return $methods;
- }
-
- /**
- * Retrieve method info
- *
- * @param \ReflectionClass $class
- * @param \ReflectionMethod $method
- * @return array
- */
- protected function _getMethodInfo(\ReflectionClass $class, \ReflectionMethod $method)
- {
- $methodInfo = [
- 'name' => 'set' . substr($method->getName(), 3),
- 'parameters' => [
- ['name' => lcfirst(substr($method->getName(), 3))]
- ],
- 'body' => "return \$this->_set("
- . '\\' . $class->getName() . "::"
- . strtoupper(preg_replace('/(.)([A-Z])/', "$1_$2", substr($method->getName(), 3)))
- . ", \$" . lcfirst(substr($method->getName(), 3)) . ");",
- 'docblock' => array('shortDescription' => '{@inheritdoc}')
- ];
-
- return $methodInfo;
- }
-
- /**
- * Validate data
- *
- * @return bool
- */
- protected function _validateData()
- {
- $result = parent::_validateData();
-
- if ($result) {
- $sourceClassName = $this->_getSourceClassName();
- $resultClassName = $this->_getResultClassName();
-
- if ($resultClassName !== $sourceClassName . 'Builder') {
- $this->_addError(
- 'Invalid Builder class name [' . $resultClassName . ']. Use ' . $sourceClassName . 'Builder'
- );
- $result = false;
- }
- }
- return $result;
- }
-
- /**
- * Generate code
- *
- * @return string
- */
- protected function _generateCode()
- {
- $this->_classGenerator->setName(
- $this->_getResultClassName()
- )->addProperties(
- $this->_getClassProperties()
- )->addMethods(
- $this->_getClassMethods()
- )->setClassDocBlock(
- $this->_getClassDocBlock()
- )->setExtendedClass('\\Magento\Framework\Api\ExtensibleObjectBuilder');
-
- return $this->_getGeneratedCode();
- }
-}
diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php b/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php
index 2bb68f6c98ccb..1dcb973cbd191 100644
--- a/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php
@@ -37,10 +37,15 @@
class DataBuilder extends EntityAbstract
{
/**
- * Entity type
+ * Builder Entity, used for a builders built based on Data Objects
*/
const ENTITY_TYPE = 'dataBuilder';
+ /**
+ * Builder Entity, used for a builders built based on API interfaces
+ */
+ const ENTITY_TYPE_BUILDER = 'builder';
+
/**
* Data Model property name
*/
@@ -102,30 +107,60 @@ protected function _getClassProperties()
protected function _getDefaultConstructorDefinition()
{
$constructorDefinition = [
- 'name' => '__construct',
- 'parameters' => [
- ['name' => 'objectManager', 'type' => '\Magento\Framework\ObjectManager'],
- ['name' => 'metadataService', 'type' => '\Magento\Framework\Api\MetadataServiceInterface'],
- ['name' => 'objectManagerConfig', 'type' => '\Magento\Framework\ObjectManager\Config'],
- ],
- 'docblock' => [
- 'shortDescription' => 'Initialize the builder',
- 'tags' => [
- [
- 'name' => 'param',
- 'description' => '\Magento\Framework\ObjectManager $objectManager'
- ],
+ 'name' => '__construct',
+ 'parameters' => [
+ ['name' => 'objectFactory', 'type' => '\Magento\Framework\Api\ObjectFactory'],
+ ['name' => 'metadataService', 'type' => '\Magento\Framework\Api\MetadataServiceInterface'],
+ ['name' => 'attributeValueBuilder', 'type' => '\Magento\Framework\Api\AttributeDataBuilder'],
+ ['name' => 'objectProcessor', 'type' => '\Magento\Framework\Reflection\DataObjectProcessor'],
+ ['name' => 'typeProcessor', 'type' => '\Magento\Framework\Reflection\TypeProcessor'],
+ ['name' => 'dataBuilderFactory', 'type' => '\Magento\Framework\Serialization\DataBuilderFactory'],
+ ['name' => 'objectManagerConfig', 'type' => '\Magento\Framework\ObjectManager\Config'],
[
- 'name' => 'param',
- 'description' => '\Magento\Framework\Api\MetadataServiceInterface $metadataService'
- ],
- [
- 'name' => 'param',
- 'description' => '\Magento\Framework\ObjectManager\Config $objectManagerConfig'
+ 'name' => 'modelClassInterface',
+ 'type' => 'string',
+ 'defaultValue' => $this->_getNullDefaultValue()
]
- ]
- ],
- 'body' => "parent::__construct(\$objectManager, \$metadataService, \$objectManagerConfig, "
+ ],
+ 'docblock' => [
+ 'shortDescription' => 'Initialize the builder',
+ 'tags' => [
+ [
+ 'name' => 'param',
+ 'description' => '\Magento\Framework\Api\ObjectFactory $objectFactory'
+ ],
+ [
+ 'name' => 'param',
+ 'description' => '\Magento\Framework\Api\MetadataServiceInterface $metadataService'
+ ],
+ [
+ 'name' => 'param',
+ 'description' => '\Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder'
+ ],
+ [
+ 'name' => 'param',
+ 'description' => '\Magento\Framework\Reflection\DataObjectProcessor $objectProcessor'
+ ],
+ [
+ 'name' => 'param',
+ 'description' => '\Magento\Framework\Reflection\TypeProcessor $typeProcessor'
+ ],
+ [
+ 'name' => 'param',
+ 'description' => '\Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory'
+ ],
+ [
+ 'name' => 'param',
+ 'description' => '\Magento\Framework\ObjectManager\Config $objectManagerConfig'
+ ],
+ [
+ 'name' => 'param',
+ 'description' => 'string|null $modelClassInterface'
+ ]
+ ]
+ ],
+ 'body' => "parent::__construct(\$objectFactory, \$metadataService, \$attributeValueBuilder, "
+ . "\$objectProcessor, \$typeProcessor, \$dataBuilderFactory, \$objectManagerConfig, "
. "'{$this->_getSourceClassName()}');"
];
return $constructorDefinition;
@@ -162,7 +197,7 @@ protected function _getClassMethods()
*/
protected function canUseMethodForGeneration($method)
{
- $isGetter = (substr($method->getName(), 0, 3) == 'get');
+ $isGetter = substr($method->getName(), 0, 3) == 'get' || substr($method->getName(), 0, 2) == 'is';
$isSuitableMethodType = !($method->isConstructor() || $method->isFinal()
|| $method->isStatic() || $method->isDestructor());
$isMagicMethod = in_array($method->getName(), array('__sleep', '__wakeup', '__clone'));
@@ -178,7 +213,11 @@ protected function canUseMethodForGeneration($method)
*/
protected function _getMethodInfo(\ReflectionMethod $method)
{
- $propertyName = substr($method->getName(), 3);
+ if (substr($method->getName(), 0, 2) == 'is') {
+ $propertyName = substr($method->getName(), 2);
+ } else {
+ $propertyName = substr($method->getName(), 3);
+ }
$returnType = (new ClassReflection($this->_getSourceClassName()))
->getMethod($method->getName())
->getDocBlock()
@@ -190,7 +229,7 @@ protected function _getMethodInfo(\ReflectionMethod $method)
'parameters' => [
['name' => lcfirst($propertyName)]
],
- 'body' => "\$this->set('{$fieldName}', \$" . lcfirst($propertyName) . ");"
+ 'body' => "\$this->_set('{$fieldName}', \$" . lcfirst($propertyName) . ");"
. PHP_EOL . "return \$this;",
'docblock' => [
'tags' => [
@@ -202,31 +241,6 @@ protected function _getMethodInfo(\ReflectionMethod $method)
return $methodInfo;
}
- /**
- * Validate data
- *
- * @return bool
- */
- protected function _validateData()
- {
- $result = parent::_validateData();
-
- if ($result) {
- $sourceClassName = $this->_getSourceClassName();
- $resultClassName = $this->_getResultClassName();
-
- if ($resultClassName !== str_replace('Interface', ucfirst(self::ENTITY_TYPE), $sourceClassName)) {
- $this->_addError(
- 'Invalid Builder class name [' . $resultClassName . ']. Use '
- . $sourceClassName
- . ucfirst(self::ENTITY_TYPE)
- );
- $result = false;
- }
- }
- return $result;
- }
-
/**
* Generate code
*
@@ -239,7 +253,7 @@ protected function _generateCode()
->addProperties($this->_getClassProperties())
->addMethods($this->_getClassMethods())
->setClassDocBlock($this->_getClassDocBlock())
- ->setExtendedClass('\Magento\Framework\Api\CompositeExtensibleDataBuilder');
+ ->setExtendedClass('\Magento\Framework\Api\Builder');
return $this->_getGeneratedCode();
}
@@ -248,7 +262,25 @@ protected function _generateCode()
*/
protected function _getSourceClassName()
{
- return parent::_getSourceClassName() . 'Interface';
+ return $this->_getDataObjectType();
+ }
+
+ /**
+ * Get data object type based on suffix
+ *
+ * @return string
+ */
+ protected function _getDataObjectType()
+ {
+ $currentBuilderClass = $this->_getResultClassName();
+ $dataBuilderSuffix = 'DataBuilder';
+ if (substr($currentBuilderClass, -strlen($dataBuilderSuffix)) === $dataBuilderSuffix) {
+ $dataObjectType = substr($currentBuilderClass, 0, -strlen($dataBuilderSuffix)) . 'Interface';
+ } else {
+ $builderSuffix = 'Builder';
+ $dataObjectType = substr($currentBuilderClass, 0, -strlen($builderSuffix));
+ }
+ return $dataObjectType;
}
/**
diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php b/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php
index a668fbbeb50ad..eb97dffa6211e 100644
--- a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php
@@ -68,7 +68,7 @@ protected function _getDefaultConstructorDefinition()
],
[
'name' => 'valueBuilder',
- 'type' => '\\Magento\Framework\Api\AttributeValueBuilder'
+ 'type' => '\\Magento\Framework\Api\AttributeDataBuilder'
],
[
'name' => 'metadataService',
diff --git a/lib/internal/Magento/Framework/Api/CompositeExtensibleDataBuilder.php b/lib/internal/Magento/Framework/Api/CompositeExtensibleDataBuilder.php
deleted file mode 100644
index 15726b43411ce..0000000000000
--- a/lib/internal/Magento/Framework/Api/CompositeExtensibleDataBuilder.php
+++ /dev/null
@@ -1,168 +0,0 @@
-modelClassInterface = $modelClassInterface;
- $this->objectManagerConfig = $objectManagerConfig;
- $arguments = [
- 'metadataService' => $metadataService,
- 'modelClassInterface' => $modelClassInterface
- ];
- $builderClass = ($this->getDataType() == self::TYPE_DATA_MODEL)
- ? 'Magento\Framework\Api\ExtensibleDataBuilder'
- : 'Magento\Framework\Api\ExtensibleObjectBuilder';
- $this->currentBuilder = $objectManager->create($builderClass, $arguments);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCustomAttribute($attributeCode, $attributeValue)
- {
- $this->currentBuilder->setCustomAttribute($attributeCode, $attributeValue);
- return $this;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCustomAttributes(array $attributes)
- {
- $this->currentBuilder->setCustomAttributes($attributes);
- return $this;
- }
-
- /**
- * {@inheritdoc}
- */
- public function create()
- {
- return $this->currentBuilder->create();
- }
-
- /**
- * Proxy all calls to current builder.
- *
- * @param string $name
- * @param array $arguments
- * @return mixed
- */
- public function __call($name, $arguments)
- {
- call_user_func_array([$this->currentBuilder, $name], $arguments);
- return $this;
- }
-
- /**
- * Identify type of objects which should be built with generated builder. Value can be one of self::TYPE_DATA_*.
- *
- * @return string
- * @throws \LogicException
- */
- protected function getDataType()
- {
- $sourceClassPreference = $this->objectManagerConfig->getPreference($this->modelClassInterface);
- if (empty($sourceClassPreference)) {
- throw new \LogicException(
- "Preference for {$this->modelClassInterface} is not defined."
- );
- }
- if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Api\AbstractSimpleObject')) {
- return self::TYPE_DATA_OBJECT;
- } else if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Model\AbstractExtensibleModel')) {
- return self::TYPE_DATA_MODEL;
- } else {
- throw new \LogicException(
- 'Preference of ' . $this->modelClassInterface
- . ' must extend from AbstractSimpleObject or AbstractExtensibleModel'
- );
- }
- }
-
- /**
- * Populates the fields with data from the array.
- *
- * Keys for the map are snake_case attribute/field names.
- *
- * @param array $data
- * @return $this
- */
- public function populateWithArray(array $data)
- {
- $this->currentBuilder->populateWithArray($data);
- return $this;
- }
-
- /**
- * Populates the fields with data from the prototype.
- *
- * @param AbstractSimpleObject $prototype
- * @return $this
- */
- public function populate(AbstractSimpleObject $prototype)
- {
- $this->currentBuilder->populate($prototype);
- return $this;
- }
-}
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php b/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php
index 88cd4f2f40cc1..30feb685e95bd 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php
+++ b/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php
@@ -29,6 +29,11 @@
*/
interface ExtensibleDataInterface
{
+ /**
+ * Array key for custom attributes
+ */
+ const CUSTOM_ATTRIBUTES = 'custom_attributes';
+
/**
* Get an attribute value.
*
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php b/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php
index b596533bea73e..548d6a00c6b1e 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php
+++ b/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php
@@ -28,10 +28,10 @@
* Base Builder Class for extensible data Objects
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
-class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements ExtensibleDataBuilderInterface
+class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements BuilderInterface
{
/**
- * @var AttributeValueBuilder
+ * @var AttributeDataBuilder
*/
protected $attributeValueBuilder;
@@ -52,13 +52,13 @@ class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements Ext
/**
* @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param AttributeDataBuilder $valueBuilder
* @param MetadataServiceInterface $metadataService
* @param string|null $modelClassInterface
*/
public function __construct(
\Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ AttributeDataBuilder $valueBuilder,
MetadataServiceInterface $metadataService,
$modelClassInterface = null
) {
@@ -103,6 +103,81 @@ public function setCustomAttribute($attributeCode, $attributeValue)
return $this;
}
+
+ /**
+ * Populates the fields with an existing entity.
+ *
+ * @param ExtensibleDataInterface $prototype the prototype to base on
+ * @return $this
+ * @throws \LogicException If $prototype object class is not the same type as object that is constructed
+ */
+ public function populate(ExtensibleDataInterface $prototype)
+ {
+ $objectType = $this->_getDataObjectType();
+ if (!($prototype instanceof $objectType)) {
+ throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+ }
+ return $this->populateWithArray($prototype->__toArray());
+ }
+
+ /**
+ * Populates the fields with data from the array.
+ *
+ * Keys for the map are snake_case attribute/field names.
+ *
+ * @param array $data
+ * @return $this
+ */
+ public function populateWithArray(array $data)
+ {
+ $this->data = array();
+ $this->_setDataValues($data);
+ return $this;
+ }
+
+
+ /**
+ * Merge second Data Object data with first Data Object data and create new Data Object object based on merge
+ * result.
+ *
+ * @param ExtensibleDataInterface $firstDataObject
+ * @param ExtensibleDataInterface $secondDataObject
+ * @return $this
+ * @throws \LogicException
+ */
+ public function mergeDataObjects(
+ ExtensibleDataInterface $firstDataObject,
+ ExtensibleDataInterface $secondDataObject
+ ) {
+ $objectType = $this->_getDataObjectType();
+ if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) {
+ throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+ }
+ $this->_setDataValues($firstDataObject->__toArray());
+ $this->_setDataValues($secondDataObject->__toArray());
+ return $this;
+ }
+
+ /**
+ * Merged data provided in array format with Data Object data and create new Data Object object based on merge
+ * result.
+ *
+ * @param ExtensibleDataInterface $dataObject
+ * @param array $data
+ * @return $this
+ * @throws \LogicException
+ */
+ public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data)
+ {
+ $objectType = $this->_getDataObjectType();
+ if (!($dataObject instanceof $objectType)) {
+ throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+ }
+ $this->_setDataValues($dataObject->__toArray());
+ $this->_setDataValues($data);
+ return $this;
+ }
+
/**
* Template method used to configure the attribute codes for the custom attributes
*
diff --git a/lib/internal/Magento/Framework/Api/Filter.php b/lib/internal/Magento/Framework/Api/Filter.php
index 5d106584dc35e..70680d19f59d4 100644
--- a/lib/internal/Magento/Framework/Api/Filter.php
+++ b/lib/internal/Magento/Framework/Api/Filter.php
@@ -27,7 +27,7 @@
/**
* Filter which can be used by any methods from service layer.
*/
-class Filter extends \Magento\Framework\Api\AbstractExtensibleObject
+class Filter extends AbstractExtensibleObject
{
/**
* Get field
diff --git a/lib/internal/Magento/Framework/Api/FilterBuilder.php b/lib/internal/Magento/Framework/Api/FilterBuilder.php
index 506f32587785c..92c7a87012179 100644
--- a/lib/internal/Magento/Framework/Api/FilterBuilder.php
+++ b/lib/internal/Magento/Framework/Api/FilterBuilder.php
@@ -29,7 +29,7 @@
*
* @method Filter create()
*/
-class FilterBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
+class FilterBuilder extends \Magento\Framework\Api\Builder
{
/**
* Set field
diff --git a/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php b/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php
index da0fbfc8f22ff..21798355167e8 100644
--- a/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php
@@ -24,15 +24,16 @@
namespace Magento\Framework\Api\Search;
-use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\Builder;
+use Magento\Framework\Api\ObjectFactory;
+use Magento\Framework\Api\AttributeDataBuilder;
use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\FilterBuilder;
/**
* Builder for FilterGroup Data.
*/
-class FilterGroupBuilder extends ExtensibleObjectBuilder
+class FilterGroupBuilder extends Builder
{
/**
* @var FilterBuilder
@@ -40,18 +41,37 @@ class FilterGroupBuilder extends ExtensibleObjectBuilder
protected $_filterBuilder;
/**
- * @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param ObjectFactory $objectFactory
* @param MetadataServiceInterface $metadataService
+ * @param AttributeDataBuilder $attributeValueBuilder
+ * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
+ * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+ * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
+ * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
* @param FilterBuilder $filterBuilder
+ * @param string|null $modelClassInterface
*/
public function __construct(
- \Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ ObjectFactory $objectFactory,
MetadataServiceInterface $metadataService,
- FilterBuilder $filterBuilder
+ \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder,
+ \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor,
+ \Magento\Framework\Reflection\TypeProcessor $typeProcessor,
+ \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory,
+ \Magento\Framework\ObjectManager\Config $objectManagerConfig,
+ FilterBuilder $filterBuilder,
+ $modelClassInterface = null
) {
- parent::__construct($objectFactory, $valueBuilder, $metadataService);
+ parent::__construct(
+ $objectFactory,
+ $metadataService,
+ $attributeValueBuilder,
+ $objectProcessor,
+ $typeProcessor,
+ $dataBuilderFactory,
+ $objectManagerConfig,
+ $modelClassInterface
+ );
$this->_filterBuilder = $filterBuilder;
}
diff --git a/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php b/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php
index c97d5a94e19dc..2521a8d8d0086 100644
--- a/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php
+++ b/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php
@@ -24,16 +24,12 @@
namespace Magento\Framework\Api;
-use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
-use Magento\Framework\Api\MetadataServiceInterface;
use Magento\Framework\Api\Search\FilterGroupBuilder;
-use Magento\Framework\Api\SortOrder;
/**
* Builder for SearchCriteria Service Data Object
*/
-class SearchCriteriaBuilder extends ExtensibleObjectBuilder
+class SearchCriteriaBuilder extends Builder
{
/**
* @var FilterGroupBuilder
@@ -41,18 +37,37 @@ class SearchCriteriaBuilder extends ExtensibleObjectBuilder
protected $_filterGroupBuilder;
/**
- * @param \Magento\Framework\Api\ObjectFactory $objectFactory
- * @param AttributeValueBuilder $valueBuilder
+ * @param ObjectFactory $objectFactory
* @param MetadataServiceInterface $metadataService
+ * @param AttributeDataBuilder $attributeValueBuilder
+ * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
+ * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+ * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
+ * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
* @param FilterGroupBuilder $filterGroupBuilder
+ * @param string|null $modelClassInterface
*/
public function __construct(
- \Magento\Framework\Api\ObjectFactory $objectFactory,
- AttributeValueBuilder $valueBuilder,
+ ObjectFactory $objectFactory,
MetadataServiceInterface $metadataService,
- FilterGroupBuilder $filterGroupBuilder
+ AttributeDataBuilder $attributeValueBuilder,
+ \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor,
+ \Magento\Framework\Reflection\TypeProcessor $typeProcessor,
+ \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory,
+ \Magento\Framework\ObjectManager\Config $objectManagerConfig,
+ FilterGroupBuilder $filterGroupBuilder,
+ $modelClassInterface = null
) {
- parent::__construct($objectFactory, $valueBuilder, $metadataService);
+ parent::__construct(
+ $objectFactory,
+ $metadataService,
+ $attributeValueBuilder,
+ $objectProcessor,
+ $typeProcessor,
+ $dataBuilderFactory,
+ $objectManagerConfig,
+ $modelClassInterface
+ );
$this->_filterGroupBuilder = $filterGroupBuilder;
}
diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version/GeneratorInterface.php b/lib/internal/Magento/Framework/Api/SimpleBuilderInterface.php
similarity index 74%
rename from lib/internal/Magento/Framework/App/View/Deployment/Version/GeneratorInterface.php
rename to lib/internal/Magento/Framework/Api/SimpleBuilderInterface.php
index 5dc9b87c7cedc..fe4a420473ced 100644
--- a/lib/internal/Magento/Framework/App/View/Deployment/Version/GeneratorInterface.php
+++ b/lib/internal/Magento/Framework/Api/SimpleBuilderInterface.php
@@ -22,17 +22,25 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-namespace Magento\Framework\App\View\Deployment\Version;
+namespace Magento\Framework\Api;
+
/**
- * Algorithm of generation of deployment version of static files
+ * Base Builder interface for simple data Objects
*/
-interface GeneratorInterface
+interface SimpleBuilderInterface
{
/**
- * Return deployment version of static files that is unique enough for the current deployment
+ * Builds the Data Object
+ *
+ * @return AbstractSimpleObject
+ */
+ public function create();
+
+ /**
+ * Return data Object data.
*
- * @return string
+ * @return array
*/
- public function generate();
+ public function getData();
}
diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version.php b/lib/internal/Magento/Framework/App/View/Deployment/Version.php
index d88c37aaf569b..0de9bf9a693e3 100644
--- a/lib/internal/Magento/Framework/App/View/Deployment/Version.php
+++ b/lib/internal/Magento/Framework/App/View/Deployment/Version.php
@@ -39,10 +39,8 @@ class Version
*/
private $versionStorage;
- /**
- * @var \Magento\Framework\App\View\Deployment\Version\GeneratorInterface
- */
- private $versionGenerator;
+ /** @var \Magento\Framework\Stdlib\DateTime */
+ private $dateTime;
/**
* @var string
@@ -51,17 +49,17 @@ class Version
/**
* @param \Magento\Framework\App\State $appState
- * @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
- * @param \Magento\Framework\App\View\Deployment\Version\GeneratorInterface $versionGenerator
+ * @param Version\StorageInterface $versionStorage
+ * @param \Magento\Framework\Stdlib\DateTime $dateTime
*/
public function __construct(
\Magento\Framework\App\State $appState,
\Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage,
- \Magento\Framework\App\View\Deployment\Version\GeneratorInterface $versionGenerator
+ \Magento\Framework\Stdlib\DateTime $dateTime
) {
$this->appState = $appState;
$this->versionStorage = $versionStorage;
- $this->versionGenerator = $versionGenerator;
+ $this->dateTime = $dateTime;
}
/**
@@ -90,13 +88,13 @@ protected function readValue($appMode)
try {
$result = $this->versionStorage->load();
} catch (\UnexpectedValueException $e) {
- $result = $this->versionGenerator->generate();
+ $result = $this->dateTime->toTimestamp(true);
$this->versionStorage->save($result);
}
break;
case \Magento\Framework\App\State::MODE_DEVELOPER:
- $result = $this->versionGenerator->generate();
+ $result = $this->dateTime->toTimestamp(true);
break;
default:
diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php
index cc6d1fa9c40ff..744daa8ff8731 100644
--- a/lib/internal/Magento/Framework/AppInterface.php
+++ b/lib/internal/Magento/Framework/AppInterface.php
@@ -35,7 +35,7 @@ interface AppInterface
/**
* Magento version
*/
- const VERSION = '0.1.0-alpha103';
+ const VERSION = '0.1.0-alpha104';
/**
* Launch application
diff --git a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php
index 56065edfcba6c..d089aff195a49 100644
--- a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php
+++ b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php
@@ -79,6 +79,9 @@ public function getValue()
break;
} elseif ($this->char() == '\\') {
$this->next();
+ if ($this->char() != '\\') {
+ $value .= '\\';
+ }
$value .= $this->char();
} else {
$value .= $this->char();
diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
index da46448e7954f..db4e2d18c1959 100644
--- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
+++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
@@ -35,8 +35,6 @@
*/
abstract class AbstractExtensibleModel extends AbstractModel implements ExtensibleDataInterface
{
- const CUSTOM_ATTRIBUTES_KEY = 'custom_attributes';
-
/**
* @var MetadataServiceInterface
*/
@@ -76,25 +74,25 @@ public function __construct(
*/
protected function filterCustomAttributes($data)
{
- if (empty($data[self::CUSTOM_ATTRIBUTES_KEY])) {
+ if (empty($data[self::CUSTOM_ATTRIBUTES])) {
return $data;
}
$customAttributesCodes = $this->getCustomAttributesCodes();
- $data[self::CUSTOM_ATTRIBUTES_KEY] =
- array_intersect_key($data[self::CUSTOM_ATTRIBUTES_KEY], $customAttributesCodes);
+ $data[self::CUSTOM_ATTRIBUTES] =
+ array_intersect_key($data[self::CUSTOM_ATTRIBUTES], $customAttributesCodes);
return $data;
}
/**
* Retrieve custom attributes values.
*
- * @return \Magento\Framework\Api\AttributeValue[]|null
+ * @return \Magento\Framework\Api\AttributeInterface[]|null
*/
public function getCustomAttributes()
{
// Returning as a sequential array (instead of stored associative array) to be compatible with the interface
- return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY])
- ? array_values($this->_data[self::CUSTOM_ATTRIBUTES_KEY])
+ return isset($this->_data[self::CUSTOM_ATTRIBUTES])
+ ? array_values($this->_data[self::CUSTOM_ATTRIBUTES])
: [];
}
@@ -102,12 +100,12 @@ public function getCustomAttributes()
* Get an attribute value.
*
* @param string $attributeCode
- * @return \Magento\Framework\Api\AttributeValue|null null if the attribute has not been set
+ * @return \Magento\Framework\Api\AttributeInterface|null null if the attribute has not been set
*/
public function getCustomAttribute($attributeCode)
{
- return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode])
- ? $this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode]
+ return isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode])
+ ? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]
: null;
}
@@ -125,7 +123,7 @@ public function getCustomAttribute($attributeCode)
*/
public function setData($key, $value = null)
{
- if ($key == self::CUSTOM_ATTRIBUTES_KEY) {
+ if ($key == self::CUSTOM_ATTRIBUTES) {
throw new \LogicException("Custom attributes must be set only using setCustomAttribute() method.");
}
return parent::setData($key, $value);
@@ -150,17 +148,17 @@ public function setData($key, $value = null)
*/
public function getData($key = '', $index = null)
{
- if ($key == self::CUSTOM_ATTRIBUTES_KEY) {
+ if ($key == self::CUSTOM_ATTRIBUTES) {
throw new \LogicException("Custom attributes array should be retrieved via getCustomAttributes() only.");
} else if ($key == '') {
/** Represent model data and custom attributes as a flat array */
$data = array_merge($this->_data, $this->getCustomAttributes());
- unset($data[self::CUSTOM_ATTRIBUTES_KEY]);
+ unset($data[self::CUSTOM_ATTRIBUTES]);
} else {
$data = parent::getData($key, $index);
if ($data === null) {
/** Try to find necessary data in custom attributes */
- $data = parent::getData(self::CUSTOM_ATTRIBUTES_KEY . "/{$key}", $index);
+ $data = parent::getData(self::CUSTOM_ATTRIBUTES . "/{$key}", $index);
}
}
return $data;
diff --git a/lib/internal/Magento/Framework/Model/AbstractModel.php b/lib/internal/Magento/Framework/Model/AbstractModel.php
index b1e1da7b074e3..f2f11b58ed3ed 100644
--- a/lib/internal/Magento/Framework/Model/AbstractModel.php
+++ b/lib/internal/Magento/Framework/Model/AbstractModel.php
@@ -269,7 +269,7 @@ public function getResourceName()
/**
* Get collection instance
*
- * @deplacated
+ * @deprecated
* @throws \Magento\Framework\Model\Exception
* @return \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection
*/
diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php
index 2ebbe7ed3dfaa..db2e5ca7a379f 100644
--- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php
+++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php
@@ -31,7 +31,6 @@
use Magento\Framework\ObjectManager\Relations;
use Magento\Framework\ObjectManager\Code\Generator;
use Magento\Framework\Interception\Code\Generator as InterceptionGenerator;
-use Magento\Framework\Api\Code\Generator\Builder as BuilderGenerator;
use Magento\Framework\Api\Code\Generator\DataBuilder as DataBuilderGenerator;
use Magento\Framework\Api\Code\Generator\Mapper as MapperGenerator;
use Magento\Framework\ObjectManager\Code\Generator\Converter as ConverterGenerator;
@@ -140,8 +139,7 @@ public function createClassDefinition($definitions, $useCompiled = true)
=> '\Magento\Framework\Interception\Code\Generator\Interceptor',
DataBuilderGenerator::ENTITY_TYPE
=> '\Magento\Framework\Api\Code\Generator\DataBuilder',
- BuilderGenerator::ENTITY_TYPE
- => '\Magento\Framework\Api\Code\Generator\Builder',
+ DataBuilderGenerator::ENTITY_TYPE_BUILDER => 'Magento\Framework\Api\Code\Generator\DataBuilder',
MapperGenerator::ENTITY_TYPE
=> '\Magento\Framework\Api\Code\Generator\Mapper',
SearchResults::ENTITY_TYPE
diff --git a/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php b/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php
index 66dd749bef15f..d041da84a4775 100644
--- a/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php
+++ b/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php
@@ -150,16 +150,17 @@ public function display()
{
$this->stats['used'] = count($this->used);
$this->stats['unused'] = $this->stats['total'] - $this->stats['used'];
- echo '' . PHP_EOL;
- echo "Creation chain (Red items are never used) Total: {$this->stats['total']}\n";
- echo "Used: {$this->stats['used']} Not used: {$this->stats['unused']} ";
- echo '';
- echo "Instance class ";
+ echo '',
+ '',
+ "Creation chain (Red items are never used) Total: {$this->stats['total']}\n",
+ "Used: {$this->stats['used']} Not used: {$this->stats['unused']}",
+ ' ',
+ '',
+ 'Instance class ';
foreach ($this->roots as $root) {
$this->displayItem($root);
}
- echo ' ';
- echo '
';
+ echo '
';
}
/**
diff --git a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php
index b50045e3020ec..4b27b18f1f4cc 100644
--- a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php
+++ b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php
@@ -28,7 +28,7 @@
use Zend\Code\Reflection\MethodReflection;
use Magento\Framework\Api\SimpleDataObjectConverter;
use Magento\Framework\Api\AttributeValue;
-use Magento\Framework\Model\AbstractExtensibleModel;
+use Magento\Framework\Api\ExtensibleDataInterface;
use Magento\Framework\ObjectManager;
/**
@@ -118,7 +118,7 @@ public function buildOutputDataArray($dataObject, $dataObjectType)
continue;
}
$key = SimpleDataObjectConverter::camelCaseToSnakeCase(substr($methodName, 3));
- if ($key === AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY) {
+ if ($key === ExtensibleDataInterface::CUSTOM_ATTRIBUTES) {
$value = $this->convertCustomAttributes($value);
} else if (is_object($value)) {
$value = $this->buildOutputDataArray($value, $returnType);
diff --git a/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php b/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php
index c996d3a8b649d..2ef905716aac1 100644
--- a/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php
+++ b/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php
@@ -48,7 +48,7 @@ public function __construct(ObjectManager $objectManager)
* Returns a builder for a given class name.
*
* @param string $className
- * @return \Magento\Framework\Api\ExtensibleDataBuilderInterface Builder Instance
+ * @return \Magento\Framework\Api\BuilderInterface Builder Instance
*/
public function getDataBuilder($className)
{
diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json
index 41d9cff4101df..493b906ecf30c 100644
--- a/lib/internal/Magento/Framework/composer.json
+++ b/lib/internal/Magento/Framework/composer.json
@@ -2,7 +2,7 @@
"name": "magento/framework",
"description": "N/A",
"type": "magento2-library",
- "version": "0.1.0-alpha103",
+ "version": "0.1.0-alpha104",
"require": {
"php": "~5.4.11|~5.5.0",
"ext-spl": "*",
diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
index f9b00e8912774..9c82575627fbc 100644
--- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
+++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
@@ -310,6 +310,7 @@ define([
return content.gsub(/\{\{widget(.*?)\}\}/i, function(match){
var attributes = this.parseAttributesString(match[1]);
if (attributes.type) {
+ attributes.type = attributes.type.replace(/\\\\/g, "\\");
var imageSrc = this.config.widget_placeholders[attributes.type];
var imageHtml = '