Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into PR_08062017
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Vilchynskyi committed Jun 12, 2017
2 parents b7f8145 + d844e31 commit 0ed852c
Show file tree
Hide file tree
Showing 18 changed files with 144 additions and 77 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ atlassian*
!/vendor/.htaccess
/generated/*
!/generated/.htaccess
.DS_Store
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ env:
- MAGENTO_HOST_NAME="magento2.travis"
matrix:
- TEST_SUITE=unit
- TEST_SUITE=static
- TEST_SUITE=js GRUNT_COMMAND=spec
- TEST_SUITE=js GRUNT_COMMAND=static
- TEST_SUITE=integration INTEGRATION_INDEX=1
- TEST_SUITE=integration INTEGRATION_INDEX=2
- TEST_SUITE=integration INTEGRATION_INDEX=3
- TEST_SUITE=static
- TEST_SUITE=js
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
matrix:
exclude:
- php: 7.0
env: TEST_SUITE=static
- php: 7.0
env: TEST_SUITE=js
env: TEST_SUITE=js GRUNT_COMMAND=spec
- php: 7.0
env: TEST_SUITE=js GRUNT_COMMAND=static
- php: 7.0
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
- php: 7.0
Expand All @@ -49,4 +52,11 @@ cache:
before_install: ./dev/travis/before_install.sh
install: composer install --no-interaction --prefer-dist
before_script: ./dev/travis/before_script.sh
script: ./dev/travis/script.sh
script:
# Set arguments for variants of phpunit based tests; '|| true' prevents failing script when leading test fails
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true

# The scripts for grunt/phpunit type tests
- if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ If you are a new GitHub user, we recommend that you create your own [free github
3. Create and test your work.
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#pull_request).
5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution.

## Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. We expect you to agree to its terms when participating in this project.
The full text is available in the repository [Wiki](https://github.com/magento/magento2/wiki/Magento-Code-of-Conduct).
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function execute()
$this->messageManager->addSuccess(__('You duplicated the product.'));
}
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
$this->messageManager->addError($e->getMessage());
$this->getDataPersistor()->set('catalog_product', $data);
$redirectBack = $productId ? true : 'new';
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO
} catch (LocalizedException $e) {
throw $e;
} catch (\Exception $e) {
throw new \Magento\Framework\Exception\CouldNotSaveException(__('Unable to save product'));
throw new \Magento\Framework\Exception\CouldNotSaveException(__('Unable to save product'), $e);
}
unset($this->instances[$product->getSku()]);
unset($this->instancesById[$product->getId()]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Magento\Framework\App\CacheInterface;
use Magento\Framework\Serialize\Serializer\Json as Serializer;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Eav\Model\Cache\Type as CacheType;
use Magento\Eav\Model\Entity\Attribute;
Expand All @@ -37,9 +37,9 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F
private $cache;

/**
* @var StoreResolverInterface
* @var StoreManagerInterface
*/
private $storeResolver;
private $storeManager;

