Skip to content

Commit

Permalink
Merge pull request magento#1014 from magento-goinc/MAGETWO-31792
Browse files Browse the repository at this point in the history
MVT auto merge.
  • Loading branch information
_executor_github authored and _executor_github committed Dec 15, 2014
2 parents 7743671 + fa2b32d commit 5db792e
Show file tree
Hide file tree
Showing 34 changed files with 803 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,22 @@ Bundle.Option.prototype = {

remove : function(event){
var element = Event.findElement(event, 'div').up('.option-box');
if (element) {
var idInput = Element.select(element, '[name$="[option_id]"]')[0];
if (idInput.value == '') {
element.remove();
} else {
Element.select(element, '[data-state="deleted"]').each(function (elem) {
elem.value = '1';
});

if(element){
Element.select(element, '[data-state="deleted"]').each(function(elem) {
elem.value = '1';
});

Element.select(element, ['input', 'select']).each(function(elem) {
elem.hide();
elem.className = '';
});
Element.select(element, ['input', 'select']).each(function (elem) {
elem.hide();
elem.className = '';
});

Element.hide(element);
Element.hide(element);
}
}
},

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
*/

namespace Magento\Catalog\Plugin\Model\Indexer\Category\Product;

use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction;

class Execute
{
/**
* @var \Magento\PageCache\Model\Config
*/
protected $config;

/**
* @var \Magento\Framework\App\Cache\TypeListInterface
*/
protected $typeList;

/**
* @param \Magento\PageCache\Model\Config $config
* @param \Magento\Framework\App\Cache\TypeListInterface $typeList
*/
public function __construct(
\Magento\PageCache\Model\Config $config,
\Magento\Framework\App\Cache\TypeListInterface $typeList
) {
$this->config = $config;
$this->typeList = $typeList;
}

/**
* @param AbstractAction $subject
* @param AbstractAction $result
* @return AbstractAction
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterExecute(AbstractAction $subject, AbstractAction $result)
{
if ($this->config->isEnabled()) {
$this->typeList->invalidate('full_page');
}
return $result;
}
}
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@
</argument>
</arguments>
</type>

<type name="Magento\Catalog\Model\Indexer\Category\Product\AbstractAction">
<plugin name="invalidate_pagecache_after_rows_reindex" type="Magento\Catalog\Plugin\Model\Indexer\Category\Product\Execute" />
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,9 @@ protected function _getExportData()
$dataRow[self::COL_SKU] = null;
$dataRow[self::COL_ATTR_SET] = null;
$dataRow[self::COL_TYPE] = null;
$dataRow[self::COL_VISIBILITY] = $productData[$defaultStoreId][self::COL_VISIBILITY];
if (isset($productData[$defaultStoreId][self::COL_VISIBILITY])) {
$dataRow[self::COL_VISIBILITY] = $productData[$defaultStoreId][self::COL_VISIBILITY];
}
} else {
$dataRow[self::COL_STORE] = null;
if (isset($stockItemRows[$productId])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ protected function _getItemsData()
{
$attribute = $this->getAttributeModel();
/** @var \Magento\CatalogSearch\Model\Resource\Fulltext\Collection $productCollection */
$productCollection = $this->getLayer()->getProductCollection();
$productCollection = $this->getLayer()
->getProductCollection();
$optionsFacetedData = $productCollection->getFacetedData($attribute->getAttributeCode());

$productSize = $productCollection->getSize();
Expand All @@ -91,9 +92,9 @@ protected function _getItemsData()
continue;
}
// Check filter type
if ($this->getAttributeIsFilterable($attribute) == static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
&& (empty($optionsFacetedData[$option['value']]['count'])
|| !$this->isOptionReducesResults($optionsFacetedData[$option['value']]['count'], $productSize))
if (empty($optionsFacetedData[$option['value']]['count'])
|| ($this->getAttributeIsFilterable($attribute) == static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
&& !$this->isOptionReducesResults($optionsFacetedData[$option['value']]['count'], $productSize))
) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ protected function _renderFiltersBefore()
$this->requestBuilder->bind('search_term', $this->queryText);
}

$this->requestBuilder->bind(
'price_dynamic_algorithm',
$this->_scopeConfig->getValue(
\Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmFactory::XML_PATH_RANGE_CALCULATION,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
$priceRangeCalculation = $this->_scopeConfig->getValue(
\Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmFactory::XML_PATH_RANGE_CALCULATION,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
if ($priceRangeCalculation) {
$this->requestBuilder->bind('price_dynamic_algorithm', $priceRangeCalculation);
}

$this->requestBuilder->setRequestName('quick_search_container');
$queryRequest = $this->requestBuilder->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function getSearchableAttributes()
$productAttributes = $this->productAttributeCollectionFactory->create();
$productAttributes->addFieldToFilter(
['is_searchable', 'is_visible_in_advanced_search', 'is_filterable'],
[1, 1, 1]
[1, 1, [1, 2]]
);

return $productAttributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public function getUrlPath($category)
return $path;
}
$path = $category->getUrlKey();
if ($path === false) {
return $category->getUrlPath();
}
if ($this->isNeedToGenerateUrlPathForParent($category)) {
$parentPath = $this->getUrlPath($this->categoryRepository->get($category->getParentId()));
$path = $parentPath === '' ? $path : $parentPath . '/' . $path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public function invoke(Observer $observer)
{
/** @var Category $category */
$category = $observer->getEvent()->getCategory();
$category->setUrlKey($this->categoryUrlPathGenerator->generateUrlKey($category))
->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
if ($category->getUrlKey() !== false) {
$category->setUrlKey($this->categoryUrlPathGenerator->generateUrlKey($category))
->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
}
}
}
1 change: 1 addition & 0 deletions app/code/Magento/CustomerFinance/etc/export.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ImportExport/etc/export.xsd">
<entity name="customer_finance" label="Customer Finances" model="Magento\CustomerFinance\Model\Export\Customer\Finance" entityAttributeFilterType="customer"/>
<fileFormat name="csv" label="CSV" model="Magento\ImportExport\Model\Export\Adapter\Csv" />
</config>
1 change: 1 addition & 0 deletions app/code/Magento/CustomerImportExport/etc/export.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ImportExport/etc/export.xsd">
<entity name="customer" label="Customers Main File" model="Magento\CustomerImportExport\Model\Export\Customer" entityAttributeFilterType="customer"/>
<entity name="customer_address" label="Customer Addresses" model="Magento\CustomerImportExport\Model\Export\Address" entityAttributeFilterType="customer" />
<fileFormat name="csv" label="CSV" model="Magento\ImportExport\Model\Export\Adapter\Csv" />
</config>
4 changes: 3 additions & 1 deletion app/code/Magento/Directory/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ public function getRegionJson()
];
}
$json = $this->_coreHelper->jsonEncode($regions);

if ($json === false) {
$json = 'false';
}
$this->_configCacheType->save($json, $cacheKey);
}
$this->_regionJson = $json;
Expand Down
19 changes: 19 additions & 0 deletions app/code/Magento/LayeredNavigation/Model/Aggregation/Status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
*
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
*/
namespace Magento\LayeredNavigation\Model\Aggregation;

use Magento\Framework\Search\Request\Aggregation\StatusInterface;

class Status implements StatusInterface
{
/**
* {@inheritdoc}
*/
public function isEnabled()
{
return true;
}
}
9 changes: 9 additions & 0 deletions app/code/Magento/LayeredNavigation/etc/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!--
/**
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Framework\Search\Request\Aggregation\StatusInterface" type="Magento\LayeredNavigation\Model\Aggregation\Status" />
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@ public function execute()
if ($this->_config->isEnabled()) {
$this->_typeList->invalidate('full_page');
}
return $this;
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/Resource/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
$store->getName(),
];
$object->setStoreName(implode("\n", $name));
$object->setTotalItemCount($this->calculateItems($object));
}
$object->setTotalItemCount($this->calculateItems($object));
$object->setData(
'protect_code',
substr(md5(uniqid(Random::getRandomNumber(), true) . ':' . microtime(true)), 5, 6)
Expand Down
1 change: 1 addition & 0 deletions app/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<preference for="Magento\Framework\ObjectManager\FactoryInterface" type="Magento\Framework\ObjectManager\Factory\Dynamic\Developer" />
<preference for="Magento\Framework\Search\Adapter\Mysql\Filter\PreprocessorInterface" type="Magento\Framework\Search\Adapter\Mysql\Filter\Preprocessor" />
<preference for="Magento\Framework\Search\Adapter\Mysql\Field\ResolverInterface" type="Magento\Framework\Search\Adapter\Mysql\Field\Resolver" />
<preference for="Magento\Framework\Search\Request\Aggregation\StatusInterface" type="Magento\Framework\Search\Request\Aggregation\Status" />
<preference for="Magento\Framework\App\RequestInterface" type="Magento\Framework\App\Request\Http" />
<preference for="Magento\Framework\App\Http\RequestInterface" type="Magento\Framework\App\Request\Http" />
<preference for="Magento\Framework\App\Request\PathInfoProcessorInterface" type="Magento\Store\App\Request\PathInfoProcessor" />
Expand Down
2 changes: 1 addition & 1 deletion dev/build/core_dev/integration/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

<target name="prepare_for_single_process">
<exec dir="${product_root_dir}/dev/tests/integration" executable="mysql" failonerror="true">
<arg line="-u${env.db_user} -p${env.db_password} -e 'DROP DATABASE IF EXISTS ${env.db_name}_${instance_index}; CREATE DATABASE ${env.db_name}_${instance_index}'"/>
<arg line="-u${env.db_user} -p${env.db_password} -h${env.db_host} -e 'DROP DATABASE IF EXISTS ${env.db_name}_${instance_index}; CREATE DATABASE ${env.db_name}_${instance_index}'"/>
</exec>

<copy file="${basedir}/dev/build/core_dev/integration/install-config-${db_vendor_name}.php"
Expand Down
34 changes: 23 additions & 11 deletions dev/build/publication/extra_files/ce/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,42 @@ env:
- TEST_SUITE=static_annotation
matrix:
exclude:
- php: 5.5
- php: 5.4
env: TEST_SUITE=static_phpcs
- php: 5.5
- php: 5.4
env: TEST_SUITE=static_annotation
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq postfix
before_script:
# mock mail
# Mock mail
- sudo service postfix stop
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
- echo -e '#!/usr/bin/env bash\nexit 0' | sudo tee /usr/sbin/sendmail
- echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -i | grep "PHP Version" | head -n 1 | grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini"
- >
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "'
| sudo tee "/home/travis/.phpenv/versions/`php -i
| grep "PHP Version"
| head -n 1
| grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini"
# Disable xDebug
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
# Create DB for Integration tests
- sh -c "if [ '$TEST_SUITE' = 'integration' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then mysql -e 'create database magento_integration_tests;'; mv dev/tests/integration/etc/install-config-mysql.travis.php.dist dev/tests/integration/etc/install-config-mysql.php; fi"
# Install tools for static tests
- sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ] || [ '$TEST_SUITE' = 'static_annotation' ]; then pear install pear/PHP_CodeSniffer-1.5.2; fi"
# Change memmory_limit for travis server
# Install MySQL 5.6, create DB for integration tests
- >
sh -c "if [ '$TEST_SUITE' = 'integration' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then
sudo apt-get remove --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5;
sudo apt-get autoremove;
sudo apt-get autoclean;
sudo apt-add-repository ppa:ondrej/mysql-5.6 -y;
sudo apt-get update;
sudo apt-get install mysql-server-5.6 mysql-client-5.6;
mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_integration_tests;';
mv dev/tests/integration/etc/install-config-mysql.travis.php.dist dev/tests/integration/etc/install-config-mysql.php;
fi"
# Change memory_limit for travis
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- phpenv rehash;
- composer install --no-interaction --prefer-source --dev
- cd ..
- composer install --no-interaction --dev
script:
# Unit tests
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist; fi"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ protected function _assignConfigData(\PHPUnit_Framework_TestCase $test)
if (preg_match('/^.+?(?=_store\s)/', $configPathAndValue, $matches)) {
/* Store-scoped config value */
$storeCode = $matches[0] != 'current' ? $matches[0] : null;
list(, $configPath, $requiredValue) = preg_split('/\s+/', $configPathAndValue, 3);
$parts = preg_split('/\s+/', $configPathAndValue, 3);
list(, $configPath, $requiredValue) = $parts + ['', '', ''];
$originalValue = $this->_getConfigValue($configPath, $storeCode);
$this->_storeConfigValues[$storeCode][$configPath] = $originalValue;
$this->_setConfigValue($configPath, $requiredValue, $storeCode);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
*/
namespace Magento\Sales\Model\Order;

class InvoiceTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Sales\Model\Resource\Order\Collection
*/
private $_collection;

protected function setUp()
{
$this->_collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
'Magento\Sales\Model\Resource\Order\Collection'
);
}

/**
* @magentoDataFixture Magento/Sales/_files/invoice.php
*/
public function testOrderTotalItemCount()
{
$expectedResult = [['total_item_count' => 1]];
$actualResult = [];
/** @var \Magento\Sales\Model\Order $order */
foreach ($this->_collection->getItems() as $order) {
$actualResult[] = ['total_item_count' => $order->getData('total_item_count')];
}
$this->assertEquals($expectedResult, $actualResult);
}
}
Loading

0 comments on commit 5db792e

Please sign in to comment.