Skip to content

Commit d844e31

Browse files
author
Oleksii Korshenko
authored
Merge pull request #1184 from magento-engcom/develop-prs
Public Pull Requests: #9872 #9780 #9892 #9890 #9873 #9813 #9690 #9368 #4450
2 parents 760bb52 + 1098320 commit d844e31

File tree

18 files changed

+144
-77
lines changed

18 files changed

+144
-77
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,4 @@ atlassian*
6666
!/vendor/.htaccess
6767
/generated/*
6868
!/generated/.htaccess
69+
.DS_Store

.travis.yml

+14-4
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,22 @@ env:
2222
- MAGENTO_HOST_NAME="magento2.travis"
2323
matrix:
2424
- TEST_SUITE=unit
25+
- TEST_SUITE=static
26+
- TEST_SUITE=js GRUNT_COMMAND=spec
27+
- TEST_SUITE=js GRUNT_COMMAND=static
2528
- TEST_SUITE=integration INTEGRATION_INDEX=1
2629
- TEST_SUITE=integration INTEGRATION_INDEX=2
2730
- TEST_SUITE=integration INTEGRATION_INDEX=3
28-
- TEST_SUITE=static
29-
- TEST_SUITE=js
3031
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
3132
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
3233
matrix:
3334
exclude:
3435
- php: 7.0
3536
env: TEST_SUITE=static
3637
- php: 7.0
37-
env: TEST_SUITE=js
38+
env: TEST_SUITE=js GRUNT_COMMAND=spec
39+
- php: 7.0
40+
env: TEST_SUITE=js GRUNT_COMMAND=static
3841
- php: 7.0
3942
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
4043
- php: 7.0
@@ -49,4 +52,11 @@ cache:
4952
before_install: ./dev/travis/before_install.sh
5053
install: composer install --no-interaction --prefer-dist
5154
before_script: ./dev/travis/before_script.sh
52-
script: ./dev/travis/script.sh
55+
script:
56+
# Set arguments for variants of phpunit based tests; '|| true' prevents failing script when leading test fails
57+
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
58+
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true
59+
60+
# The scripts for grunt/phpunit type tests
61+
- if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
62+
- if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi

CONTRIBUTING.md

+5
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ If you are a new GitHub user, we recommend that you create your own [free github
2929
3. Create and test your work.
3030
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).
3131
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.
32+
33+
## Code of Conduct
34+
35+
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.
36+
The full text is available in the repository [Wiki](https://github.com/magento/magento2/wiki/Magento-Code-of-Conduct).

app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public function execute()
144144
$this->messageManager->addSuccess(__('You duplicated the product.'));
145145
}
146146
} catch (\Magento\Framework\Exception\LocalizedException $e) {
147+
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
147148
$this->messageManager->addError($e->getMessage());
148149
$this->getDataPersistor()->set('catalog_product', $data);
149150
$redirectBack = $productId ? true : 'new';

app/code/Magento/Catalog/Model/ProductRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO
634634
} catch (LocalizedException $e) {
635635
throw $e;
636636
} catch (\Exception $e) {
637-
throw new \Magento\Framework\Exception\CouldNotSaveException(__('Unable to save product'));
637+
throw new \Magento\Framework\Exception\CouldNotSaveException(__('Unable to save product'), $e);
638638
}
639639
unset($this->instances[$product->getSku()]);
640640
unset($this->instancesById[$product->getId()]);

app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php

+11-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Magento\Framework\App\CacheInterface;
1515
use Magento\Framework\Serialize\Serializer\Json as Serializer;
16-
use Magento\Store\Api\StoreResolverInterface;
16+
use Magento\Store\Model\StoreManagerInterface;
1717
use Magento\Framework\App\ObjectManager;
1818
use Magento\Eav\Model\Cache\Type as CacheType;
1919
use Magento\Eav\Model\Entity\Attribute;
@@ -37,9 +37,9 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F
3737
private $cache;
3838

3939
/**
40-
* @var StoreResolverInterface
40+
* @var StoreManagerInterface
4141
*/
42-
private $storeResolver;
42+
private $storeManager;
4343