/**
* @var Serializer
Expand All @@ -66,22 +66,25 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F
/**
* @param BooleanFactory $attrBooleanFactory
* @param CacheInterface $cache
* @param StoreResolverInterface $storeResolver
* @param $storeResolver @deprecated
* @param array $cacheTags
* @param Serializer $serializer
* @param StoreManagerInterface $storeManager
* @codeCoverageIgnore
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
BooleanFactory $attrBooleanFactory,
CacheInterface $cache = null,
StoreResolverInterface $storeResolver = null,
$storeResolver = null,
array $cacheTags = null,
Serializer $serializer = null
Serializer $serializer = null,
StoreManagerInterface $storeManager = null
) {
$this->_attrBooleanFactory = $attrBooleanFactory;
$this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class);
$this->storeResolver = $storeResolver ?: ObjectManager::getInstance()->get(StoreResolverInterface::class);
$this->cacheTags = $cacheTags ?: self::$defaultCacheTags;
$this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class);
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Serializer::class);
}

Expand Down Expand Up @@ -299,7 +302,7 @@ public function getSelectOptions()
{
$cacheKey = 'attribute-navigation-option-' .
$this->getAttribute()->getAttributeCode() . '-' .
$this->storeResolver->getCurrentStoreId();
$this->storeManager->getStore()->getId();
$optionString = $this->cache->load($cacheKey);
if (false === $optionString) {
$options = $this->getAttribute()->getSource()->getAllOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
use Magento\Eav\Model\Entity\Attribute\Frontend\DefaultFrontend;
use Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory;
use Magento\Framework\Serialize\Serializer\Json as Serializer;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Store\Api\Data\StoreInterface;
use Magento\Framework\App\CacheInterface;
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
Expand All @@ -31,9 +32,14 @@ class DefaultFrontendTest extends \PHPUnit_Framework_TestCase
private $serializerMock;

/**
* @var StoreResolverInterface|\PHPUnit_Framework_MockObject_MockObject
* @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $storeResolverMock;
private $storeManagerMock;

/**
* @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $storeMock;

/**
* @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject
Expand Down Expand Up @@ -64,7 +70,9 @@ protected function setUp()
->getMock();
$this->serializerMock = $this->getMockBuilder(Serializer::class)
->getMock();
$this->storeResolverMock = $this->getMockBuilder(StoreResolverInterface::class)
$this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)
->getMockForAbstractClass();
$this->storeMock = $this->getMockBuilder(StoreInterface::class)
->getMockForAbstractClass();
$this->cacheMock = $this->getMockBuilder(CacheInterface::class)
->getMockForAbstractClass();
Expand All @@ -83,7 +91,7 @@ protected function setUp()
[
'_attrBooleanFactory' => $this->booleanFactory,
'cache' => $this->cacheMock,
'storeResolver' => $this->storeResolverMock,
'storeManager' => $this->storeManagerMock,
'serializer' => $this->serializerMock,
'_attribute' => $this->attributeMock,
'cacheTags' => $this->cacheTags
Expand Down Expand Up @@ -188,8 +196,11 @@ public function testGetSelectOptions()
$options = ['option1', 'option2'];
$serializedOptions = "{['option1', 'option2']}";

$this->storeResolverMock->expects($this->once())
->method('getCurrentStoreId')
$this->storeManagerMock->expects($this->once())
->method('getStore')
->willReturn($this->storeMock);
$this->storeMock->expects($this->once())
->method('getId')
->willReturn($storeId);
$this->attributeMock->expects($this->once())
->method('getAttributeCode')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ var config = {
loadPlayer: 'Magento_ProductVideo/js/load-player',
fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events'
}
},
shim: {
vimeoAPI: {}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,24 @@ define([
options: {
videoData: '',
videoSettings: '',
optionsVideoData: ''
optionsVideoData: '',
vimeoJSFrameworkLoaded: false
},

/**
* @private
*/
onVimeoJSFramework: function () {},
PV: 'product-video', // [CONST]
VU: 'video-unplayed',
PVLOADED: 'fotorama__product-video--loaded', // [CONST]
PVLOADING: 'fotorama__product-video--loading', // [CONST]
VID: 'video', // [CONST]
VI: 'vimeo', // [CONST]
FTVC: 'fotorama__video-close',
FTAR: 'fotorama__arr',
fotoramaSpinner: 'fotorama__spinner',
fotoramaSpinnerShow: 'fotorama__spinner--show',
TI: 'video-thumb-icon',
isFullscreen: false,
FTCF: '[data-gallery-role="fotorama__fullscreen-icon"]',
Expand Down Expand Up @@ -147,7 +155,6 @@ define([
* @private
*/
_setOptions: function (options) {

if (options.videoData && options.videoData.length) {
this.options.videoData = options.videoData;
}
Expand Down Expand Up @@ -402,6 +409,14 @@ define([

element.async = true;
element.src = 'https://secure-a.vimeocdn.com/js/froogaloop2.min.js';

/**
* Vimeo js framework on load callback.
*/
element.onload = function () {
this.onVimeoJSFramework();
this.vimeoJSFrameworkLoaded = true;
}.bind(this);
scriptTag.parentNode.insertBefore(element, scriptTag);
},

Expand Down Expand Up @@ -620,15 +635,42 @@ define([
},

/**
*
* @private
*/
_showLoader: function () {
var spinner = this.fotoramaItem.find('.' + this.fotoramaSpinner);

spinner.addClass(this.fotoramaSpinnerShow);
this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.addClass(this.PVLOADING);
},

/**
* @private
*/
_hideLoader: function () {
var spinner = this.fotoramaItem.find('.' + this.fotoramaSpinner);

spinner.removeClass(this.fotoramaSpinnerShow);
this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.removeClass(this.PVLOADING);
},

/**
* @param {Event} event
* @private
*/
_clickHandler: function (event) {
if ($(event.target).hasClass(this.VU) && $(event.target).find('iframe').length === 0) {

$(event.target).removeClass(this.VU);
$(event.target).find('.' + this.PV).productVideoLoader();

if (this.vimeoJSFrameworkLoaded) {
$(event.target).find('.' + this.PV).productVideoLoader();
} else {
this._showLoader();
this.onVimeoJSFramework = function () {
$(event.target).find('.' + this.PV).productVideoLoader();
this._hideLoader();
}.bind(this);
}

$('.' + this.FTAR).addClass(this.isFullscreen ? 'fotorama__arr--shown' : 'fotorama__arr--hidden');
}
Expand Down Expand Up @@ -686,6 +728,7 @@ define([
}

$wrapper.find('.' + this.PVLOADED).removeClass(this.PVLOADED);
this._hideLoader();

$wrapper.find('.' + this.PV).each(function () {
var $item = $(this).parent(),
Expand Down
14 changes: 7 additions & 7 deletions app/code/Magento/Sales/Model/Order/Creditmemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,14 @@ public function canVoid()
*/
public static function getStates()
{
if (is_null(self::$_states)) {
self::$_states = [
if (is_null(static::$_states)) {
static::$_states = [
self::STATE_OPEN => __('Pending'),
self::STATE_REFUNDED => __('Refunded'),
self::STATE_CANCELED => __('Canceled'),
];
}
return self::$_states;
return static::$_states;
}

/**
Expand All @@ -461,11 +461,11 @@ public function getStateName($stateId = null)
$stateId = $this->getState();
}

if (is_null(self::$_states)) {
self::getStates();
if (is_null(static::$_states)) {
static::getStates();
}
if (isset(self::$_states[$stateId])) {
return self::$_states[$stateId];
if (isset(static::$_states[$stateId])) {
return static::$_states[$stateId];
}
return __('Unknown State');
}
Expand Down
14 changes: 7 additions & 7 deletions app/code/Magento/Sales/Model/Order/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,14 @@ public function addItem(\Magento\Sales\Model\Order\Invoice\Item $item)
*/
public static function getStates()
{
if (null === self::$_states) {
self::$_states = [
if (null === static::$_states) {
static::$_states = [
self::STATE_OPEN => __('Pending'),
self::STATE_PAID => __('Paid'),
self::STATE_CANCELED => __('Canceled'),
];
}
return self::$_states;
return static::$_states;
}

/**
Expand All @@ -565,11 +565,11 @@ public function getStateName($stateId = null)
$stateId = $this->getState();
}

if (null === self::$_states) {
self::getStates();
if (null === static::$_states) {
static::getStates();
}
if (isset(self::$_states[$stateId])) {
return self::$_states[$stateId];
if (isset(static::$_states[$stateId])) {
return static::$_states[$stateId];
}
return __('Unknown State');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@ public function getAmount()
*/
public function getTitleDescription()
{
return $this->getSource()->getDataUsingMethod($this->getTitleSourceField());
return $this->getSource()->getOrder()->getData($this->getTitleSourceField());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</settings>
</filterSelect>
</filters>
<massaction name="listing_massaction">
<massaction name="listing_massaction" component="Magento_Ui/js/grid/tree-massactions">
<action name="cancel">
<settings>
<url path="sales/order/massCancel"/>
Expand Down
Loading

0 comments on commit 0ed852c

Please sign in to comment.