Skip to content

Commit 3cd9a4f

Browse files
committed
Add version 2.2.3
1 parent 1da6535 commit 3cd9a4f

File tree

1,222 files changed

+73818
-62384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,222 files changed

+73818
-62384
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
"name": "magento/project-community-edition",
33
"description": "eCommerce Platform for Growth (Community Edition)",
44
"type": "project",
5-
"version": "2.2.2",
5+
"version": "2.2.3",
66
"license": [
77
"OSL-3.0",
88
"AFL-3.0"
99
],
1010
"require": {
11-
"magento/product-community-edition": "2.2.2",
11+
"magento/product-community-edition": "2.2.3",
1212
"composer/composer": "@alpha"
1313
},
1414
"require-dev": {
1515
"phpunit/phpunit": "~6.2.0",
16-
"squizlabs/php_codesniffer": "3.1.1",
16+
"squizlabs/php_codesniffer": "3.2.2",
1717
"phpmd/phpmd": "@stable",
18-
"pdepend/pdepend": "2.5.0",
18+
"pdepend/pdepend": "2.5.2",
1919
"friendsofphp/php-cs-fixer": "~2.2.0",
2020
"lusitanian/oauth": "~0.8.10",
2121
"sebastian/phpcpd": "2.0.4"

composer.lock

Lines changed: 363 additions & 361 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/Options.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ class Options extends Section
8282
*/
8383
protected $sortRowsData = [];
8484

85+
/**
86+
* Locator for file_extension field.
87+
*
88+
* @var string
89+
*/
90+
private $hintMessage = "div[data-index='file_extension'] div[id^='notice']";
91+
8592
/**
8693
* Fill custom options form on tab.
8794
*
@@ -385,4 +392,14 @@ public function getValuesDataForOption(array $options, string $optionType, strin
385392

386393
return $formDataItem;
387394
}
395+
396+
/**
397+
* Returns notice-message elements for 'file_extension' fields.
398+
*
399+
* @return ElementInterface[]
400+
*/
401+
public function getFileOptionElements()
402+
{
403+
return $this->_rootElement->getElements($this->hintMessage);
404+
}
388405
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ function () {
650650
*/
651651
public function isVideoVisible()
652652
{
653+
$this->waitForElementNotVisible($this->galleryLoader);
653654
return $this->_rootElement->find($this->videoContainer)->isVisible();
654655
}
655656

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\Constraint;
8+
9+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
10+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11+
use Magento\Mtf\Fixture\FixtureInterface;
12+
13+
/**
14+
* Asserts what custom option values are same as expected.
15+
*/
16+
class AssertCustomOptions extends AssertProductForm
17+
{
18+
/**
19+
* Assert form data equals fixture data
20+
*
21+
* @param FixtureInterface $product
22+
* @param CatalogProductIndex $productGrid
23+
* @param CatalogProductEdit $productPage
24+
* @return void
25+
*/
26+
public function processAssert(
27+
FixtureInterface $product,
28+
CatalogProductIndex $productGrid,
29+
CatalogProductEdit $productPage
30+
) {
31+
$expectedCustomOptions = $this->arguments['expectedCustomOptions'];
32+
$filter = ['sku' => $product->getSku()];
33+
$productGrid->open();
34+
$productGrid->getProductGrid()->searchAndOpen($filter);
35+
$productData = [];
36+
if ($product->hasData('custom_options')) {
37+
$productData = $this->addExpectedOptionValues($product, $expectedCustomOptions);
38+
}
39+
$fixtureData = $this->prepareFixtureData($productData, $this->sortFields);
40+
$formData = $this->prepareFormData($productPage->getProductForm()->getData($product), $this->sortFields);
41+
$error = $this->verifyData($fixtureData, $formData);
42+
\PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
43+
}
44+
45+
/**
46+
* Adds expected value of Custom Options.
47+
*
48+
* @param FixtureInterface $product
49+
* @param array $expectedCustomOptions
50+
* @return array
51+
*/
52+
private function addExpectedOptionValues(FixtureInterface $product, array $expectedCustomOptions)
53+
{
54+
/** @var array $customOptionsSource */
55+
$customOptionsSource = $product->getDataFieldConfig('custom_options')['source']->getCustomOptions();
56+
foreach (array_keys($customOptionsSource) as $optionKey) {
57+
foreach ($expectedCustomOptions as $expectedCustomOption) {
58+
if ($customOptionsSource[$optionKey]['type'] === $expectedCustomOption['optionType']) {
59+
$options = array_keys($customOptionsSource[$optionKey]['options']);
60+
$optionField = $expectedCustomOption['optionField'];
61+
$optionValue = $expectedCustomOption['optionValue'];
62+
foreach ($options as $optionsKey) {
63+
$customOptionsSource[$optionKey]['options'][$optionsKey][$optionField] = $optionValue;
64+
}
65+
}
66+
}
67+
}
68+
69+
return ['custom_options' => $customOptionsSource];
70+
}
71+
72+
/**
73+
* Returns a string representation of the object.
74+
*
75+
* @return string
76+
*/
77+
public function toString()
78+
{
79+
return 'Custom option values are same as expected.';
80+
}
81+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Test\Constraint;
8+
9+
use Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm;
10+
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
11+
use Magento\Mtf\Constraint\AbstractAssertForm;
12+
13+
/**
14+
* Checks file_extension field hint on the product page custom options section.
15+
*/
16+
class AssertFileExtensionHints extends AbstractAssertForm
17+
{
18+
/**
19+
* Expected file_extension field hint.
20+
*
21+
* @var string
22+
*/
23+
const EXPECTED_MESSAGE = 'Enter separated extensions, like: png, jpg, gif.';
24+
25+
/**
26+
* Assert that file extension message is showed.
27+
*
28+
* @param CatalogProductEdit $productPage
29+
* @return void
30+
*/
31+
public function processAssert(CatalogProductEdit $productPage)
32+
{
33+
/** @var ProductForm $productForm */
34+
$productForm = $productPage->getProductForm();
35+
$productForm->openSection('customer-options');
36+
/** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\Options $options */
37+
$options = $productForm->getSection('customer-options');
38+
$fileOptionElements = $options->getFileOptionElements();
39+
foreach ($fileOptionElements as $fileOptionElement) {
40+
\PHPUnit_Framework_Assert::assertEquals(
41+
self::EXPECTED_MESSAGE,
42+
$fileOptionElement->getText(),
43+
'Actual message differ from expected.'
44+
);
45+
}
46+
}
47+
48+
/**
49+
* Returns a string representation of the object.
50+
*
51+
* @return string
52+
*/
53+
public function toString()
54+
{
55+
return 'Assert correct file extensions hint is showed.';
56+
}
57+
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Product/CustomOptions.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,5 +726,21 @@
726726
</item>
727727
</field>
728728
</dataset>
729+
730+
<dataset name="file_option_type">
731+
<field name="0" xsi:type="array">
732+
<item name="title" xsi:type="string">custom option file %isolation%</item>
733+
<item name="is_require" xsi:type="string">Yes</item>
734+
<item name="type" xsi:type="string">File/File</item>
735+
<item name="options" xsi:type="array">
736+
<item name="0" xsi:type="array">
737+
<item name="price" xsi:type="string">40</item>
738+
<item name="price_type" xsi:type="string">Percent</item>
739+
<item name="sku" xsi:type="string">file_option</item>
740+
<item name="file_extension" xsi:type="string">jpg, jpg gif .png</item>
741+
</item>
742+
</item>
743+
</field>
744+
</dataset>
729745
</repository>
730746
</config>

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,24 @@
219219
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
220220
<constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" />
221221
</variation>
222+
<variation name="CreateSimpleProductWithFileOption" summary="Check that Compatible File Extensions are parsed correctly" ticketId="MAGETWO-85866">
223+
<data name="description" xsi:type="string">Create product with file option</data>
224+
<data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data>
225+
<data name="product/data/name" xsi:type="string">Simple Product %isolation%</data>
226+
<data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data>
227+
<data name="product/data/price/value" xsi:type="string">1000</data>
228+
<data name="product/data/quantity_and_stock_status/qty" xsi:type="string">100</data>
229+
<data name="product/data/custom_options/dataset" xsi:type="string">file_option_type</data>
230+
<data name="expectedCustomOptions" xsi:type="array">
231+
<item name="0" xsi:type="array">
232+
<item name="optionType" xsi:type="string">File/File</item>
233+
<item name="optionField" xsi:type="string">file_extension</item>
234+
<item name="optionValue" xsi:type="string">jpg, gif, png</item>
235+
</item>
236+
</data>
237+
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
238+
<constraint name="Magento\Catalog\Test\Constraint\AssertCustomOptions" />
239+
<constraint name="Magento\Catalog\Test\Constraint\AssertFileExtensionHints" />
240+
</variation>
222241
</testCase>
223242
</config>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
8+
9+
use Magento\Framework\App\Filesystem\DirectoryList;
10+
11+
/**
12+
* Test for \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFiles class.
13+
*/
14+
class DeleteFilesTest extends \PHPUnit\Framework\TestCase
15+
{
16+
/**
17+
* @var \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFiles
18+
*/
19+
private $model;
20+
21+
/**
22+
* @var \Magento\Cms\Helper\Wysiwyg\Images
23+
*/
24+
private $imagesHelper;
25+
26+
/**
27+
* @var \Magento\Framework\Filesystem\Directory\WriteInterface
28+
*/
29+
private $mediaDirectory;
30+
31+
/**
32+
* @var string
33+
*/
34+
private $fullDirectoryPath;
35+
36+
/**
37+
* @var string
38+
*/
39+
private $fileName = 'magento_small_image.jpg';
40+
41+
/**
42+
* @inheritdoc
43+
*/
44+
protected function setUp()
45+
{
46+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
47+
$directoryName = 'directory1';
48+
$filesystem = $objectManager->get(\Magento\Framework\Filesystem::class);
49+
/** @var \Magento\Cms\Helper\Wysiwyg\Images $imagesHelper */
50+
$this->imagesHelper = $objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
51+
$this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
52+
$this->fullDirectoryPath = $this->imagesHelper->getStorageRoot() . '/' . $directoryName;
53+
$this->mediaDirectory->create($this->mediaDirectory->getRelativePath($this->fullDirectoryPath));
54+
$filePath = $this->fullDirectoryPath . DIRECTORY_SEPARATOR . $this->fileName;
55+
$fixtureDir = realpath(__DIR__ . '/../../../../../Catalog/_files');
56+
copy($fixtureDir . '/' . $this->fileName, $filePath);
57+
$this->model = $objectManager->get(\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFiles::class);
58+
}
59+
60+
/**
61+
* Execute method with correct directory path and file name to check that files under WYSIWYG media directory
62+
* can be removed.
63+
*
64+
* @return void
65+
*/
66+
public function testExecute()
67+
{
68+
$this->model->getRequest()->setMethod('POST')
69+
->setPostValue('files', [$this->imagesHelper->idEncode($this->fileName)]);
70+
$this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath);
71+
$this->model->execute();
72+
$this->assertFalse(
73+
$this->mediaDirectory->isExist(
74+
$this->mediaDirectory->getRelativePath($this->fullDirectoryPath . '/' . $this->fileName)
75+
)
76+
);
77+
}
78+
79+
/**
80+
* @inheritdoc
81+
*/
82+
public static function tearDownAfterClass()
83+
{
84+
$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
85+
->get(\Magento\Framework\Filesystem::class);
86+
/** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
87+
$directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
88+
if ($directory->isExist('wysiwyg')) {
89+
$directory->delete('wysiwyg');
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)