4444
/**
4545
* @var Serializer
@@ -66,22 +66,25 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F
6666
/**
6767
* @param BooleanFactory $attrBooleanFactory
6868
* @param CacheInterface $cache
69-
* @param StoreResolverInterface $storeResolver
69+
* @param $storeResolver @deprecated
7070
* @param array $cacheTags
7171
* @param Serializer $serializer
72+
* @param StoreManagerInterface $storeManager
7273
* @codeCoverageIgnore
74+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7375
*/
7476
public function __construct(
7577
BooleanFactory $attrBooleanFactory,
7678
CacheInterface $cache = null,
77-
StoreResolverInterface $storeResolver = null,
79+
$storeResolver = null,
7880
array $cacheTags = null,
79-
Serializer $serializer = null
81+
Serializer $serializer = null,
82+
StoreManagerInterface $storeManager = null
8083
) {
8184
$this->_attrBooleanFactory = $attrBooleanFactory;
8285
$this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class);
83-
$this->storeResolver = $storeResolver ?: ObjectManager::getInstance()->get(StoreResolverInterface::class);
8486
$this->cacheTags = $cacheTags ?: self::$defaultCacheTags;
87+
$this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class);
8588
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Serializer::class);
8689
}
8790

@@ -299,7 +302,7 @@ public function getSelectOptions()
299302
{
300303
$cacheKey = 'attribute-navigation-option-' .
301304
$this->getAttribute()->getAttributeCode() . '-' .
302-
$this->storeResolver->getCurrentStoreId();
305+
$this->storeManager->getStore()->getId();
303306
$optionString = $this->cache->load($cacheKey);
304307
if (false === $optionString) {
305308
$options = $this->getAttribute()->getSource()->getAllOptions();

app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php

+18-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
use Magento\Eav\Model\Entity\Attribute\Frontend\DefaultFrontend;
99
use Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory;
1010
use Magento\Framework\Serialize\Serializer\Json as Serializer;
11-
use Magento\Store\Api\StoreResolverInterface;
11+
use Magento\Store\Model\StoreManagerInterface;
12+
use Magento\Store\Api\Data\StoreInterface;
1213
use Magento\Framework\App\CacheInterface;
1314
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
1415
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
@@ -31,9 +32,14 @@ class DefaultFrontendTest extends \PHPUnit_Framework_TestCase
3132
private $serializerMock;
3233

3334
/**
34-
* @var StoreResolverInterface|\PHPUnit_Framework_MockObject_MockObject
35+
* @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
3536
*/
36-
private $storeResolverMock;
37+
private $storeManagerMock;
38+
39+
/**
40+
* @var StoreInterface|\PHPUnit_Framework_MockObject_MockObject
41+
*/
42+
private $storeMock;
3743

3844
/**
3945
* @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -64,7 +70,9 @@ protected function setUp()
6470
->getMock();
6571
$this->serializerMock = $this->getMockBuilder(Serializer::class)
6672
->getMock();
67-
$this->storeResolverMock = $this->getMockBuilder(StoreResolverInterface::class)
73+
$this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)
74+
->getMockForAbstractClass();
75+
$this->storeMock = $this->getMockBuilder(StoreInterface::class)
6876
->getMockForAbstractClass();
6977
$this->cacheMock = $this->getMockBuilder(CacheInterface::class)
7078
->getMockForAbstractClass();
@@ -83,7 +91,7 @@ protected function setUp()
8391
[
8492
'_attrBooleanFactory' => $this->booleanFactory,
8593
'cache' => $this->cacheMock,
86-
'storeResolver' => $this->storeResolverMock,
94+
'storeManager' => $this->storeManagerMock,
8795
'serializer' => $this->serializerMock,
8896
'_attribute' => $this->attributeMock,
8997
'cacheTags' => $this->cacheTags
@@ -188,8 +196,11 @@ public function testGetSelectOptions()
188196
$options = ['option1', 'option2'];
189197
$serializedOptions = "{['option1', 'option2']}";
190198

191-
$this->storeResolverMock->expects($this->once())
192-
->method('getCurrentStoreId')
199+
$this->storeManagerMock->expects($this->once())
200+
->method('getStore')
201+
->willReturn($this->storeMock);
202+
$this->storeMock->expects($this->once())
203+
->method('getId')
193204
->willReturn($storeId);
194205
$this->attributeMock->expects($this->once())
195206
->method('getAttributeCode')

app/code/Magento/ProductVideo/view/frontend/requirejs-config.js

+3
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ var config = {
99
loadPlayer: 'Magento_ProductVideo/js/load-player',
1010
fotoramaVideoEvents: 'Magento_ProductVideo/js/fotorama-add-video-events'
1111
}
12+
},
13+
shim: {
14+
vimeoAPI: {}
1215
}
1316
};

app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js

+48-5
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,24 @@ define([
9494
options: {
9595
videoData: '',
9696
videoSettings: '',
97-
optionsVideoData: ''
97+
optionsVideoData: '',
98+
vimeoJSFrameworkLoaded: false
9899
},
99100

101+
/**
102+
* @private
103+
*/
104+
onVimeoJSFramework: function () {},
100105
PV: 'product-video', // [CONST]
101106
VU: 'video-unplayed',
102107
PVLOADED: 'fotorama__product-video--loaded', // [CONST]
108+
PVLOADING: 'fotorama__product-video--loading', // [CONST]
103109
VID: 'video', // [CONST]
104110
VI: 'vimeo', // [CONST]
105111
FTVC: 'fotorama__video-close',
106112
FTAR: 'fotorama__arr',
113+
fotoramaSpinner: 'fotorama__spinner',
114+
fotoramaSpinnerShow: 'fotorama__spinner--show',
107115
TI: 'video-thumb-icon',
108116
isFullscreen: false,
109117
FTCF: '[data-gallery-role="fotorama__fullscreen-icon"]',
@@ -147,7 +155,6 @@ define([
147155
* @private
148156
*/
149157
_setOptions: function (options) {
150-
151158
if (options.videoData && options.videoData.length) {
152159
this.options.videoData = options.videoData;
153160
}
@@ -402,6 +409,14 @@ define([
402409

403410
element.async = true;
404411
element.src = 'https://secure-a.vimeocdn.com/js/froogaloop2.min.js';
412+
413+
/**
414+
* Vimeo js framework on load callback.
415+
*/
416+
element.onload = function () {
417+
this.onVimeoJSFramework();
418+
this.vimeoJSFrameworkLoaded = true;
419+
}.bind(this);
405420
scriptTag.parentNode.insertBefore(element, scriptTag);
406421
},
407422

@@ -620,15 +635,42 @@ define([
620635
},
621636

622637
/**
623-
*
638+
* @private
639+
*/
640+
_showLoader: function () {
641+
var spinner = this.fotoramaItem.find('.' + this.fotoramaSpinner);
642+
643+
spinner.addClass(this.fotoramaSpinnerShow);
644+
this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.addClass(this.PVLOADING);
645+
},
646+
647+
/**
648+
* @private
649+
*/
650+
_hideLoader: function () {
651+
var spinner = this.fotoramaItem.find('.' + this.fotoramaSpinner);
652+
653+
spinner.removeClass(this.fotoramaSpinnerShow);
654+
this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.removeClass(this.PVLOADING);
655+
},
656+
657+
/**
624658
* @param {Event} event
625659
* @private
626660
*/
627661
_clickHandler: function (event) {
628662
if ($(event.target).hasClass(this.VU) && $(event.target).find('iframe').length === 0) {
629-
630663
$(event.target).removeClass(this.VU);
631-
$(event.target).find('.' + this.PV).productVideoLoader();
664+
665+
if (this.vimeoJSFrameworkLoaded) {
666+
$(event.target).find('.' + this.PV).productVideoLoader();
667+
} else {
668+
this._showLoader();
669+
this.onVimeoJSFramework = function () {
670+
$(event.target).find('.' + this.PV).productVideoLoader();
671+
this._hideLoader();
672+
}.bind(this);
673+
}
632674

633675
$('.' + this.FTAR).addClass(this.isFullscreen ? 'fotorama__arr--shown' : 'fotorama__arr--hidden');
634676
}
@@ -686,6 +728,7 @@ define([
686728
}
687729

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

690733
$wrapper.find('.' + this.PV).each(function () {
691734
var $item = $(this).parent(),

app/code/Magento/Sales/Model/Order/Creditmemo.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,14 @@ public function canVoid()
439439
*/
440440
public static function getStates()
441441
{
442-
if (is_null(self::$_states)) {
443-
self::$_states = [
442+
if (is_null(static::$_states)) {
443+
static::$_states = [
444444
self::STATE_OPEN => __('Pending'),
445445
self::STATE_REFUNDED => __('Refunded'),
446446
self::STATE_CANCELED => __('Canceled'),
447447
];
448448
}
449-
return self::$_states;
449+
return static::$_states;
450450
}
451451

452452
/**
@@ -461,11 +461,11 @@ public function getStateName($stateId = null)
461461
$stateId = $this->getState();
462462
}
463463

464-
if (is_null(self::$_states)) {
465-
self::getStates();
464+
if (is_null(static::$_states)) {
465+
static::getStates();
466466
}
467-
if (isset(self::$_states[$stateId])) {
468-
return self::$_states[$stateId];
467+
if (isset(static::$_states[$stateId])) {
468+
return static::$_states[$stateId];
469469
}
470470
return __('Unknown State');
471471
}

app/code/Magento/Sales/Model/Order/Invoice.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,14 @@ public function addItem(\Magento\Sales\Model\Order\Invoice\Item $item)
543543
*/
544544
public static function getStates()
545545
{
546-
if (null === self::$_states) {
547-
self::$_states = [
546+
if (null === static::$_states) {
547+
static::$_states = [
548548
self::STATE_OPEN => __('Pending'),
549549
self::STATE_PAID => __('Paid'),
550550
self::STATE_CANCELED => __('Canceled'),
551551
];
552552
}
553-
return self::$_states;
553+
return static::$_states;
554554
}
555555

556556
/**
@@ -565,11 +565,11 @@ public function getStateName($stateId = null)
565565
$stateId = $this->getState();
566566
}
567567

568-
if (null === self::$_states) {
569-
self::getStates();
568+
if (null === static::$_states) {
569+
static::getStates();
570570
}
571-
if (isset(self::$_states[$stateId])) {
572-
return self::$_states[$stateId];
571+
if (isset(static::$_states[$stateId])) {
572+
return static::$_states[$stateId];
573573
}
574574
return __('Unknown State');
575575
}

app/code/Magento/Sales/Model/Order/Pdf/Total/DefaultTotal.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,6 @@ public function getAmount()
165165
*/
166166
public function getTitleDescription()
167167
{
168-
return $this->getSource()->getDataUsingMethod($this->getTitleSourceField());
168+
return $this->getSource()->getOrder()->getData($this->getTitleSourceField());
169169
}
170170
}

app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</settings>
5757
</filterSelect>
5858
</filters>
59-
<massaction name="listing_massaction">
59+
<massaction name="listing_massaction" component="Magento_Ui/js/grid/tree-massactions">
6060
<action name="cancel">
6161
<settings>
6262
<url path="sales/order/massCancel"/>

0 commit comments

Comments
 (0)