- = /* @escapeNotVerified */ $block->renderAmount($configuredPrice->getAmount(), [
- 'display_label' => $priceLabel,
- 'price_id' => $block->getPriceId('product-price-'),
- 'price_type' => 'finalPrice',
- 'include_container' => true,
- 'schema' => $schema
- ]); ?>
-
+getAmount()->getValue() < $configuredRegularPrice->getAmount()->getValue()) : ?>
+
+ = /* @noEscape */ $block->renderAmount(
+ $configuredPrice->getAmount(),
+ [
+ 'display_label' => $block->escapeHtml($priceLabel),
+ 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)),
+ 'price_type' => 'finalPrice',
+ 'include_container' => true,
+ 'schema' => $schema,
+ ]
+ ); ?>
+
+
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml
index 6133d55d676c..c7abb0525b30 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/gallery.phtml
@@ -25,10 +25,7 @@
getImage($_product, $image);
+ $productImage = $block->getImage($_product, $imageDisplayArea);
if ($pos != null) {
$position = ' style="left:' . $productImage->getWidth() . 'px;'
. 'top:' . $productImage->getHeight() . 'px;"';
diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json
index bb93de448c4b..5b09765d9ae5 100644
--- a/app/code/Magento/CatalogRule/composer.json
+++ b/app/code/Magento/CatalogRule/composer.json
@@ -17,7 +17,7 @@
},
"suggest": {
"magento/module-import-export": "*",
- "magento/module-catalog-rule-sample-data": "Sample Data version:100.3.*"
+ "magento/module-catalog-rule-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
index 57ca4b7b2e60..06be39d0f351 100644
--- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
+++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php
@@ -611,9 +611,6 @@ public function getActions(AbstractItem $item)
*/
public function getImage($product, $imageId, $attributes = [])
{
- return $this->imageBuilder->setProduct($product)
- ->setImageId($imageId)
- ->setAttributes($attributes)
- ->create();
+ return $this->imageBuilder->create($product, $imageId, $attributes);
}
}
diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
index 5c237eecf0a9..92ba6bf2bbbb 100644
--- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php
+++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php
@@ -100,9 +100,7 @@ public function getSerializedConfig()
*/
public function getImageHtmlTemplate()
{
- return $this->imageHelper->getFrame()
- ? 'Magento_Catalog/product/image'
- : 'Magento_Catalog/product/image_with_borders';
+ return 'Magento_Catalog/product/image_with_borders';
}
/**
diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/Item/RendererTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/Item/RendererTest.php
index d963fa2d76e6..9c9c5fd33bd0 100644
--- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/Item/RendererTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/Item/RendererTest.php
@@ -5,6 +5,8 @@
*/
namespace Magento\Checkout\Test\Unit\Block\Cart\Item;
+use Magento\Catalog\Block\Product\Image;
+use Magento\Catalog\Model\Product;
use Magento\Checkout\Block\Cart\Item\Renderer;
use Magento\Quote\Model\Quote\Item;
@@ -64,13 +66,13 @@ public function testGetProductForThumbnail()
/**
* Initialize product.
*
- * @return \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject
+ * @return Product|\PHPUnit_Framework_MockObject_MockObject
*/
protected function _initProduct()
{
- /** @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject $product */
+ /** @var Product|\PHPUnit_Framework_MockObject_MockObject $product */
$product = $this->createPartialMock(
- \Magento\Catalog\Model\Product::class,
+ Product::class,
['getName', '__wakeup', 'getIdentities']
);
$product->expects($this->any())->method('getName')->will($this->returnValue('Parent Product'));
@@ -106,7 +108,7 @@ public function testGetIdentitiesFromEmptyItem()
public function testGetProductPriceHtml()
{
$priceHtml = 'some price html';
- $product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
+ $product = $this->getMockBuilder(Product::class)
->disableOriginalConstructor()
->getMock();
@@ -193,34 +195,17 @@ public function testGetImage()
{
$imageId = 'test_image_id';
$attributes = [];
+ $product = $this->createMock(Product::class);
+ $imageMock = $this->createMock(Image::class);
- $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $imageMock = $this->getMockBuilder(\Magento\Catalog\Block\Product\Image::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->imageBuilder->expects($this->once())
- ->method('setProduct')
- ->with($productMock)
- ->willReturnSelf();
- $this->imageBuilder->expects($this->once())
- ->method('setImageId')
- ->with($imageId)
- ->willReturnSelf();
- $this->imageBuilder->expects($this->once())
- ->method('setAttributes')
- ->with($attributes)
- ->willReturnSelf();
- $this->imageBuilder->expects($this->once())
+ $this->imageBuilder->expects(self::once())
->method('create')
+ ->with($product, $imageId, $attributes)
->willReturn($imageMock);
- $this->assertInstanceOf(
- \Magento\Catalog\Block\Product\Image::class,
- $this->_renderer->getImage($productMock, $imageId, $attributes)
+ static::assertInstanceOf(
+ Image::class,
+ $this->_renderer->getImage($product, $imageId, $attributes)
);
}
}
diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php
index 88751b899d7c..1c5224d007ec 100644
--- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php
@@ -163,7 +163,6 @@ public function testGetConfig()
->willReturnMap($valueMap);
$this->storeManagerMock->expects($this->exactly(2))->method('getStore')->willReturn($storeMock);
$storeMock->expects($this->once())->method('getBaseUrl')->willReturn($baseUrl);
- $this->imageHelper->expects($this->once())->method('getFrame')->willReturn(false);
$this->scopeConfigMock->expects($this->at(0))
->method('getValue')
diff --git a/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php b/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php
index ed9ecc642e16..4a35a58a41ff 100644
--- a/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php
+++ b/app/code/Magento/CheckoutAgreements/Block/Adminhtml/Agreement/Grid.php
@@ -5,27 +5,42 @@
*/
namespace Magento\CheckoutAgreements\Block\Adminhtml\Agreement;
+use Magento\Framework\App\ObjectManager;
+use Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Grid\CollectionFactory as GridCollectionFactory;
+
class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
{
/**
* @var \Magento\CheckoutAgreements\Model\ResourceModel\Agreement\CollectionFactory
+ * @deprecated
*/
protected $_collectionFactory;
+ /**
+ * @param GridCollectionFactory
+ */
+ private $gridCollectionFactory;
+
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Backend\Helper\Data $backendHelper
* @param \Magento\CheckoutAgreements\Model\ResourceModel\Agreement\CollectionFactory $collectionFactory
* @param array $data
+ * @param GridCollectionFactory $gridColFactory
* @codeCoverageIgnore
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Backend\Helper\Data $backendHelper,
\Magento\CheckoutAgreements\Model\ResourceModel\Agreement\CollectionFactory $collectionFactory,
- array $data = []
+ array $data = [],
+ GridCollectionFactory $gridColFactory = null
) {
+
$this->_collectionFactory = $collectionFactory;
+ $this->gridCollectionFactory = $gridColFactory
+ ? : ObjectManager::getInstance()->get(GridCollectionFactory::class);
+
parent::__construct($context, $backendHelper, $data);
}
@@ -47,7 +62,7 @@ protected function _construct()
*/
protected function _prepareCollection()
{
- $this->setCollection($this->_collectionFactory->create());
+ $this->setCollection($this->gridCollectionFactory->create());
return parent::_prepareCollection();
}
diff --git a/app/code/Magento/CheckoutAgreements/Model/ResourceModel/Agreement/Grid/Collection.php b/app/code/Magento/CheckoutAgreements/Model/ResourceModel/Agreement/Grid/Collection.php
new file mode 100644
index 000000000000..70794d24a64e
--- /dev/null
+++ b/app/code/Magento/CheckoutAgreements/Model/ResourceModel/Agreement/Grid/Collection.php
@@ -0,0 +1,78 @@
+isLoaded()) {
+ return $this;
+ }
+
+ parent::load($printQuery, $logQuery);
+
+ $this->addStoresToResult();
+
+ return $this;
+ }
+
+ /**
+ * @return void
+ */
+ private function addStoresToResult()
+ {
+ $stores = $this->getStoresForAgreements();
+
+ if (!empty($stores)) {
+ $storesByAgreementId = [];
+
+ foreach ($stores as $storeData) {
+ $storesByAgreementId[$storeData['agreement_id']][] = $storeData['store_id'];
+ }
+
+ foreach ($this as $item) {
+ $agreementId = $item->getData('agreement_id');
+
+ if (!isset($storesByAgreementId[$agreementId])) {
+ continue;
+ }
+
+ $item->setData('stores', $storesByAgreementId[$agreementId]);
+ }
+ }
+ }
+
+ /**
+ * @return array
+ */
+ private function getStoresForAgreements()
+ {
+ $agreementId = $this->getColumnValues('agreement_id');
+
+ if (!empty($agreementId)) {
+ $select = $this->getConnection()->select()->from(
+ ['agreement_store' => 'checkout_agreement_store']
+ )->where(
+ 'agreement_store.agreement_id IN (?)',
+ $agreementId
+ );
+
+ return $this->getConnection()->fetchAll($select);
+ }
+
+ return [];
+ }
+}
diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json
index ab4dcefb7bb8..f051271c0505 100644
--- a/app/code/Magento/Cms/composer.json
+++ b/app/code/Magento/Cms/composer.json
@@ -18,7 +18,7 @@
"magento/module-widget": "*"
},
"suggest": {
- "magento/module-cms-sample-data": "Sample Data version:100.3.*"
+ "magento/module-cms-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/ConfigurableProduct/Helper/Data.php b/app/code/Magento/ConfigurableProduct/Helper/Data.php
index 1de82eaad319..674bd3703fa8 100644
--- a/app/code/Magento/ConfigurableProduct/Helper/Data.php
+++ b/app/code/Magento/ConfigurableProduct/Helper/Data.php
@@ -6,7 +6,11 @@
namespace Magento\ConfigurableProduct\Helper;
-use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
+use Magento\Framework\App\ObjectManager;
+use Magento\Catalog\Helper\Image as ImageHelper;
+use Magento\Catalog\Api\Data\ProductInterface;
+use Magento\Catalog\Model\Product\Image;
/**
* Class Data
@@ -17,50 +21,48 @@
class Data
{
/**
- * Catalog Image Helper
- *
- * @var \Magento\Catalog\Helper\Image
+ * @var ImageHelper
*/
protected $imageHelper;
/**
- * @param \Magento\Catalog\Helper\Image $imageHelper
+ * @var UrlBuilder
+ */
+ private $imageUrlBuilder;
+
+ /**
+ * @param ImageHelper $imageHelper
+ * @param UrlBuilder $urlBuilder
*/
- public function __construct(\Magento\Catalog\Helper\Image $imageHelper)
+ public function __construct(ImageHelper $imageHelper, UrlBuilder $urlBuilder = null)
{
$this->imageHelper = $imageHelper;
+ $this->imageUrlBuilder = $urlBuilder ?? ObjectManager::getInstance()->get(UrlBuilder::class);
}
/**
* Retrieve collection of gallery images
*
- * @param \Magento\Catalog\Api\Data\ProductInterface $product
- * @return \Magento\Catalog\Model\Product\Image[]|null
+ * @param ProductInterface $product
+ * @return Image[]|null
*/
- public function getGalleryImages(\Magento\Catalog\Api\Data\ProductInterface $product)
+ public function getGalleryImages(ProductInterface $product)
{
$images = $product->getMediaGalleryImages();
if ($images instanceof \Magento\Framework\Data\Collection) {
+ /** @var $image Image */
foreach ($images as $image) {
- /** @var $image \Magento\Catalog\Model\Product\Image */
- $image->setData(
- 'small_image_url',
- $this->imageHelper->init($product, 'product_page_image_small')
- ->setImageFile($image->getFile())
- ->getUrl()
- );
- $image->setData(
- 'medium_image_url',
- $this->imageHelper->init($product, 'product_page_image_medium_no_frame')
- ->setImageFile($image->getFile())
- ->getUrl()
- );
- $image->setData(
- 'large_image_url',
- $this->imageHelper->init($product, 'product_page_image_large_no_frame')
- ->setImageFile($image->getFile())
- ->getUrl()
- );
+ $smallImageUrl = $this->imageUrlBuilder
+ ->getUrl($image->getFile(), 'product_page_image_small');
+ $image->setData('small_image_url', $smallImageUrl);
+
+ $mediumImageUrl = $this->imageUrlBuilder
+ ->getUrl($image->getFile(), 'product_page_image_medium');
+ $image->setData('medium_image_url', $mediumImageUrl);
+
+ $largeImageUrl = $this->imageUrlBuilder
+ ->getUrl($image->getFile(), 'product_page_image_large');
+ $image->setData('large_image_url', $largeImageUrl);
}
}
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php
index 92b7cace509b..cd9fb419981a 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php
@@ -6,6 +6,9 @@
namespace Magento\ConfigurableProduct\Test\Unit\Helper;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+
class DataTest extends \PHPUnit\Framework\TestCase
{
/**
@@ -23,12 +26,27 @@ class DataTest extends \PHPUnit\Framework\TestCase
*/
protected $_productMock;
+ /**
+ * @var UrlBuilder|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $imageUrlBuilder;
+
protected function setUp()
{
+ $objectManager = new ObjectManager($this);
+ $this->imageUrlBuilder = $this->getMockBuilder(UrlBuilder::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$this->_imageHelperMock = $this->createMock(\Magento\Catalog\Helper\Image::class);
$this->_productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
- $this->_model = new \Magento\ConfigurableProduct\Helper\Data($this->_imageHelperMock);
+ $this->_model = $objectManager->getObject(
+ \Magento\ConfigurableProduct\Helper\Data::class,
+ [
+ '_imageHelper' => $this->_imageHelperMock
+ ]
+ );
+ $objectManager->setBackwardCompatibleProperty($this->_model, 'imageUrlBuilder', $this->imageUrlBuilder);
}
public function testGetAllowAttributes()
@@ -196,25 +214,38 @@ public function testGetGalleryImages()
->method('getMediaGalleryImages')
->willReturn($this->getImagesCollection());
- $this->_imageHelperMock->expects($this->exactly(3))
- ->method('init')
- ->willReturnMap([
- [$productMock, 'product_page_image_small', [], $this->_imageHelperMock],
- [$productMock, 'product_page_image_medium_no_frame', [], $this->_imageHelperMock],
- [$productMock, 'product_page_image_large_no_frame', [], $this->_imageHelperMock],
- ])
- ->willReturnSelf();
- $this->_imageHelperMock->expects($this->exactly(3))
+ $this->imageUrlBuilder->expects($this->exactly(3))
+ ->method('getUrl')
+ ->withConsecutive(
+ [
+ self::identicalTo('test_file'),
+ self::identicalTo('product_page_image_small')
+ ],
+ [
+ self::identicalTo('test_file'),
+ self::identicalTo('product_page_image_medium')
+ ],
+ [
+ self::identicalTo('test_file'),
+ self::identicalTo('product_page_image_large')
+ ]
+ )
+ ->will(self::onConsecutiveCalls(
+ 'testSmallImageUrl',
+ 'testMediumImageUrl',
+ 'testLargeImageUrl'
+ ));
+ $this->_imageHelperMock->expects(self::never())
->method('setImageFile')
->with('test_file')
->willReturnSelf();
- $this->_imageHelperMock->expects($this->at(0))
+ $this->_imageHelperMock->expects(self::never())
->method('getUrl')
->willReturn('product_page_image_small_url');
- $this->_imageHelperMock->expects($this->at(1))
+ $this->_imageHelperMock->expects(self::never())
->method('getUrl')
->willReturn('product_page_image_medium_url');
- $this->_imageHelperMock->expects($this->at(2))
+ $this->_imageHelperMock->expects(self::never())
->method('getUrl')
->willReturn('product_page_image_large_url');
diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json
index 9d292788269f..959c03698187 100644
--- a/app/code/Magento/ConfigurableProduct/composer.json
+++ b/app/code/Magento/ConfigurableProduct/composer.json
@@ -23,8 +23,8 @@
"magento/module-webapi": "*",
"magento/module-sales": "*",
"magento/module-product-video": "*",
- "magento/module-configurable-sample-data": "Sample Data version:100.3.*",
- "magento/module-product-links-sample-data": "Sample Data version:100.3.*"
+ "magento/module-configurable-sample-data": "*",
+ "magento/module-product-links-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
index b98a456a511f..ed5e46d7a60f 100644
--- a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
+++ b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php
@@ -290,8 +290,15 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule,
try {
call_user_func_array($callback, [$schedule]);
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$schedule->setStatus(Schedule::STATUS_ERROR);
+ if (!$e instanceof \Exception) {
+ $e = new \RuntimeException(
+ 'Error when running a cron job',
+ 0,
+ $e
+ );
+ }
throw $e;
}
diff --git a/app/code/Magento/Cron/Test/Unit/Model/CronJobException.php b/app/code/Magento/Cron/Test/Unit/Model/CronJobException.php
index c50afa0e6f0d..6954fe49fdc4 100644
--- a/app/code/Magento/Cron/Test/Unit/Model/CronJobException.php
+++ b/app/code/Magento/Cron/Test/Unit/Model/CronJobException.php
@@ -12,8 +12,27 @@
class CronJobException
{
+ /**
+ * @var \Throwable|null
+ */
+ private $exception;
+
+ /**
+ * @param \Throwable|null $exception
+ */
+ public function __construct(\Throwable $exception = null)
+ {
+ $this->exception = $exception;
+ }
+
+ /**
+ * @throws \Throwable
+ */
public function execute()
{
- throw new \Exception('Test exception');
+ if (!$this->exception) {
+ $this->exception = new \Exception('Test exception');
+ }
+ throw $this->exception;
}
}
diff --git a/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php b/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
index 0db6a598fb56..d8cb79af5213 100644
--- a/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
+++ b/app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php
@@ -468,6 +468,8 @@ public function testDispatchExceptionInCallback(
*/
public function dispatchExceptionInCallbackDataProvider()
{
+ $throwable = new \TypeError();
+
return [
'non-callable callback' => [
'Not_Existed_Class',
@@ -483,6 +485,19 @@ public function dispatchExceptionInCallbackDataProvider()
2,
new \Exception(__('Test exception'))
],
+ 'throwable in execution' => [
+ 'CronJobException',
+ new \Magento\Cron\Test\Unit\Model\CronJobException(
+ $throwable
+ ),
+ 'Error when running a cron job',
+ 2,
+ new \RuntimeException(
+ 'Error when running a cron job',
+ 0,
+ $throwable
+ ),
+ ],
];
}
diff --git a/app/code/Magento/Customer/Block/Account/Navigation.php b/app/code/Magento/Customer/Block/Account/Navigation.php
index cb38d762769f..64ced9d592e1 100644
--- a/app/code/Magento/Customer/Block/Account/Navigation.php
+++ b/app/code/Magento/Customer/Block/Account/Navigation.php
@@ -46,6 +46,10 @@ public function getLinks()
*/
private function compare(SortLinkInterface $firstLink, SortLinkInterface $secondLink)
{
- return ($firstLink->getSortOrder() < $secondLink->getSortOrder());
+ if ($firstLink->getSortOrder() == $secondLink->getSortOrder()) {
+ return 0;
+ }
+
+ return ($firstLink->getSortOrder() < $secondLink->getSortOrder()) ? 1 : -1;
}
}
diff --git a/app/code/Magento/Customer/Model/EmailNotification.php b/app/code/Magento/Customer/Model/EmailNotification.php
index 53c16a4b3709..3e326e087dd5 100644
--- a/app/code/Magento/Customer/Model/EmailNotification.php
+++ b/app/code/Magento/Customer/Model/EmailNotification.php
@@ -7,6 +7,8 @@
namespace Magento\Customer\Model;
use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Mail\Template\SenderResolverInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Mail\Template\TransportBuilder;
use Magento\Customer\Helper\View as CustomerViewHelper;
@@ -91,6 +93,11 @@ class EmailNotification implements EmailNotificationInterface
*/
private $scopeConfig;
+ /**
+ * @var SenderResolverInterface
+ */
+ private $senderResolver;
+
/**
* @param CustomerRegistry $customerRegistry
* @param StoreManagerInterface $storeManager
@@ -98,6 +105,7 @@ class EmailNotification implements EmailNotificationInterface
* @param CustomerViewHelper $customerViewHelper
* @param DataObjectProcessor $dataProcessor
* @param ScopeConfigInterface $scopeConfig
+ * @param SenderResolverInterface|null $senderResolver
*/
public function __construct(
CustomerRegistry $customerRegistry,
@@ -105,7 +113,8 @@ public function __construct(
TransportBuilder $transportBuilder,
CustomerViewHelper $customerViewHelper,
DataObjectProcessor $dataProcessor,
- ScopeConfigInterface $scopeConfig
+ ScopeConfigInterface $scopeConfig,
+ SenderResolverInterface $senderResolver = null
) {
$this->customerRegistry = $customerRegistry;
$this->storeManager = $storeManager;
@@ -113,6 +122,7 @@ public function __construct(
$this->customerViewHelper = $customerViewHelper;
$this->dataProcessor = $dataProcessor;
$this->scopeConfig = $scopeConfig;
+ $this->senderResolver = $senderResolver ?: ObjectManager::getInstance()->get(SenderResolverInterface::class);
}
/**
@@ -231,6 +241,7 @@ private function passwordReset(CustomerInterface $customer)
* @param int|null $storeId
* @param string $email
* @return void
+ * @throws \Magento\Framework\Exception\MailException
*/
private function sendEmailTemplate(
$customer,
@@ -244,10 +255,17 @@ private function sendEmailTemplate(
if ($email === null) {
$email = $customer->getEmail();
}
+
+ /** @var array $from */
+ $from = $this->senderResolver->resolve(
+ $this->scopeConfig->getValue($sender, 'store', $storeId),
+ $storeId
+ );
+
$transport = $this->transportBuilder->setTemplateIdentifier($templateId)
->setTemplateOptions(['area' => 'frontend', 'store' => $storeId])
->setTemplateVars($templateParams)
- ->setFrom($this->scopeConfig->getValue($sender, 'store', $storeId))
+ ->setFrom($from)
->addTo($email, $this->customerViewHelper->getCustomerName($customer))
->getTransport();
diff --git a/app/code/Magento/Customer/Test/Unit/Model/EmailNotificationTest.php b/app/code/Magento/Customer/Test/Unit/Model/EmailNotificationTest.php
index 0240b7ab29ab..61e58af78fcd 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/EmailNotificationTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/EmailNotificationTest.php
@@ -3,10 +3,13 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Customer\Test\Unit\Model;
+use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Customer\Model\EmailNotification;
use Magento\Framework\App\Area;
+use Magento\Framework\Mail\Template\SenderResolverInterface;
use Magento\Store\Model\ScopeInterface;
/**
@@ -47,7 +50,7 @@ class EmailNotificationTest extends \PHPUnit\Framework\TestCase
private $customerSecureMock;
/**
- * @var \Magento\Framework\App\Config\ScopeConfigInterface
+ * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $scopeConfigMock;
@@ -61,6 +64,11 @@ class EmailNotificationTest extends \PHPUnit\Framework\TestCase
*/
private $model;
+ /**
+ * @var SenderResolverInterface|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $senderResolverMock;
+
public function setUp()
{
$this->customerRegistryMock = $this->createMock(\Magento\Customer\Model\CustomerRegistry::class);
@@ -88,17 +96,23 @@ public function setUp()
$this->storeMock = $this->createMock(\Magento\Store\Model\Store::class);
+ $this->senderResolverMock = $this->getMockBuilder(SenderResolverInterface::class)
+ ->setMethods(['resolve'])
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->model = $objectManager->getObject(
EmailNotification::class,
[
- 'customerRegistry' => $this->customerRegistryMock,
+ 'customerRegistry' => $this->customerRegistryMock,
'storeManager' => $this->storeManagerMock,
'transportBuilder' => $this->transportBuilderMock,
'customerViewHelper' => $this->customerViewHelperMock,
'dataProcessor' => $this->dataProcessorMock,
- 'scopeConfig' => $this->scopeConfigMock
+ 'scopeConfig' => $this->scopeConfigMock,
+ 'senderResolver' => $this->senderResolverMock,
]
);
}
@@ -121,7 +135,10 @@ public function testCredentialsChanged($testNumber, $oldEmail, $newEmail, $isPas
$customerName = 'Customer Name';
$templateIdentifier = 'Template Identifier';
$sender = 'Sender';
+ $senderValues = ['name' => $sender, 'email' => $sender];
+ $expects = $this->once();
+ $xmlPathTemplate = EmailNotification::XML_PATH_RESET_PASSWORD_TEMPLATE;
switch ($testNumber) {
case 1:
$xmlPathTemplate = EmailNotification::XML_PATH_RESET_PASSWORD_TEMPLATE;
@@ -137,7 +154,14 @@ public function testCredentialsChanged($testNumber, $oldEmail, $newEmail, $isPas
break;
}
- $origCustomer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class);
+ $this->senderResolverMock
+ ->expects($expects)
+ ->method('resolve')
+ ->with($sender, $customerStoreId)
+ ->willReturn($senderValues);
+
+ /** @var \PHPUnit_Framework_MockObject_MockObject $origCustomer */
+ $origCustomer = $this->createMock(CustomerInterface::class);
$origCustomer->expects($this->any())
->method('getStoreId')
->willReturn(0);
@@ -175,7 +199,7 @@ public function testCredentialsChanged($testNumber, $oldEmail, $newEmail, $isPas
$this->dataProcessorMock->expects(clone $expects)
->method('buildOutputDataArray')
- ->with($origCustomer, \Magento\Customer\Api\Data\CustomerInterface::class)
+ ->with($origCustomer, CustomerInterface::class)
->willReturn($customerData);
$this->customerViewHelperMock->expects($this->any())
@@ -192,6 +216,7 @@ public function testCredentialsChanged($testNumber, $oldEmail, $newEmail, $isPas
->with('name', $customerName)
->willReturnSelf();
+ /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $savedCustomer */
$savedCustomer = clone $origCustomer;
$origCustomer->expects($this->any())
@@ -234,7 +259,7 @@ public function testCredentialsChanged($testNumber, $oldEmail, $newEmail, $isPas
->willReturnSelf();
$this->transportBuilderMock->expects(clone $expects)
->method('setFrom')
- ->with($sender)
+ ->with($senderValues)
->willReturnSelf();
$this->transportBuilderMock->expects(clone $expects)
@@ -293,8 +318,16 @@ public function testPasswordReminder()
$customerName = 'Customer Name';
$templateIdentifier = 'Template Identifier';
$sender = 'Sender';
+ $senderValues = ['name' => $sender, 'email' => $sender];
+
+ $this->senderResolverMock
+ ->expects($this->once())
+ ->method('resolve')
+ ->with($sender, $customerStoreId)
+ ->willReturn($senderValues);
- $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class);
+ /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */
+ $customer = $this->createMock(CustomerInterface::class);
$customer->expects($this->any())
->method('getStoreId')
->willReturn($customerStoreId);
@@ -325,7 +358,7 @@ public function testPasswordReminder()
$this->dataProcessorMock->expects($this->once())
->method('buildOutputDataArray')
- ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class)
+ ->with($customer, CustomerInterface::class)
->willReturn($customerData);
$this->customerViewHelperMock->expects($this->any())
@@ -351,34 +384,14 @@ public function testPasswordReminder()
->with(EmailNotification::XML_PATH_FORGOT_EMAIL_IDENTITY, ScopeInterface::SCOPE_STORE, $customerStoreId)
->willReturn($sender);
- $transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class);
-
- $this->transportBuilderMock->expects($this->once())
- ->method('setTemplateIdentifier')
- ->with($templateIdentifier)
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('setTemplateOptions')
- ->with(['area' => Area::AREA_FRONTEND, 'store' => $customerStoreId])
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('setTemplateVars')
- ->with(['customer' => $this->customerSecureMock, 'store' => $this->storeMock])
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('setFrom')
- ->with($sender)
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('addTo')
- ->with($customerEmail, $customerName)
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('getTransport')
- ->willReturn($transport);
-
- $transport->expects($this->once())
- ->method('sendMessage');
+ $this->mockDefaultTransportBuilder(
+ $templateIdentifier,
+ $customerStoreId,
+ $senderValues,
+ $customerEmail,
+ $customerName,
+ ['customer' => $this->customerSecureMock, 'store' => $this->storeMock]
+ );
$this->model->passwordReminder($customer);
}
@@ -395,8 +408,16 @@ public function testPasswordResetConfirmation()
$customerName = 'Customer Name';
$templateIdentifier = 'Template Identifier';
$sender = 'Sender';
+ $senderValues = ['name' => $sender, 'email' => $sender];
+
+ $this->senderResolverMock
+ ->expects($this->once())
+ ->method('resolve')
+ ->with($sender, $customerStoreId)
+ ->willReturn($senderValues);
- $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class);
+ /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */
+ $customer = $this->createMock(CustomerInterface::class);
$customer->expects($this->any())
->method('getStoreId')
->willReturn($customerStoreId);
@@ -427,7 +448,7 @@ public function testPasswordResetConfirmation()
$this->dataProcessorMock->expects($this->once())
->method('buildOutputDataArray')
- ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class)
+ ->with($customer, CustomerInterface::class)
->willReturn($customerData);
$this->customerViewHelperMock->expects($this->any())
@@ -453,34 +474,14 @@ public function testPasswordResetConfirmation()
->with(EmailNotification::XML_PATH_FORGOT_EMAIL_IDENTITY, ScopeInterface::SCOPE_STORE, $customerStoreId)
->willReturn($sender);
- $transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class);
-
- $this->transportBuilderMock->expects($this->once())
- ->method('setTemplateIdentifier')
- ->with($templateIdentifier)
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('setTemplateOptions')
- ->with(['area' => Area::AREA_FRONTEND, 'store' => $customerStoreId])
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('setTemplateVars')
- ->with(['customer' => $this->customerSecureMock, 'store' => $this->storeMock])
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('setFrom')
- ->with($sender)
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('addTo')
- ->with($customerEmail, $customerName)
- ->willReturnSelf();
- $this->transportBuilderMock->expects($this->once())
- ->method('getTransport')
- ->willReturn($transport);
-
- $transport->expects($this->once())
- ->method('sendMessage');
+ $this->mockDefaultTransportBuilder(
+ $templateIdentifier,
+ $customerStoreId,
+ $senderValues,
+ $customerEmail,
+ $customerName,
+ ['customer' => $this->customerSecureMock, 'store' => $this->storeMock]
+ );
$this->model->passwordResetConfirmation($customer);
}
@@ -497,8 +498,16 @@ public function testNewAccount()
$customerName = 'Customer Name';
$templateIdentifier = 'Template Identifier';
$sender = 'Sender';
+ $senderValues = ['name' => $sender, 'email' => $sender];
+
+ $this->senderResolverMock
+ ->expects($this->once())
+ ->method('resolve')
+ ->with($sender, $customerStoreId)
+ ->willReturn($senderValues);
- $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class);
+ /** @var CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */
+ $customer = $this->createMock(CustomerInterface::class);
$customer->expects($this->any())
->method('getStoreId')
->willReturn($customerStoreId);
@@ -525,7 +534,7 @@ public function testNewAccount()
$this->dataProcessorMock->expects($this->once())
->method('buildOutputDataArray')
- ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class)
+ ->with($customer, CustomerInterface::class)
->willReturn($customerData);
$this->customerViewHelperMock->expects($this->any())
@@ -551,6 +560,38 @@ public function testNewAccount()
->with(EmailNotification::XML_PATH_REGISTER_EMAIL_IDENTITY, ScopeInterface::SCOPE_STORE, $customerStoreId)
->willReturn($sender);
+ $this->mockDefaultTransportBuilder(
+ $templateIdentifier,
+ $customerStoreId,
+ $senderValues,
+ $customerEmail,
+ $customerName,
+ ['customer' => $this->customerSecureMock, 'back_url' => '', 'store' => $this->storeMock]
+ );
+
+ $this->model->newAccount($customer, EmailNotification::NEW_ACCOUNT_EMAIL_REGISTERED, '', $customerStoreId);
+ }
+
+ /**
+ * Create default mock for $this->transportBuilderMock.
+ *
+ * @param string $templateIdentifier
+ * @param int $customerStoreId
+ * @param array $senderValues
+ * @param string $customerEmail
+ * @param string $customerName
+ * @param array $templateVars
+ *
+ * @return void
+ */
+ private function mockDefaultTransportBuilder(
+ string $templateIdentifier,
+ int $customerStoreId,
+ array $senderValues,
+ string $customerEmail,
+ string $customerName,
+ array $templateVars = []
+ ): void {
$transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class);
$this->transportBuilderMock->expects($this->once())
@@ -563,11 +604,11 @@ public function testNewAccount()
->willReturnSelf();
$this->transportBuilderMock->expects($this->once())
->method('setTemplateVars')
- ->with(['customer' => $this->customerSecureMock, 'back_url' => '', 'store' => $this->storeMock])
+ ->with($templateVars)
->willReturnSelf();
$this->transportBuilderMock->expects($this->once())
->method('setFrom')
- ->with($sender)
+ ->with($senderValues)
->willReturnSelf();
$this->transportBuilderMock->expects($this->once())
->method('addTo')
@@ -579,7 +620,5 @@ public function testNewAccount()
$transport->expects($this->once())
->method('sendMessage');
-
- $this->model->newAccount($customer, EmailNotification::NEW_ACCOUNT_EMAIL_REGISTERED, '', $customerStoreId);
}
}
diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json
index 71b26fddbed7..b9a7aca73fe3 100644
--- a/app/code/Magento/Customer/composer.json
+++ b/app/code/Magento/Customer/composer.json
@@ -29,7 +29,7 @@
},
"suggest": {
"magento/module-cookie": "*",
- "magento/module-customer-sample-data": "Sample Data version:100.3.*"
+ "magento/module-customer-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml b/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml
index 7881b7e857fd..ac8e1298b29b 100644
--- a/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/account/dashboard/info.phtml
@@ -20,6 +20,7 @@
= $block->escapeHtml($block->getName()) ?>
= $block->escapeHtml($block->getCustomer()->getEmail()) ?>
+ = $block->getChildHtml('customer.account.dashboard.info.extra'); ?>
= $block->escapeHtml(__('Edit')) ?>
diff --git a/app/code/Magento/Customer/view/frontend/web/template/authentication-popup.html b/app/code/Magento/Customer/view/frontend/web/template/authentication-popup.html
index ad3d62f6c1c2..6b3a232cd3e3 100644
--- a/app/code/Magento/Customer/view/frontend/web/template/authentication-popup.html
+++ b/app/code/Magento/Customer/view/frontend/web/template/authentication-popup.html
@@ -54,10 +54,10 @@
id="login-form">
-
+
=>
=> options[].
+ */
+ private $optionsByWebsite = [];
+
/**
* @param \Magento\Framework\Stdlib\StringUtils $string
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@@ -254,6 +271,7 @@ class Address extends AbstractCustomer
* @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param \Magento\Customer\Model\Address\Validator\Postcode $postcodeValidator
* @param array $data
+ * @param CountryWithWebsitesSource|null $countryWithWebsites
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -276,7 +294,8 @@ public function __construct(
\Magento\Customer\Model\ResourceModel\Address\Attribute\CollectionFactory $attributesFactory,
\Magento\Framework\Stdlib\DateTime $dateTime,
\Magento\Customer\Model\Address\Validator\Postcode $postcodeValidator,
- array $data = []
+ array $data = [],
+ CountryWithWebsitesSource $countryWithWebsites = null
) {
$this->_customerFactory = $customerFactory;
$this->_addressFactory = $addressFactory;
@@ -284,6 +303,8 @@ public function __construct(
$this->_resourceHelper = $resourceHelper;
$this->dateTime = $dateTime;
$this->postcodeValidator = $postcodeValidator;
+ $this->countryWithWebsites = $countryWithWebsites ?:
+ ObjectManager::getInstance()->get(CountryWithWebsitesSource::class);
if (!isset($data['attribute_collection'])) {
/** @var $attributeCollection \Magento\Customer\Model\ResourceModel\Address\Attribute\Collection */
@@ -330,6 +351,61 @@ public function __construct(
$this->_initAddresses()->_initCountryRegions();
}
+ /**
+ * @inheritDoc
+ */
+ public function getAttributeOptions(AbstractAttribute $attribute, array $indexAttributes = [])
+ {
+ $standardOptions = parent::getAttributeOptions($attribute, $indexAttributes);
+
+ if ($attribute->getAttributeCode() === 'country_id') {
+ //If we want to get available options for country field then we have to use alternative source
+ // to get actual data for each website.
+ $options = $this->countryWithWebsites->getAllOptions();
+ //Available country options now will be sorted by websites.
+ $code = $attribute->getAttributeCode();
+ $websiteOptions = [Store::DEFAULT_STORE_ID => $standardOptions];
+ //Sorting options by website.
+ foreach ($options as $option) {
+ if (array_key_exists('website_ids', $option)) {
+ foreach ($option['website_ids'] as $websiteId) {
+ if (!array_key_exists($websiteId, $websiteOptions)) {
+ $websiteOptions[$websiteId] = [];
+ }
+ $optionId = mb_strtolower($option['value']);
+ $websiteOptions[$websiteId][$optionId] = $option['value'];
+ }
+ }
+ }
+ //Storing sorted
+ $this->optionsByWebsite[$code] = $websiteOptions;
+ }
+
+ return $standardOptions;
+ }
+
+ /**
+ * Attributes' data may vary depending on website settings,
+ * this method adjusts an attribute's data from $this->_attributes to
+ * website-specific data.
+ *
+ * @param array $attributeData Data from $this->_attributes.
+ * @param int $websiteId
+ *
+ * @return array Adjusted data in the same format.
+ */
+ private function adjustAttributeDataForWebsite(array $attributeData, int $websiteId): array
+ {
+ if ($attributeData['code'] === 'country_id') {
+ $attributeOptions = $this->optionsByWebsite[$attributeData['code']];
+ if (array_key_exists($websiteId, $attributeOptions)) {
+ $attributeData['options'] = $attributeOptions[$websiteId];
+ }
+ }
+
+ return $attributeData;
+ }
+
/**
* Customer entity getter
*
@@ -442,14 +518,9 @@ protected function _importData()
}
$this->updateItemsCounterStats($newRows, $updateRows, $deleteRowIds);
- $this->_saveAddressEntities(
- $newRows,
- $updateRows
- )->_saveAddressAttributes(
- $attributes
- )->_saveCustomerDefaults(
- $defaults
- );
+ $this->_saveAddressEntities($newRows, $updateRows)
+ ->_saveAddressAttributes($attributes)
+ ->_saveCustomerDefaults($defaults);
$this->_deleteAddressEntities($deleteRowIds);
}
@@ -514,8 +585,12 @@ protected function _prepareDataForUpdate(array $rowData)
'parent_id' => $customerId,
'updated_at' => (new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT),
];
+ $websiteId = $this->_websiteCodeToId[$rowData[self::COLUMN_WEBSITE]];
+
foreach ($this->_attributes as $attributeAlias => $attributeParams) {
if (array_key_exists($attributeAlias, $rowData)) {
+ $attributeParams = $this->adjustAttributeDataForWebsite($attributeParams, $websiteId);
+
if (!strlen($rowData[$attributeAlias])) {
if ($newAddress) {
$value = null;
@@ -734,6 +809,9 @@ protected function _validateRowForUpdate(array $rowData, $rowNumber)
} else {
// check simple attributes
foreach ($this->_attributes as $attributeCode => $attributeParams) {
+ $websiteId = $this->_websiteCodeToId[$website];
+ $attributeParams = $this->adjustAttributeDataForWebsite($attributeParams, $websiteId);
+
if (in_array($attributeCode, $this->_ignoredAttributes)) {
continue;
}
diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php
index 20625d9d7f99..db8609464859 100644
--- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php
+++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/AddressTest.php
@@ -6,6 +6,7 @@
namespace Magento\CustomerImportExport\Test\Unit\Model\Import;
+use Magento\Customer\Model\ResourceModel\Address\Attribute as AddressAttribute;
use Magento\CustomerImportExport\Model\Import\Address;
use Magento\ImportExport\Model\Import\AbstractEntity;
use Magento\Framework\DB\Select;
@@ -16,7 +17,8 @@
use Magento\CustomerImportExport\Model\ResourceModel\Import\Customer\Storage;
/**
- * Class AddressTest
+ * Tests Magento\CustomerImportExport\Model\Import\Address.
+ *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AddressTest extends \PHPUnit\Framework\TestCase
@@ -117,6 +119,11 @@ class AddressTest extends \PHPUnit\Framework\TestCase
*/
protected $errorAggregator;
+ /**
+ * @var AddressAttribute\Source\CountryWithWebsites|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $countryWithWebsites;
+
/**
* Init entity adapter model
*/
@@ -131,6 +138,14 @@ protected function setUp()
$this->_storeManager->expects($this->any())
->method('getWebsites')
->will($this->returnCallback([$this, 'getWebsites']));
+ $this->countryWithWebsites = $this
+ ->getMockBuilder(AddressAttribute\Source\CountryWithWebsites::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->countryWithWebsites
+ ->expects($this->any())
+ ->method('getAllOptions')
+ ->willReturn([]);
$this->_model = $this->_getModelMock();
$this->errorAggregator = $this->createPartialMock(
\Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregator::class,
@@ -465,7 +480,8 @@ protected function _getModelMock()
$this->createMock(\Magento\Customer\Model\ResourceModel\Address\Attribute\CollectionFactory::class),
new \Magento\Framework\Stdlib\DateTime(),
$this->createMock(\Magento\Customer\Model\Address\Validator\Postcode::class),
- $this->_getModelDependencies()
+ $this->_getModelDependencies(),
+ $this->countryWithWebsites
);
$property = new \ReflectionProperty($modelMock, '_availableBehaviors');
diff --git a/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php b/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php
index 9d13c97790fa..4eb965b21d53 100644
--- a/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php
+++ b/app/code/Magento/Deploy/Console/Command/App/ApplicationDumpCommand.php
@@ -12,6 +12,7 @@
use Magento\Framework\Config\File\ConfigFilePool;
use Magento\Framework\Console\Cli;
use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -20,6 +21,8 @@
*/
class ApplicationDumpCommand extends Command
{
+ const INPUT_CONFIG_TYPES = 'config-types';
+
/**
* @var Writer
*/
@@ -47,10 +50,10 @@ public function __construct(
array $sources,
Hash $configHash = null
) {
- parent::__construct();
$this->writer = $writer;
$this->sources = $sources;
$this->configHash = $configHash ?: ObjectManager::getInstance()->get(Hash::class);
+ parent::__construct();
}
/**
@@ -60,6 +63,13 @@ protected function configure()
{
$this->setName('app:config:dump');
$this->setDescription('Create dump of application');
+
+ $configTypes = array_unique(array_column($this->sources, 'namespace'));
+ $this->addArgument(
+ self::INPUT_CONFIG_TYPES,
+ InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
+ sprintf('Space-separated list of config types or omit to dump all [%s]', implode(', ', $configTypes))
+ );
parent::configure();
}
@@ -74,11 +84,14 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->groupSourcesByPool();
-
+ $dumpedTypes = [];
foreach ($this->sources as $pool => $sources) {
$dump = [];
$comments = [];
foreach ($sources as $sourceData) {
+ if ($this->skipDump($input, $sourceData)) {
+ continue;
+ }
/** @var ConfigSourceInterface $source */
$source = $sourceData['source'];
$namespace = $sourceData['namespace'];
@@ -95,15 +108,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
null,
$comments
);
+ $dumpedTypes = array_unique($dumpedTypes + array_keys($dump));
if (!empty($comments)) {
$output->writeln($comments);
}
}
+ if (!$dumpedTypes) {
+ $output->writeln('Nothing dumped. Check the config types specified and try again');
+ return Cli::RETURN_FAILURE;
+ }
+
// Generate and save new hash of deployment configuration.
$this->configHash->regenerate();
- $output->writeln('Done.');
+ $output->writeln(sprintf('Done. Config types dumped: %s', implode(', ', $dumpedTypes)));
return Cli::RETURN_SUCCESS;
}
@@ -127,4 +146,20 @@ private function groupSourcesByPool()
$this->sources = $sources;
}
+
+ /**
+ * Check whether the dump source should be skipped
+ *
+ * @param InputInterface $input
+ * @param array $sourceData
+ * @return bool
+ */
+ private function skipDump(InputInterface $input, array $sourceData): bool
+ {
+ $allowedTypes = $input->getArgument(self::INPUT_CONFIG_TYPES);
+ if ($allowedTypes && !in_array($sourceData['namespace'], $allowedTypes)) {
+ return true;
+ }
+ return false;
+ }
}
diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php
index 67c3796e7c6b..85cae275932f 100644
--- a/app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php
+++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/ApplicationDumpCommandTest.php
@@ -130,7 +130,7 @@ public function testExport()
->method('writeln')
->withConsecutive(
[['system' => 'Some comment message']],
- ['Done.']
+ ['Done. Config types dumped: system']
);
$method = new \ReflectionMethod(ApplicationDumpCommand::class, 'execute');
diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php
index 0b5b836b4ac9..f39c33408f90 100644
--- a/app/code/Magento/Directory/Model/Currency.php
+++ b/app/code/Magento/Directory/Model/Currency.php
@@ -225,7 +225,7 @@ public function convert($price, $toCurrency = null)
if ($toCurrency === null) {
return $price;
} elseif ($rate = $this->getRate($toCurrency)) {
- return $price * $rate;
+ return floatval($price) * floatval($rate);
}
throw new \Exception(__(
diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json
index 5fd61fc849f7..88658b8644ca 100644
--- a/app/code/Magento/Downloadable/composer.json
+++ b/app/code/Magento/Downloadable/composer.json
@@ -25,7 +25,7 @@
"magento/module-ui": "*"
},
"suggest": {
- "magento/module-downloadable-sample-data": "Sample Data version:100.3.*"
+ "magento/module-downloadable-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/GiftMessage/Block/Message/Inline.php b/app/code/Magento/GiftMessage/Block/Message/Inline.php
index a4a2b39feccd..fa0c8ef85e13 100644
--- a/app/code/Magento/GiftMessage/Block/Message/Inline.php
+++ b/app/code/Magento/GiftMessage/Block/Message/Inline.php
@@ -371,9 +371,6 @@ protected function _toHtml()
*/
public function getImage($product, $imageId, $attributes = [])
{
- return $this->imageBuilder->setProduct($product)
- ->setImageId($imageId)
- ->setAttributes($attributes)
- ->create();
+ return $this->imageBuilder->create($product, $imageId, $attributes);
}
}
diff --git a/app/code/Magento/GiftMessage/Test/Unit/Block/Message/InlineTest.php b/app/code/Magento/GiftMessage/Test/Unit/Block/Message/InlineTest.php
deleted file mode 100644
index e3167fc60f99..000000000000
--- a/app/code/Magento/GiftMessage/Test/Unit/Block/Message/InlineTest.php
+++ /dev/null
@@ -1,105 +0,0 @@
-context = $this->getMockBuilder(\Magento\Framework\View\Element\Template\Context::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->session = $this->getMockBuilder(\Magento\Customer\Model\Session::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->messageHelper = $this->getMockBuilder(\Magento\GiftMessage\Helper\Message::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->imageBuilder = $this->getMockBuilder(\Magento\Catalog\Block\Product\ImageBuilder::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->httpContext = $this->getMockBuilder(\Magento\Framework\App\Http\Context::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->block = new \Magento\GiftMessage\Block\Message\Inline(
- $this->context,
- $this->session,
- $this->messageHelper,
- $this->imageBuilder,
- $this->httpContext
- );
- }
-
- public function testGetImage()
- {
- $imageId = 'test_image_id';
- $attributes = [];
-
- $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $imageMock = $this->getMockBuilder(\Magento\Catalog\Block\Product\Image::class)
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->imageBuilder->expects($this->once())
- ->method('setProduct')
- ->with($productMock)
- ->willReturnSelf();
- $this->imageBuilder->expects($this->once())
- ->method('setImageId')
- ->with($imageId)
- ->willReturnSelf();
- $this->imageBuilder->expects($this->once())
- ->method('setAttributes')
- ->with($attributes)
- ->willReturnSelf();
- $this->imageBuilder->expects($this->once())
- ->method('create')
- ->willReturn($imageMock);
-
- $this->assertInstanceOf(
- \Magento\Catalog\Block\Product\Image::class,
- $this->block->getImage($productMock, $imageId, $attributes)
- );
- }
-}
diff --git a/app/code/Magento/GiftMessage/etc/db_schema.xml b/app/code/Magento/GiftMessage/etc/db_schema.xml
index ecd73bd8708f..518c6398e4c8 100644
--- a/app/code/Magento/GiftMessage/etc/db_schema.xml
+++ b/app/code/Magento/GiftMessage/etc/db_schema.xml
@@ -19,19 +19,19 @@
-
+
-
+
-
+
-
+
diff --git a/app/code/Magento/GroupedProduct/Pricing/Price/ConfiguredRegularPrice.php b/app/code/Magento/GroupedProduct/Pricing/Price/ConfiguredRegularPrice.php
new file mode 100644
index 000000000000..8b29e82d93a4
--- /dev/null
+++ b/app/code/Magento/GroupedProduct/Pricing/Price/ConfiguredRegularPrice.php
@@ -0,0 +1,91 @@
+item = $item;
+
+ return $this;
+ }
+
+ /**
+ * Calculate configured price.
+ *
+ * @return float
+ */
+ protected function calculatePrice(): float
+ {
+ $value = 0.;
+ /** @var \Magento\GroupedProduct\Model\Product\Type\Grouped $typeInstance */
+ $typeInstance = $this->getProduct()->getTypeInstance();
+ $associatedProducts = $typeInstance
+ ->setStoreFilter($this->getProduct()->getStore(), $this->getProduct())
+ ->getAssociatedProducts($this->getProduct());
+
+ foreach ($associatedProducts as $product) {
+ /** @var Product $product */
+ /** @var \Magento\Wishlist\Model\Item\Option $customOption */
+ $customOption = $this->getProduct()
+ ->getCustomOption('associated_product_' . $product->getId());
+ if (!$customOption) {
+ continue;
+ }
+ $finalPrice = $product->getPriceInfo()
+ ->getPrice(\Magento\Catalog\Pricing\Price\RegularPrice::PRICE_CODE)
+ ->getValue();
+ $value += $finalPrice * ($customOption->getValue() ?: 1);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Price value of product with configured options.
+ *
+ * @return bool|float
+ */
+ public function getValue()
+ {
+ if ($this->item) {
+ return $this->calculatePrice();
+ } else {
+ if ($this->value === null) {
+ $price = $this->product->getPrice();
+ $priceInCurrentCurrency = $this->priceCurrency->convertAndRound($price);
+ $this->value = $priceInCurrentCurrency ? floatval($priceInCurrentCurrency) : false;
+ }
+
+ return $this->value;
+ }
+ }
+}
diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json
index eb99ebbc35f5..19509ae3ce08 100644
--- a/app/code/Magento/GroupedProduct/composer.json
+++ b/app/code/Magento/GroupedProduct/composer.json
@@ -21,7 +21,7 @@
"magento/module-ui": "*"
},
"suggest": {
- "magento/module-grouped-product-sample-data": "Sample Data version:100.3.*"
+ "magento/module-grouped-product-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/GroupedProduct/etc/di.xml b/app/code/Magento/GroupedProduct/etc/di.xml
index f39bcfa01453..8f688e3d06b0 100644
--- a/app/code/Magento/GroupedProduct/etc/di.xml
+++ b/app/code/Magento/GroupedProduct/etc/di.xml
@@ -48,6 +48,7 @@
- Magento\GroupedProduct\Pricing\Price\FinalPrice
- Magento\GroupedProduct\Pricing\Price\ConfiguredPrice
+ - Magento\GroupedProduct\Pricing\Price\ConfiguredRegularPrice
Magento\Catalog\Pricing\Price\Pool
diff --git a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddInStockFilterToCollectionTest.php b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddInStockFilterToCollectionTest.php
index a803ccf4ac13..60dbc478e28e 100644
--- a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddInStockFilterToCollectionTest.php
+++ b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddInStockFilterToCollectionTest.php
@@ -58,6 +58,8 @@ protected function setUp()
* @return void
*
* @dataProvider addInStockFilterToCollectionDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testAddInStockFilterToCollection(string $store, int $expectedSize)
{
diff --git a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddStockStatusToProductsTest.php b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddStockStatusToProductsTest.php
index 04e5d200562c..b35ae9cf0d84 100644
--- a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddStockStatusToProductsTest.php
+++ b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AddStockStatusToProductsTest.php
@@ -55,6 +55,8 @@ protected function setUp()
* @dataProvider addStockStatusToProductsDataProvider
* @param string $storeCode
* @param array $productsData
+ *
+ * @magentoDbIsolation disabled
*/
public function testAddStockStatusToProducts(string $storeCode, array $productsData)
{
diff --git a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AssignStatusToProductTest.php b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AssignStatusToProductTest.php
index f35a487e0229..751c8f035ee2 100644
--- a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AssignStatusToProductTest.php
+++ b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Helper/Stock/AssignStatusToProductTest.php
@@ -61,6 +61,8 @@ protected function setUp()
* @dataProvider assignStatusToProductDataProvider
* @param string $storeCode
* @param array $productsData
+ *
+ * @magentoDbIsolation disabled
*/
public function testAssignStatusToProductIfStatusParameterIsNotPassed(string $storeCode, array $productsData)
{
@@ -87,6 +89,8 @@ public function testAssignStatusToProductIfStatusParameterIsNotPassed(string $st
* @dataProvider assignStatusToProductDataProvider
* @param string $storeCode
* @param array $productsData
+ *
+ * @magentoDbIsolation disabled
*/
public function testAssignStatusToProductIfStatusParameterIsPassed(string $storeCode, array $productsData)
{
diff --git a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddIsInStockFilterToCollectionTest.php b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddIsInStockFilterToCollectionTest.php
index 5f0cb3353355..29801f6c2257 100644
--- a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddIsInStockFilterToCollectionTest.php
+++ b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddIsInStockFilterToCollectionTest.php
@@ -61,6 +61,8 @@ protected function setUp()
* @return void
*
* @dataProvider addIsInStockFilterToCollectionDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testAddIsInStockFilterToCollection(string $store, int $expectedSize)
{
diff --git a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockDataToCollectionTest.php b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockDataToCollectionTest.php
index ccb6f0875bce..d00899073278 100644
--- a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockDataToCollectionTest.php
+++ b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockDataToCollectionTest.php
@@ -62,6 +62,8 @@ protected function setUp()
* @return void
*
* @dataProvider addStockDataToCollectionDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testAddStockDataToCollection(string $store, int $expectedSize, bool $isFilterInStock)
{
diff --git a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockStatusToSelectTest.php b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockStatusToSelectTest.php
index 7c78a2339e63..dbf8b5f0b2e2 100644
--- a/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockStatusToSelectTest.php
+++ b/app/code/Magento/InventoryCatalog/Test/Integration/CatalogInventory/Model/ResourceModel/Stock/Status/AddStockStatusToSelectTest.php
@@ -55,6 +55,8 @@ protected function setUp()
* @param int $expectedNotSalableCount
*
* @dataProvider addStockStatusToSelectDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testAddStockStatusToSelect(
string $websiteCode,
diff --git a/app/code/Magento/InventoryCatalog/Test/Integration/Model/ResourceModel/GetAssignedStockIdsBySkuTest.php b/app/code/Magento/InventoryCatalog/Test/Integration/Model/ResourceModel/GetAssignedStockIdsBySkuTest.php
index e2bcba93453a..71e269c75a14 100644
--- a/app/code/Magento/InventoryCatalog/Test/Integration/Model/ResourceModel/GetAssignedStockIdsBySkuTest.php
+++ b/app/code/Magento/InventoryCatalog/Test/Integration/Model/ResourceModel/GetAssignedStockIdsBySkuTest.php
@@ -31,6 +31,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecute()
{
diff --git a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectTest.php b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectTest.php
index 71fa8d44bba2..a0876151a1c6 100644
--- a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectTest.php
+++ b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectTest.php
@@ -64,6 +64,8 @@ protected function setUp()
*
* @return void
* @dataProvider executeDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecute(string $store, int $expectedSize)
{
diff --git a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectWithDefaultStockTest.php b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectWithDefaultStockTest.php
index 48ebba5ad074..e802c521f6ef 100644
--- a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectWithDefaultStockTest.php
+++ b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Adapter/Mysql/Aggregation/DataProvider/ApplyStockConditionToSelectWithDefaultStockTest.php
@@ -39,6 +39,8 @@ protected function setUp()
/**
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/products.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryCatalog/Test/_files/source_items_on_default_source.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecute()
{
diff --git a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Indexer/FulltextTest.php b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Indexer/FulltextTest.php
index e4dcbf8dcaa4..b35915b10f40 100644
--- a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Indexer/FulltextTest.php
+++ b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Indexer/FulltextTest.php
@@ -28,6 +28,8 @@
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
+ *
+ * @magentoDbIsolation disabled
*/
class FulltextTest extends TestCase
{
diff --git a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectOnDefaultStockTest.php b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectOnDefaultStockTest.php
index ae89621e5948..9f372eca56a2 100644
--- a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectOnDefaultStockTest.php
+++ b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectOnDefaultStockTest.php
@@ -33,6 +33,8 @@ protected function setUp()
/**
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/products.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryCatalog/Test/_files/source_items_on_default_source.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecute()
{
diff --git a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectTest.php b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectTest.php
index efb4be2eea4b..bd3c0b71efab 100644
--- a/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectTest.php
+++ b/app/code/Magento/InventoryCatalogSearch/Test/Integration/Model/Search/FilterMapper/TermDropdownStrategy/ApplyStockConditionToSelectTest.php
@@ -64,6 +64,8 @@ protected function setUp()
* @return void
*
* @dataProvider executeDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecute($store, $expectedSize)
{
diff --git a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Options/OptionsAvailabilityTest.php b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Options/OptionsAvailabilityTest.php
index ab7a7134b2f2..b992dd70b2bc 100644
--- a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Options/OptionsAvailabilityTest.php
+++ b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Options/OptionsAvailabilityTest.php
@@ -68,6 +68,8 @@ protected function setUp()
* @param string $storeCode
* @param int $expected
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
public function testGetSalableOptions(string $storeCode, int $expected)
{
diff --git a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/FinalPriceResolverTest.php b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/FinalPriceResolverTest.php
index e9ea4cb55831..e5fcd4fb31c5 100644
--- a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/FinalPriceResolverTest.php
+++ b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/FinalPriceResolverTest.php
@@ -66,6 +66,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePriceWithAllChildren()
@@ -91,6 +93,8 @@ public function testResolvePriceWithAllChildren()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePriceIfOneOfChildIsOutOfStock()
diff --git a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/LowestPriceOptionProviderTest.php b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/LowestPriceOptionProviderTest.php
index bf8e6a22c137..533017523dfb 100644
--- a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/LowestPriceOptionProviderTest.php
+++ b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/LowestPriceOptionProviderTest.php
@@ -67,6 +67,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testGetProductsWithAllChildren()
@@ -93,6 +95,8 @@ public function testGetProductsWithAllChildren()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testGetProductsIfOneOfChildIsOutOfStock()
diff --git a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/RegularPriceResolverTest.php b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/RegularPriceResolverTest.php
index b088c7da4699..6ec52f26006a 100644
--- a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/RegularPriceResolverTest.php
+++ b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/RegularPriceResolverTest.php
@@ -66,6 +66,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePriceWithAllChildren()
@@ -91,6 +93,8 @@ public function testResolvePriceWithAllChildren()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePriceIfOneOfChildIsOutOfStock()
diff --git a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/SpecialPriceTest.php b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/SpecialPriceTest.php
index f925910dfe67..163ff9ad4747 100644
--- a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/SpecialPriceTest.php
+++ b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/SpecialPriceTest.php
@@ -67,6 +67,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePrice()
@@ -99,6 +101,8 @@ public function testResolvePrice()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePriceIfChildWithSpecialPriceOutOfStock()
diff --git a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/TierPriceTest.php b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/TierPriceTest.php
index 2afcb44815c4..3a3900282682 100644
--- a/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/TierPriceTest.php
+++ b/app/code/Magento/InventoryConfigurableProduct/Test/Integration/Price/TierPriceTest.php
@@ -81,6 +81,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePrice()
@@ -126,6 +128,8 @@ public function testResolvePrice()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testResolvePriceIfChildWithTierPriceIsOutOfStock()
diff --git a/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/SourceItemIndexerTest.php b/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/SourceItemIndexerTest.php
index 704aedf4e4f3..31f2baa849fd 100644
--- a/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/SourceItemIndexerTest.php
+++ b/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/SourceItemIndexerTest.php
@@ -69,6 +69,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testOneSimpleChangesToOutOfStockInOneSource()
@@ -102,6 +104,8 @@ public function testOneSimpleChangesToOutOfStockInOneSource()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testAllSimplesChangesToOutOfStockInOneSource()
@@ -137,6 +141,8 @@ public function testAllSimplesChangesToOutOfStockInOneSource()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testAllSimplesChangesToOutOfStockInAllSources()
@@ -183,6 +189,8 @@ public function testAllSimplesChangesToOutOfStockInAllSources()
* @magentoDataFixture ../../../../app/code/Magento/InventoryConfigurableProductIndexer/Test/_files/set_simples_out_of_stock.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testOneSimpleChangesToInStock()
@@ -215,6 +223,8 @@ public function testOneSimpleChangesToInStock()
* @magentoDataFixture ../../../../app/code/Magento/InventoryConfigurableProductIndexer/Test/_files/set_simples_out_of_stock.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @return void
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testAllSimplesChangesToInStock()
diff --git a/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/StockIndexerTest.php b/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/StockIndexerTest.php
index fdfeafa2fe59..19b4f694927c 100644
--- a/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/StockIndexerTest.php
+++ b/app/code/Magento/InventoryConfigurableProductIndexer/Test/Integration/StockIndexerTest.php
@@ -98,6 +98,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryConfigurableProductIndexer/Test/_files/source_items_configurable_multiple.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testReindexList()
@@ -126,6 +128,8 @@ public function testReindexList()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryConfigurableProductIndexer/Test/_files/source_items_configurable_multiple.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testReindexListSetAllSimplesOutOfStock()
@@ -167,6 +171,8 @@ public function testReindexListSetAllSimplesOutOfStock()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryConfigurableProductIndexer/Test/_files/source_items_configurable_multiple.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
+ *
+ * @magentoDbIsolation disabled
*/
// @codingStandardsIgnoreEnd
public function testReindexListSetAllEuSimplesOutOfStock()
diff --git a/app/code/Magento/InventoryImportExport/Test/Integration/Model/Import/SourcesTest.php b/app/code/Magento/InventoryImportExport/Test/Integration/Model/Import/SourcesTest.php
index 635dbebc72a5..0ea3a840618b 100755
--- a/app/code/Magento/InventoryImportExport/Test/Integration/Model/Import/SourcesTest.php
+++ b/app/code/Magento/InventoryImportExport/Test/Integration/Model/Import/SourcesTest.php
@@ -96,6 +96,8 @@ public function testImportDataWithWrongBehavior()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testImportDataWithAppendBehavior()
{
@@ -126,6 +128,8 @@ public function testImportDataWithAppendBehavior()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testImportDataWithDelteBehavior()
{
@@ -153,6 +157,8 @@ public function testImportDataWithDelteBehavior()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testImportDataWithReplaceBehavior()
{
@@ -180,6 +186,8 @@ public function testImportDataWithReplaceBehavior()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testImportDataWithReplaceBehaviorNoAffectOtherSources()
{
diff --git a/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceIndexerTest.php b/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceIndexerTest.php
index 58c8ca64f787..3ecf54e5fd34 100644
--- a/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceIndexerTest.php
+++ b/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceIndexerTest.php
@@ -62,6 +62,8 @@ protected function tearDown()
* @param array|null $expectedData
*
* @dataProvider reindexRowDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexRow(string $sku, int $stockId, $expectedData)
{
@@ -101,6 +103,8 @@ public function reindexRowDataProvider(): array
* @param array|null $expectedData
*
* @dataProvider reindexListDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexList(string $sku, int $stockId, $expectedData)
{
@@ -124,6 +128,8 @@ public function testReindexList(string $sku, int $stockId, $expectedData)
* @param array|null $expectedData
*
* @dataProvider reindexListDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexAll(string $sku, int $stockId, $expectedData)
{
diff --git a/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceItemIndexerTest.php b/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceItemIndexerTest.php
index d85ae9550764..b7d08d574006 100644
--- a/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceItemIndexerTest.php
+++ b/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/SourceItemIndexerTest.php
@@ -83,6 +83,8 @@ protected function tearDown()
* @param array|null $expectedData
*
* @dataProvider reindexRowDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexRow(string $sku, int $stockId, $expectedData)
{
@@ -126,6 +128,8 @@ public function reindexRowDataProvider(): array
* @param array|null $expectedData
*
* @dataProvider reindexListDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexList(string $sku, int $stockId, $expectedData)
{
@@ -173,6 +177,8 @@ public function reindexListDataProvider(): array
* @param array|null $expectedData
*
* @dataProvider reindexAllDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexAll(string $sku, int $stockId, $expectedData)
{
diff --git a/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/StockIndexerTest.php b/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/StockIndexerTest.php
index 5f90baef29a1..514cbc31e437 100644
--- a/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/StockIndexerTest.php
+++ b/app/code/Magento/InventoryIndexer/Test/Integration/Indexer/StockIndexerTest.php
@@ -59,6 +59,8 @@ protected function tearDown()
* @param array|null $expectedData
*
* @dataProvider reindexRowDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexRow(string $sku, int $stockId, $expectedData)
{
@@ -92,6 +94,8 @@ public function reindexRowDataProvider(): array
* @param array|null $expectedData
*
* @dataProvider reindexListDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexList(string $sku, int $stockId, $expectedData)
{
@@ -128,6 +132,8 @@ public function reindexListDataProvider(): array
* @param array|null $expectedData
*
* @dataProvider reindexAllDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexAll(string $sku, int $stockId, $expectedData)
{
diff --git a/app/code/Magento/InventoryIndexer/Test/Integration/InvalidateAfterEnablingOrDisablingSourceTest.php b/app/code/Magento/InventoryIndexer/Test/Integration/InvalidateAfterEnablingOrDisablingSourceTest.php
index 8b70f398a3a4..dfdc6adde063 100644
--- a/app/code/Magento/InventoryIndexer/Test/Integration/InvalidateAfterEnablingOrDisablingSourceTest.php
+++ b/app/code/Magento/InventoryIndexer/Test/Integration/InvalidateAfterEnablingOrDisablingSourceTest.php
@@ -51,6 +51,8 @@ protected function setUp()
* @param string $sourceCode
* @param bool $enable
* @param bool $expectedValid
+ *
+ * @magentoDbIsolation disabled
*/
public function testIndexerInvalidation(string $sourceCode, bool $enable, bool $expectedValid)
{
@@ -128,6 +130,8 @@ public function testIndexerInvalidationIfSourceDoesNotHaveStockLinks(
* @param string $sourceCode
* @param bool $enable
* @param bool $expectedValid
+ *
+ * @magentoDbIsolation disabled
*/
public function testIndexerInvalidationIfSourceDoesNotHaveSourceItems(
string $sourceCode,
diff --git a/app/code/Magento/InventoryProductAlert/Test/Integration/ProductAlertTest.php b/app/code/Magento/InventoryProductAlert/Test/Integration/ProductAlertTest.php
index e21c26542375..f32177572cbe 100644
--- a/app/code/Magento/InventoryProductAlert/Test/Integration/ProductAlertTest.php
+++ b/app/code/Magento/InventoryProductAlert/Test/Integration/ProductAlertTest.php
@@ -74,6 +74,8 @@ public function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventoryProductAlert/Test/_files/product_alert_eu_website_customer.php
* @magentoConfigFixture default_store catalog/productalert/allow_stock 1
* @magentoConfigFixture store_for_eu_website_store catalog/productalert/allow_stock 1
+ *
+ * @magentoDbIsolation disabled
*/
public function testAlertsBothSourceItemsOutOfStock()
{
@@ -103,6 +105,8 @@ public function testAlertsBothSourceItemsOutOfStock()
* @magentoDataFixture ../../../../app/code/Magento/InventoryProductAlert/Test/_files/product_alert_eu_website_customer.php
* @magentoConfigFixture default_store catalog/productalert/allow_stock 1
* @magentoConfigFixture store_for_eu_website_store catalog/productalert/allow_stock 1
+ *
+ * @magentoDbIsolation disabled
*/
public function testAlertsOneSourceItemInStock()
{
@@ -143,6 +147,8 @@ public function testAlertsOneSourceItemInStock()
* @magentoDataFixture ../../../../app/code/Magento/InventoryProductAlert/Test/_files/product_alert_eu_website_customer.php
* @magentoConfigFixture default_store catalog/productalert/allow_stock 1
* @magentoConfigFixture store_for_eu_website_store catalog/productalert/allow_stock 1
+ *
+ * @magentoDbIsolation disabled
*/
public function testAlertsBothSourceItemsInStock()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/GetStockItemDataTest.php b/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/GetStockItemDataTest.php
index 622e9b3280eb..ffeeab8cde20 100644
--- a/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/GetStockItemDataTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/GetStockItemDataTest.php
@@ -41,6 +41,8 @@ protected function setUp()
* @param array|null $expectedData
*
* @dataProvider getStockItemDataDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testGetStockItemData(string $sku, int $stockId, $expectedData)
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/ManageConfigConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/ManageConfigConditionTest.php
index ef9e312d9608..1cf0f613c70b 100644
--- a/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/ManageConfigConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/ManageConfigConditionTest.php
@@ -43,6 +43,8 @@ protected function setUp()
* @return void
*
* @dataProvider executeWithManageStockFalseDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithManageStockFalse(string $sku, int $stockId, $expectedData)
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/MinQtyConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/MinQtyConditionTest.php
index acfbff9a4ec5..c29defe50ab0 100644
--- a/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/MinQtyConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/GetStockItemData/MinQtyConditionTest.php
@@ -43,6 +43,8 @@ protected function setUp()
* @return void
*
* @dataProvider executeWithMinQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithMinQty(string $sku, int $stockId, $expectedData)
{
@@ -85,6 +87,8 @@ public function executeWithMinQtyDataProvider(): array
* @return void
*
* @dataProvider executeWithManageStockFalseAndMinQty
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithManageStockFalseAndMinQty(string $sku, int $stockId, $expectedData)
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/BackorderConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/BackorderConditionTest.php
index 0d7ff7732b48..057b62b6bfcb 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/BackorderConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/BackorderConditionTest.php
@@ -75,6 +75,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testBackorderedZeroQtyProductIsSalable()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/IsSalableWithReservationsConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/IsSalableWithReservationsConditionTest.php
index 177f8dd8a88e..0035ea659618 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/IsSalableWithReservationsConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/IsSalableWithReservationsConditionTest.php
@@ -106,6 +106,8 @@ protected function setUp()
* @param bool $isSalable
*
* @dataProvider productIsSalableDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testProductIsSalable(string $sku, int $stockId, bool $isSalable)
{
@@ -137,6 +139,8 @@ public function productIsSalableDataProvider(): array
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testProductIsOutOfStockIfReservationsArePresent()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/ManageStockConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/ManageStockConditionTest.php
index 8c9a904818d6..a6dcb6ec2bf6 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/ManageStockConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/ManageStockConditionTest.php
@@ -43,6 +43,8 @@ protected function setUp()
* @return void
*
* @dataProvider executeWithManageStockFalseDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithManageStockFalse(string $sku, int $stockId, bool $expectedResult)
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/MinQtyConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/MinQtyConditionTest.php
index b94ec4af368f..a44b06911b5d 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/MinQtyConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalable/MinQtyConditionTest.php
@@ -43,6 +43,8 @@ protected function setUp()
* @return void
*
* @dataProvider executeWithMinQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithMinQty(string $sku, int $stockId, bool $expectedResult)
{
@@ -84,6 +86,8 @@ public function executeWithMinQtyDataProvider(): array
* @return void
*
* @dataProvider executeWithManageStockFalseAndMinQty
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithManageStockFalseAndMinQty(string $sku, int $stockId, bool $expectedResult)
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/BackorderConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/BackorderConditionTest.php
index 36f72ac38be8..5c009079f090 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/BackorderConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/BackorderConditionTest.php
@@ -76,6 +76,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stocks.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testBackorderedZeroQtyProductIsSalable()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php
index 37ff9fd33414..915a2259fe86 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsCorrectQtyConditionTest.php
@@ -79,6 +79,8 @@ protected function setUp()
* @return void
*
* @dataProvider executeWithMissingConfigurationDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithMissingConfiguration(
string $sku,
@@ -117,6 +119,8 @@ public function executeWithMissingConfigurationDataProvider(): array
* @return void
*
* @dataProvider executeWithUseConfigMinSaleQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithUseConfigMinSaleQty(
string $sku,
@@ -172,6 +176,8 @@ public function executeWithUseConfigMinSaleQtyDataProvider(): array
*
* @return void
* @dataProvider executeWithMinSaleQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithMinSaleQty(
string $sku,
@@ -229,6 +235,8 @@ public function executeWithMinSaleQtyDataProvider(): array
* @return void
*
* @dataProvider executeWithUseConfigMaxSaleQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithUseConfigMaxSaleQty(
string $sku,
@@ -287,6 +295,8 @@ public function executeWithUseConfigMaxSaleQtyDataProvider(): array
* @return void
*
* @dataProvider executeWithMaxSaleQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithMaxSaleQty(
string $sku,
@@ -347,6 +357,8 @@ public function executeWithMaxSaleQtyDataProvider(): array
* @return void
*
* @dataProvider executeWithUseConfigQtyIncrementsDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithUseConfigQtyIncrements(
string $sku,
@@ -407,6 +419,8 @@ public function executeWithUseConfigQtyIncrementsDataProvider(): array
* @return void
*
* @dataProvider executeWithQtyIncrementsDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithQtyIncrements(
string $sku,
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsSalableWithReservationsConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsSalableWithReservationsConditionTest.php
index ce8b8d6420df..9d2397efbeeb 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsSalableWithReservationsConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/IsSalableWithReservationsConditionTest.php
@@ -82,6 +82,8 @@ protected function setUp()
* @param bool $isSalable
*
* @dataProvider productIsSalableDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testProductIsSalable(string $sku, int $stockId, float $qty, bool $isSalable)
{
@@ -124,6 +126,8 @@ public function productIsSalableDataProvider(): array
* @param bool $isSalable
*
* @dataProvider productIsSalableWithUseConfigMinQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testProductIsSalableWithUseConfigMinQty(string $sku, int $stockId, float $qty, bool $isSalable)
{
@@ -168,6 +172,8 @@ public function productIsSalableWithUseConfigMinQtyDataProvider(): array
* @param bool $isSalable
*
* @dataProvider productIsSalableWithMinQtyDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testProductIsSalableWithMinQty(string $sku, int $stockId, float $qty, bool $isSalable)
{
@@ -207,6 +213,8 @@ public function productIsSalableWithMinQtyDataProvider(): array
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testProductIsOutOfStockIfReservationsArePresent()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/ManageStockConditionTest.php b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/ManageStockConditionTest.php
index 4f7617337630..bb366064e28c 100644
--- a/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/ManageStockConditionTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/IsProductSalableForRequestedQty/ManageStockConditionTest.php
@@ -44,6 +44,8 @@ protected function setUp()
* @return void
*
* @dataProvider executeWithManageStockFalseDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testExecuteWithManageStockFalse(string $sku, int $stockId, float $qty, bool $expectedResult)
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/Order/PlaceOrderOnNotDefaultStockTest.php b/app/code/Magento/InventorySales/Test/Integration/Order/PlaceOrderOnNotDefaultStockTest.php
index 58c146aedcda..ede117b55965 100644
--- a/app/code/Magento/InventorySales/Test/Integration/Order/PlaceOrderOnNotDefaultStockTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/Order/PlaceOrderOnNotDefaultStockTest.php
@@ -121,6 +121,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/quote.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testPlaceOrderWithInStockProduct()
{
@@ -150,6 +152,8 @@ public function testPlaceOrderWithInStockProduct()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/quote.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testPlaceOrderWithOutOffStockProduct()
{
@@ -180,6 +184,8 @@ public function testPlaceOrderWithOutOffStockProduct()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/quote.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @magentoConfigFixture store_for_global_website_store cataloginventory/item_options/backorders 1
+ *
+ * @magentoDbIsolation disabled
*/
public function testPlaceOrderWithOutOffStockProductAndBackOrdersTurnedOn()
{
@@ -212,6 +218,8 @@ public function testPlaceOrderWithOutOffStockProductAndBackOrdersTurnedOn()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/quote.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @magentoConfigFixture current_store cataloginventory/item_options/manage_stock 0
+ *
+ * @magentoDbIsolation disabled
*/
public function testPlaceOrderWithOutOffStockProductAndManageStockTurnedOff()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/SalesQuoteItem/AddSalesQuoteItemOnNotDefaultStockTest.php b/app/code/Magento/InventorySales/Test/Integration/SalesQuoteItem/AddSalesQuoteItemOnNotDefaultStockTest.php
index 6689f3a4d3e4..c0f24dfe433b 100644
--- a/app/code/Magento/InventorySales/Test/Integration/SalesQuoteItem/AddSalesQuoteItemOnNotDefaultStockTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/SalesQuoteItem/AddSalesQuoteItemOnNotDefaultStockTest.php
@@ -92,6 +92,8 @@ protected function setUp()
* @throws ValidationException
*
* @dataProvider productsInStockDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testAddInStockProductToQuote(
string $sku,
@@ -143,6 +145,8 @@ public function productsInStockDataProvider(): array
* @throws ValidationException
*
* @dataProvider notSalableProductsDataProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testAddOutOffStockProductToQuote(
string $sku,
diff --git a/app/code/Magento/InventorySales/Test/Integration/Stock/GetProductSalableQtyTest.php b/app/code/Magento/InventorySales/Test/Integration/Stock/GetProductSalableQtyTest.php
index 21446889cc3c..0d9731fd74a3 100644
--- a/app/code/Magento/InventorySales/Test/Integration/Stock/GetProductSalableQtyTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/Stock/GetProductSalableQtyTest.php
@@ -67,6 +67,8 @@ protected function tearDown()
* @param float $qty
*
* @dataProvider getProductQuantityProvider
+ *
+ * @magentoDbIsolation disabled
*/
public function testGetProductQuantity(string $sku, int $stockId, float $qty)
{
@@ -98,6 +100,8 @@ public function getProductQuantityProvider(): array
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/stock_source_links.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryApi/Test/_files/source_items.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testGetProductQuantityIfReservationsArePresent()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringBackItemQtyTest.php b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringBackItemQtyTest.php
index 7d45380ac030..faf08182943c 100644
--- a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringBackItemQtyTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringBackItemQtyTest.php
@@ -89,6 +89,8 @@ protected function tearDown()
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/websites_with_stores.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testRevertProductsSale()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRegisterProductsSaleTest.php b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRegisterProductsSaleTest.php
index 0b7aaa10e4b4..ce18433bde11 100644
--- a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRegisterProductsSaleTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRegisterProductsSaleTest.php
@@ -153,6 +153,8 @@ protected function tearDown()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/websites_with_stores.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/quote.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testRegisterProductsSale()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRevertProductsSaleTest.php b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRevertProductsSaleTest.php
index 1e0f0bf4624f..7e07691612bb 100644
--- a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRevertProductsSaleTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingDuringRevertProductsSaleTest.php
@@ -89,6 +89,8 @@ protected function tearDown()
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/websites_with_stores.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testRevertProductsSale()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnCanSubtractQtySetToZeroTest.php b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnCanSubtractQtySetToZeroTest.php
index c694879080e1..360d35b39c43 100644
--- a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnCanSubtractQtySetToZeroTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnCanSubtractQtySetToZeroTest.php
@@ -56,6 +56,8 @@ protected function tearDown()
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/websites_with_stores.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
* @magentoConfigFixture default_store cataloginventory/options/can_subtract 0
+ *
+ * @magentoDbIsolation disabled
*/
public function testPlacingReservationOnCanSubtractQtySetToZero()
{
diff --git a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnUseConfigManageStockSetToZeroTest.php b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnUseConfigManageStockSetToZeroTest.php
index 73a83d7c05b1..699a29a562b7 100644
--- a/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnUseConfigManageStockSetToZeroTest.php
+++ b/app/code/Magento/InventorySales/Test/Integration/StockManagement/ReservationPlacingOnUseConfigManageStockSetToZeroTest.php
@@ -33,6 +33,8 @@ protected function tearDown()
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/websites_with_stores.php
* @magentoDataFixture ../../../../app/code/Magento/InventorySalesApi/Test/_files/stock_website_sales_channels.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testPlacingReservationOnUseConfigManageStockSetToZero()
{
diff --git a/app/code/Magento/InventoryShipping/Test/Integration/SourceDeductionForVirtualProductsOnMultiStockTest.php b/app/code/Magento/InventoryShipping/Test/Integration/SourceDeductionForVirtualProductsOnMultiStockTest.php
index 3a6358942373..bc23e7cf3228 100644
--- a/app/code/Magento/InventoryShipping/Test/Integration/SourceDeductionForVirtualProductsOnMultiStockTest.php
+++ b/app/code/Magento/InventoryShipping/Test/Integration/SourceDeductionForVirtualProductsOnMultiStockTest.php
@@ -95,6 +95,8 @@ protected function setUp()
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryShipping/Test/_files/create_quote_on_eu_website.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryShipping/Test/_files/order_virtual_products.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testSourceDeductionWhileInvoicingWholeOrderedQty()
{
@@ -139,6 +141,8 @@ public function testSourceDeductionWhileInvoicingWholeOrderedQty()
* @magentoDataFixture ../../../../app/code/Magento/InventoryIndexer/Test/_files/reindex_inventory.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryShipping/Test/_files/create_quote_on_eu_website.php
* @magentoDataFixture ../../../../app/code/Magento/InventoryShipping/Test/_files/order_virtual_products.php
+ *
+ * @magentoDbIsolation disabled
*/
public function testSourceDeductionWhileInvoicingPartialOrderedQty()
{
diff --git a/app/code/Magento/MediaStorage/App/Media.php b/app/code/Magento/MediaStorage/App/Media.php
index bff4b0d19451..e1644ebaf5a4 100644
--- a/app/code/Magento/MediaStorage/App/Media.php
+++ b/app/code/Magento/MediaStorage/App/Media.php
@@ -7,6 +7,8 @@
*/
namespace Magento\MediaStorage\App;
+use Magento\Catalog\Model\View\Asset\PlaceholderFactory;
+use Magento\Framework\App\State;
use Magento\Framework\Filesystem;
use Magento\MediaStorage\Model\File\Storage\ConfigFactory;
use Magento\MediaStorage\Model\File\Storage\Response;
@@ -14,6 +16,9 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\AppInterface;
use Magento\MediaStorage\Model\File\Storage\SynchronizationFactory;
+use Magento\Framework\App\Area;
+use Magento\MediaStorage\Model\File\Storage\Config;
+use Magento\MediaStorage\Service\ImageResize;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -68,6 +73,21 @@ class Media implements AppInterface
*/
private $syncFactory;
+ /**
+ * @var PlaceholderFactory
+ */
+ private $placeholderFactory;
+
+ /**
+ * @var State
+ */
+ private $appState;
+
+ /**
+ * @var ImageResize
+ */
+ private $imageResize;
+
/**
* @param ConfigFactory $configFactory
* @param SynchronizationFactory $syncFactory
@@ -77,6 +97,10 @@ class Media implements AppInterface
* @param string $configCacheFile
* @param string $relativeFileName
* @param Filesystem $filesystem
+ * @param PlaceholderFactory $placeholderFactory
+ * @param State $state
+ * @param ImageResize $imageResize
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
ConfigFactory $configFactory,
@@ -86,11 +110,14 @@ public function __construct(
$mediaDirectory,
$configCacheFile,
$relativeFileName,
- Filesystem $filesystem
+ Filesystem $filesystem,
+ PlaceholderFactory $placeholderFactory,
+ State $state,
+ ImageResize $imageResize
) {
$this->response = $response;
$this->isAllowed = $isAllowed;
- $this->directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ $this->directory = $filesystem->getDirectoryWrite(DirectoryList::PUB);
$mediaDirectory = trim($mediaDirectory);
if (!empty($mediaDirectory)) {
$this->mediaDirectoryPath = str_replace('\\', '/', realpath($mediaDirectory));
@@ -99,6 +126,9 @@ public function __construct(
$this->relativeFileName = $relativeFileName;
$this->configFactory = $configFactory;
$this->syncFactory = $syncFactory;
+ $this->placeholderFactory = $placeholderFactory;
+ $this->appState = $state;
+ $this->imageResize = $imageResize;
}
/**
@@ -109,9 +139,11 @@ public function __construct(
*/
public function launch()
{
+ $this->appState->setAreaCode(Area::AREA_GLOBAL);
+
if ($this->mediaDirectoryPath !== $this->directory->getAbsolutePath()) {
// Path to media directory changed or absent - update the config
- /** @var \Magento\MediaStorage\Model\File\Storage\Config $config */
+ /** @var Config $config */
$config = $this->configFactory->create(['cacheFile' => $this->configCacheFile]);
$config->save();
$this->mediaDirectoryPath = $config->getMediaDirectory();
@@ -122,18 +154,40 @@ public function launch()
}
}
- /** @var \Magento\MediaStorage\Model\File\Storage\Synchronization $sync */
- $sync = $this->syncFactory->create(['directory' => $this->directory]);
- $sync->synchronize($this->relativeFileName);
-
- if ($this->directory->isReadable($this->relativeFileName)) {
- $this->response->setFilePath($this->directory->getAbsolutePath($this->relativeFileName));
- } else {
- $this->response->setHttpResponseCode(404);
+ try {
+ /** @var \Magento\MediaStorage\Model\File\Storage\Synchronization $sync */
+ $sync = $this->syncFactory->create(['directory' => $this->directory]);
+ $sync->synchronize($this->relativeFileName);
+ $this->imageResize->resizeFromImageName($this->getOriginalImage($this->relativeFileName));
+ if ($this->directory->isReadable($this->relativeFileName)) {
+ $this->response->setFilePath($this->directory->getAbsolutePath($this->relativeFileName));
+ } else {
+ $this->setPlaceholderImage();
+ }
+ } catch (\Exception $e) {
+ $this->setPlaceholderImage();
}
+
return $this->response;
}
+ private function setPlaceholderImage()
+ {
+ $placeholder = $this->placeholderFactory->create(['type' => 'image']);
+ $this->response->setFilePath($placeholder->getPath());
+ }
+
+ /**
+ * Find the path to the original image of the cache path
+ *
+ * @param string $resizedImagePath
+ * @return string
+ */
+ private function getOriginalImage(string $resizedImagePath): string
+ {
+ return preg_replace('|^.*((?:/[^/]+){3})$|', '$1', $resizedImagePath);
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php
new file mode 100644
index 000000000000..a4b78287df01
--- /dev/null
+++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php
@@ -0,0 +1,95 @@
+resize = $resize;
+ $this->appState = $appState;
+ $this->objectManager = $objectManager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this->setName('catalog:images:resize')
+ ->setDescription('Creates resized product images');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ try {
+ $this->appState->setAreaCode(Area::AREA_GLOBAL);
+ $generator = $this->resize->resizeFromThemes();
+
+ /** @var ProgressBar $progress */
+ $progress = $this->objectManager->create(ProgressBar::class, [
+ 'output' => $output,
+ 'max' => $generator->current()
+ ]);
+ $progress->setFormat(
+ "%current%/%max% [%bar%] %percent:3s%% %elapsed% %memory:6s% \t| %message%"
+ );
+
+ if ($output->getVerbosity() !== OutputInterface::VERBOSITY_NORMAL) {
+ $progress->setOverwrite(false);
+ }
+
+ for (; $generator->valid(); $generator->next()) {
+ $progress->setMessage($generator->key());
+ $progress->advance();
+ }
+ } catch (\Exception $e) {
+ $output->writeln("{$e->getMessage()}");
+ // we must have an exit code higher than zero to indicate something was wrong
+ return \Magento\Framework\Console\Cli::RETURN_FAILURE;
+ }
+
+ $output->write(PHP_EOL);
+ $output->writeln("Product images resized successfully");
+ }
+}
diff --git a/app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php b/app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php
index d744afb0fad9..09f269e0ebdd 100644
--- a/app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php
+++ b/app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php
@@ -7,7 +7,9 @@
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Filesystem\Directory\WriteInterface as DirectoryWrite;
-use Magento\Framework\Filesystem\File\Write;
+use Magento\Framework\Filesystem\File\WriteInterface;
+use Magento\MediaStorage\Service\ImageResize;
+use Magento\MediaStorage\Model\File\Storage\Database;
/**
* Class Synchronization
@@ -17,7 +19,7 @@ class Synchronization
/**
* Database storage factory
*
- * @var \Magento\MediaStorage\Model\File\Storage\DatabaseFactory
+ * @var DatabaseFactory
*/
protected $storageFactory;
@@ -29,11 +31,11 @@ class Synchronization
protected $mediaDirectory;
/**
- * @param \Magento\MediaStorage\Model\File\Storage\DatabaseFactory $storageFactory
+ * @param DatabaseFactory $storageFactory
* @param DirectoryWrite $directory
*/
public function __construct(
- \Magento\MediaStorage\Model\File\Storage\DatabaseFactory $storageFactory,
+ DatabaseFactory $storageFactory,
DirectoryWrite $directory
) {
$this->storageFactory = $storageFactory;
@@ -49,14 +51,14 @@ public function __construct(
*/
public function synchronize($relativeFileName)
{
- /** @var $storage \Magento\MediaStorage\Model\File\Storage\Database */
+ /** @var $storage Database */
$storage = $this->storageFactory->create();
try {
$storage->loadByFilename($relativeFileName);
} catch (\Exception $e) {
}
if ($storage->getId()) {
- /** @var \Magento\Framework\Filesystem\File\WriteInterface $file */
+ /** @var WriteInterface $file */
$file = $this->mediaDirectory->openFile($relativeFileName, 'w');
try {
$file->lock();
diff --git a/app/code/Magento/MediaStorage/Service/ImageResize.php b/app/code/Magento/MediaStorage/Service/ImageResize.php
new file mode 100644
index 000000000000..37dd6f485f1a
--- /dev/null
+++ b/app/code/Magento/MediaStorage/Service/ImageResize.php
@@ -0,0 +1,265 @@
+appState = $appState;
+ $this->imageConfig = $imageConfig;
+ $this->productImage = $productImage;
+ $this->imageFactory = $imageFactory;
+ $this->paramsBuilder = $paramsBuilder;
+ $this->viewConfig = $viewConfig;
+ $this->assertImageFactory = $assertImageFactory;
+ $this->themeCustomizationConfig = $themeCustomizationConfig;
+ $this->themeCollection = $themeCollection;
+ $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
+ $this->filesystem = $filesystem;
+ }
+
+ /**
+ * Create resized images of different sizes from an original image
+ * @param string $originalImageName
+ * @throws NotFoundException
+ */
+ public function resizeFromImageName(string $originalImageName)
+ {
+ $originalImagePath = $this->mediaDirectory->getAbsolutePath(
+ $this->imageConfig->getMediaPath($originalImageName)
+ );
+ if (!$this->mediaDirectory->isFile($originalImagePath)) {
+ throw new NotFoundException(__('Cannot resize image "%1" - original image not found', $originalImagePath));
+ }
+ foreach ($this->getViewImages($this->getThemesInUse()) as $viewImage) {
+ $this->resize($viewImage, $originalImagePath, $originalImageName);
+ }
+ }
+
+ /**
+ * Create resized images of different sizes from themes
+ * @param array|null $themes
+ * @return \Generator
+ * @throws NotFoundException
+ */
+ public function resizeFromThemes(array $themes = null): \Generator
+ {
+ $count = $this->productImage->getCountAllProductImages();
+ if (!$count) {
+ throw new NotFoundException(__('Cannot resize images - product images not found'));
+ }
+
+ $productImages = $this->productImage->getAllProductImages();
+ $viewImages = $this->getViewImages($themes ?? $this->getThemesInUse());
+
+ foreach ($productImages as $image) {
+ $originalImageName = $image['filepath'];
+ $originalImagePath = $this->mediaDirectory->getAbsolutePath(
+ $this->imageConfig->getMediaPath($originalImageName)
+ );
+ foreach ($viewImages as $viewImage) {
+ $this->resize($viewImage, $originalImagePath, $originalImageName);
+ }
+ yield $originalImageName => $count;
+ }
+ }
+
+ /**
+ * Search the current theme
+ * @return array
+ */
+ private function getThemesInUse(): array
+ {
+ $themesInUse = [];
+ $registeredThemes = $this->themeCollection->loadRegisteredThemes();
+ $storesByThemes = $this->themeCustomizationConfig->getStoresByThemes();
+ $keyType = is_integer(key($storesByThemes)) ? 'getId' : 'getCode';
+ foreach ($registeredThemes as $registeredTheme) {
+ if (array_key_exists($registeredTheme->$keyType(), $storesByThemes)) {
+ $themesInUse[] = $registeredTheme;
+ }
+ }
+ return $themesInUse;
+ }
+
+ /**
+ * Get view images data from themes
+ * @param array $themes
+ * @return array
+ */
+ private function getViewImages(array $themes): array
+ {
+ $viewImages = [];
+ /** @var \Magento\Theme\Model\Theme $theme */
+ foreach ($themes as $theme) {
+ $config = $this->viewConfig->getViewConfig([
+ 'area' => Area::AREA_FRONTEND,
+ 'themeModel' => $theme,
+ ]);
+ $images = $config->getMediaEntities('Magento_Catalog', ImageHelper::MEDIA_TYPE_CONFIG_NODE);
+ foreach ($images as $imageId => $imageData) {
+ $uniqIndex = $this->getUniqImageIndex($imageData);
+ $imageData['id'] = $imageId;
+ $viewImages[$uniqIndex] = $imageData;
+ }
+ }
+ return $viewImages;
+ }
+
+ /**
+ * Get uniq image index
+ * @param array $imageData
+ * @return string
+ */
+ private function getUniqImageIndex(array $imageData): string
+ {
+ ksort($imageData);
+ unset($imageData['type']);
+ return md5(json_encode($imageData));
+ }
+
+ /**
+ * Make image
+ * @param string $originalImagePath
+ * @param array $imageParams
+ * @return Image
+ */
+ private function makeImage(string $originalImagePath, array $imageParams): Image
+ {
+ $image = $this->imageFactory->create($originalImagePath);
+ $image->keepAspectRatio($imageParams['keep_aspect_ratio']);
+ $image->keepFrame($imageParams['keep_frame']);
+ $image->keepTransparency($imageParams['keep_transparency']);
+ $image->constrainOnly($imageParams['constrain_only']);
+ $image->backgroundColor($imageParams['background']);
+ $image->quality($imageParams['quality']);
+ return $image;
+ }
+
+ /**
+ * Resize image
+ * @param array $viewImage
+ * @param string $originalImagePath
+ * @param string $originalImageName
+ */
+ private function resize(array $viewImage, string $originalImagePath, string $originalImageName)
+ {
+ $imageParams = $this->paramsBuilder->build($viewImage);
+ $image = $this->makeImage($originalImagePath, $imageParams);
+ $imageAsset = $this->assertImageFactory->create(
+ [
+ 'miscParams' => $imageParams,
+ 'filePath' => $originalImageName,
+ ]
+ );
+
+ if ($imageParams['image_width'] !== null && $imageParams['image_height'] !== null) {
+ $image->resize($imageParams['image_width'], $imageParams['image_height']);
+ }
+ $image->save($imageAsset->getPath());
+ }
+}
diff --git a/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php b/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php
index 46becd82343e..a94bb8ec5e48 100644
--- a/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php
+++ b/app/code/Magento/MediaStorage/Test/Unit/App/MediaTest.php
@@ -5,7 +5,10 @@
*/
namespace Magento\MediaStorage\Test\Unit\App;
+use Magento\Catalog\Model\View\Asset\Placeholder;
+use Magento\Catalog\Model\View\Asset\PlaceholderFactory;
use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
/**
* Class MediaTest
@@ -91,20 +94,30 @@ protected function setUp()
$this->filesystemMock->expects($this->any())
->method('getDirectoryWrite')
- ->with(DirectoryList::MEDIA)
+ ->with(DirectoryList::PUB)
->will($this->returnValue($this->directoryMock));
$this->responseMock = $this->createMock(\Magento\MediaStorage\Model\File\Storage\Response::class);
- $this->model = new \Magento\MediaStorage\App\Media(
- $this->configFactoryMock,
- $this->syncFactoryMock,
- $this->responseMock,
- $this->closure,
- self::MEDIA_DIRECTORY,
- self::CACHE_FILE_PATH,
- self::RELATIVE_FILE_PATH,
- $this->filesystemMock
+ $objectManager = new ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ \Magento\MediaStorage\App\Media::class,
+ [
+ 'configFactory' => $this->configFactoryMock,
+ 'syncFactory' => $this->syncFactoryMock,
+ 'response' => $this->responseMock,
+ 'isAllowed' => $this->closure,
+ 'mediaDirectory' => false,
+ 'configCacheFile' => self::CACHE_FILE_PATH,
+ 'relativeFileName' => self::RELATIVE_FILE_PATH,
+ 'filesystem' => $this->filesystemMock,
+ 'placeholderFactory' => $this->createConfiguredMock(
+ PlaceholderFactory::class,
+ [
+ 'create' => $this->createMock(Placeholder::class)
+ ]
+ ),
+ ]
);
}
@@ -115,15 +128,19 @@ protected function tearDown()
public function testProcessRequestCreatesConfigFileMediaDirectoryIsNotProvided()
{
- $this->model = new \Magento\MediaStorage\App\Media(
- $this->configFactoryMock,
- $this->syncFactoryMock,
- $this->responseMock,
- $this->closure,
- false,
- self::CACHE_FILE_PATH,
- self::RELATIVE_FILE_PATH,
- $this->filesystemMock
+ $objectManager = new ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ \Magento\MediaStorage\App\Media::class,
+ [
+ 'configFactory' => $this->configFactoryMock,
+ 'syncFactory' => $this->syncFactoryMock,
+ 'response' => $this->responseMock,
+ 'isAllowed' => $this->closure,
+ 'mediaDirectory' => false,
+ 'configCacheFile' => self::CACHE_FILE_PATH,
+ 'relativeFileName' => self::RELATIVE_FILE_PATH,
+ 'filesystem' => $this->filesystemMock
+ ]
);
$filePath = '/absolute/path/to/test/file.png';
$this->directoryMock->expects($this->any())
@@ -144,33 +161,6 @@ public function testProcessRequestCreatesConfigFileMediaDirectoryIsNotProvided()
$this->model->launch();
}
- /**
- * @expectedException \LogicException
- * @expectedExceptionMessage The specified path is not allowed.
- */
- public function testProcessRequestReturnsNotFoundResponseIfResourceIsNotAllowed()
- {
- $this->closure = function () {
- return false;
- };
- $this->model = new \Magento\MediaStorage\App\Media(
- $this->configFactoryMock,
- $this->syncFactoryMock,
- $this->responseMock,
- $this->closure,
- false,
- self::CACHE_FILE_PATH,
- self::RELATIVE_FILE_PATH,
- $this->filesystemMock
- );
- $this->directoryMock->expects($this->once())
- ->method('getAbsolutePath')
- ->with()
- ->will($this->returnValue(self::MEDIA_DIRECTORY));
- $this->configMock->expects($this->once())->method('getAllowedResources')->will($this->returnValue(false));
- $this->model->launch();
- }
-
public function testProcessRequestReturnsFileIfItsProperlySynchronized()
{
$filePath = '/absolute/path/to/test/file.png';
@@ -202,7 +192,6 @@ public function testProcessRequestReturnsNotFoundIfFileIsNotSynchronized()
->method('isReadable')
->with(self::RELATIVE_FILE_PATH)
->will($this->returnValue(false));
- $this->responseMock->expects($this->once())->method('setHttpResponseCode')->with(404);
$this->assertSame($this->responseMock, $this->model->launch());
}
diff --git a/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/SynchronizationTest.php b/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/SynchronizationTest.php
index f58a11540dc8..f3ebf5754695 100644
--- a/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/SynchronizationTest.php
+++ b/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/SynchronizationTest.php
@@ -5,6 +5,8 @@
*/
namespace Magento\MediaStorage\Test\Unit\Model\File\Storage;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+
class SynchronizationTest extends \PHPUnit\Framework\TestCase
{
public function testSynchronize()
@@ -40,7 +42,11 @@ public function testSynchronize()
->with($relativeFileName)
->will($this->returnValue($file));
- $model = new \Magento\MediaStorage\Model\File\Storage\Synchronization($storageFactoryMock, $directory);
+ $objectManager = new ObjectManager($this);
+ $model = $objectManager->getObject(\Magento\MediaStorage\Model\File\Storage\Synchronization::class, [
+ 'storageFactory' => $storageFactoryMock,
+ 'directory' => $directory,
+ ]);
$model->synchronize($relativeFileName);
}
}
diff --git a/app/code/Magento/MediaStorage/composer.json b/app/code/Magento/MediaStorage/composer.json
index fbec1b663950..7d27c88b3dcb 100644
--- a/app/code/Magento/MediaStorage/composer.json
+++ b/app/code/Magento/MediaStorage/composer.json
@@ -9,7 +9,9 @@
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-config": "*",
- "magento/module-store": "*"
+ "magento/module-store": "*",
+ "magento/module-catalog": "*",
+ "magento/module-theme": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/MediaStorage/etc/di.xml b/app/code/Magento/MediaStorage/etc/di.xml
index 8f491f5b8464..2b9317787463 100644
--- a/app/code/Magento/MediaStorage/etc/di.xml
+++ b/app/code/Magento/MediaStorage/etc/di.xml
@@ -19,4 +19,11 @@
+
+
+
+ - Magento\MediaStorage\Console\Command\ImagesResizeCommand
+
+
+
diff --git a/app/code/Magento/MediaStorage/etc/module.xml b/app/code/Magento/MediaStorage/etc/module.xml
index 6a04d4641e66..df4acf8904fb 100644
--- a/app/code/Magento/MediaStorage/etc/module.xml
+++ b/app/code/Magento/MediaStorage/etc/module.xml
@@ -6,5 +6,10 @@
*/
-->
-
+
+
+
+
+
+
diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json
index 8fd920a48e67..6e7bf61063a2 100644
--- a/app/code/Magento/Msrp/composer.json
+++ b/app/code/Magento/Msrp/composer.json
@@ -16,7 +16,7 @@
},
"suggest": {
"magento/module-bundle": "*",
- "magento/module-msrp-sample-data": "Sample Data version:100.3.*"
+ "magento/module-msrp-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php b/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php
index a258223e0677..1bd55cf5f172 100644
--- a/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php
+++ b/app/code/Magento/OfflineShipping/Block/Adminhtml/Form/Field/Export.php
@@ -21,7 +21,7 @@ class Export extends \Magento\Framework\Data\Form\Element\AbstractElement
* @param \Magento\Framework\Data\Form\Element\Factory $factoryElement
* @param \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection
* @param \Magento\Framework\Escaper $escaper
- * @param \Magento\Backend\Helper\Data $helper
+ * @param \Magento\Backend\Model\UrlInterface $backendUrl
* @param array $data
*/
public function __construct(
diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json
index 9abb462ed196..a3e1dad5de85 100644
--- a/app/code/Magento/OfflineShipping/composer.json
+++ b/app/code/Magento/OfflineShipping/composer.json
@@ -19,7 +19,7 @@
},
"suggest": {
"magento/module-checkout": "*",
- "magento/module-offline-shipping-sample-data": "Sample Data version:100.3.*"
+ "magento/module-offline-shipping-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/OfflineShipping/etc/db_schema.xml b/app/code/Magento/OfflineShipping/etc/db_schema.xml
index 1a4ecd89582c..80f4b56a1723 100644
--- a/app/code/Magento/OfflineShipping/etc/db_schema.xml
+++ b/app/code/Magento/OfflineShipping/etc/db_schema.xml
@@ -45,15 +45,15 @@
-
+
-
+
-
+
diff --git a/app/code/Magento/Payment/Gateway/Command/GatewayCommand.php b/app/code/Magento/Payment/Gateway/Command/GatewayCommand.php
index a6f9d4383918..2ba3034072a5 100644
--- a/app/code/Magento/Payment/Gateway/Command/GatewayCommand.php
+++ b/app/code/Magento/Payment/Gateway/Command/GatewayCommand.php
@@ -5,14 +5,15 @@
*/
namespace Magento\Payment\Gateway\Command;
-use Magento\Framework\Phrase;
use Magento\Payment\Gateway\CommandInterface;
+use Magento\Payment\Gateway\ErrorMapper\ErrorMessageMapperInterface;
+use Magento\Payment\Gateway\Http\ClientException;
use Magento\Payment\Gateway\Http\ClientInterface;
+use Magento\Payment\Gateway\Http\ConverterException;
use Magento\Payment\Gateway\Http\TransferFactoryInterface;
-use Magento\Payment\Gateway\Request;
use Magento\Payment\Gateway\Request\BuilderInterface;
-use Magento\Payment\Gateway\Response;
use Magento\Payment\Gateway\Response\HandlerInterface;
+use Magento\Payment\Gateway\Validator\ResultInterface;
use Magento\Payment\Gateway\Validator\ValidatorInterface;
use Psr\Log\LoggerInterface;
@@ -54,6 +55,11 @@ class GatewayCommand implements CommandInterface
*/
private $logger;
+ /**
+ * @var ErrorMessageMapperInterface
+ */
+ private $errorMessageMapper;
+
/**
* @param BuilderInterface $requestBuilder
* @param TransferFactoryInterface $transferFactory
@@ -61,6 +67,7 @@ class GatewayCommand implements CommandInterface
* @param LoggerInterface $logger
* @param HandlerInterface $handler
* @param ValidatorInterface $validator
+ * @param ErrorMessageMapperInterface|null $errorMessageMapper
*/
public function __construct(
BuilderInterface $requestBuilder,
@@ -68,7 +75,8 @@ public function __construct(
ClientInterface $client,
LoggerInterface $logger,
HandlerInterface $handler = null,
- ValidatorInterface $validator = null
+ ValidatorInterface $validator = null,
+ ErrorMessageMapperInterface $errorMessageMapper = null
) {
$this->requestBuilder = $requestBuilder;
$this->transferFactory = $transferFactory;
@@ -76,6 +84,7 @@ public function __construct(
$this->handler = $handler;
$this->validator = $validator;
$this->logger = $logger;
+ $this->errorMessageMapper = $errorMessageMapper;
}
/**
@@ -84,6 +93,8 @@ public function __construct(
* @param array $commandSubject
* @return void
* @throws CommandException
+ * @throws ClientException
+ * @throws ConverterException
*/
public function execute(array $commandSubject)
{
@@ -98,10 +109,7 @@ public function execute(array $commandSubject)
array_merge($commandSubject, ['response' => $response])
);
if (!$result->isValid()) {
- $this->logExceptions($result->getFailsDescription());
- throw new CommandException(
- __('Transaction has been declined. Please try again later.')
- );
+ $this->processErrors($result);
}
}
@@ -114,13 +122,34 @@ public function execute(array $commandSubject)
}
/**
- * @param Phrase[] $fails
- * @return void
+ * Tries to map error messages from validation result and logs processed message.
+ * Throws an exception with mapped message or default error.
+ *
+ * @param ResultInterface $result
+ * @throws CommandException
*/
- private function logExceptions(array $fails)
+ private function processErrors(ResultInterface $result)
{
- foreach ($fails as $failPhrase) {
- $this->logger->critical((string) $failPhrase);
+ $messages = [];
+ $errorsSource = array_merge($result->getErrorCodes(), $result->getFailsDescription());
+ foreach ($errorsSource as $errorCodeOrMessage) {
+ $errorCodeOrMessage = (string) $errorCodeOrMessage;
+
+ // error messages mapper can be not configured if payment method doesn't have custom error messages.
+ if ($this->errorMessageMapper !== null) {
+ $mapped = (string) $this->errorMessageMapper->getMessage($errorCodeOrMessage);
+ if (!empty($mapped)) {
+ $messages[] = $mapped;
+ $errorCodeOrMessage = $mapped;
+ }
+ }
+ $this->logger->critical('Payment Error: ' . $errorCodeOrMessage);
}
+
+ throw new CommandException(
+ !empty($messages)
+ ? __(implode(PHP_EOL, $messages))
+ : __('Transaction has been declined. Please try again later.')
+ );
}
}
diff --git a/app/code/Magento/Payment/Gateway/ErrorMapper/ErrorMessageMapper.php b/app/code/Magento/Payment/Gateway/ErrorMapper/ErrorMessageMapper.php
new file mode 100644
index 000000000000..2072615a39b9
--- /dev/null
+++ b/app/code/Magento/Payment/Gateway/ErrorMapper/ErrorMessageMapper.php
@@ -0,0 +1,44 @@
+messageMapping = $messageMapping;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getMessage(string $code)
+ {
+ $message = $this->messageMapping->get($code);
+ return $message ? __($message) : null;
+ }
+}
diff --git a/app/code/Magento/Payment/Gateway/ErrorMapper/ErrorMessageMapperInterface.php b/app/code/Magento/Payment/Gateway/ErrorMapper/ErrorMessageMapperInterface.php
new file mode 100644
index 000000000000..f09f49b7f810
--- /dev/null
+++ b/app/code/Magento/Payment/Gateway/ErrorMapper/ErrorMessageMapperInterface.php
@@ -0,0 +1,27 @@
+message` format and converts it to [code => message] array format.
+ */
+class XmlToArrayConverter implements ConverterInterface
+{
+ /**
+ * @inheritdoc
+ */
+ public function convert($source)
+ {
+ $result = [];
+ $messageList = $source->getElementsByTagName('message');
+ foreach ($messageList as $messageNode) {
+ $result[(string) $messageNode->getAttribute('code')] = (string) $messageNode->nodeValue;
+ }
+ return $result;
+ }
+}
diff --git a/app/code/Magento/Payment/Gateway/Validator/AbstractValidator.php b/app/code/Magento/Payment/Gateway/Validator/AbstractValidator.php
index 45c6d61baeee..f1a895051415 100644
--- a/app/code/Magento/Payment/Gateway/Validator/AbstractValidator.php
+++ b/app/code/Magento/Payment/Gateway/Validator/AbstractValidator.php
@@ -32,14 +32,16 @@ public function __construct(
*
* @param bool $isValid
* @param array $fails
- * @return ResultInterface
+ * @param array $errorCodes
+ * @return void
*/
- protected function createResult($isValid, array $fails = [])
+ protected function createResult($isValid, array $fails = [], array $errorCodes = [])
{
return $this->resultInterfaceFactory->create(
[
'isValid' => (bool)$isValid,
- 'failsDescription' => $fails
+ 'failsDescription' => $fails,
+ 'errorCodes' => $errorCodes
]
);
}
diff --git a/app/code/Magento/Payment/Gateway/Validator/Result.php b/app/code/Magento/Payment/Gateway/Validator/Result.php
index 7266e4745d63..256741447304 100644
--- a/app/code/Magento/Payment/Gateway/Validator/Result.php
+++ b/app/code/Magento/Payment/Gateway/Validator/Result.php
@@ -19,35 +19,47 @@ class Result implements ResultInterface
*/
private $failsDescription;
+ /**
+ * @var string[]
+ */
+ private $errorCodes;
+
/**
* @param bool $isValid
* @param array $failsDescription
+ * @param array $errorCodes
*/
public function __construct(
$isValid,
- array $failsDescription = []
+ array $failsDescription = [],
+ array $errorCodes = []
) {
$this->isValid = (bool)$isValid;
$this->failsDescription = $failsDescription;
+ $this->errorCodes = $errorCodes;
}
/**
- * Returns validation result
- *
- * @return bool
+ * {@inheritdoc}
*/
- public function isValid()
+ public function isValid(): bool
{
return $this->isValid;
}
/**
- * Returns list of fails description
- *
- * @return Phrase[]
+ * {@inheritdoc}
*/
- public function getFailsDescription()
+ public function getFailsDescription(): array
{
return $this->failsDescription;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getErrorCodes(): array
+ {
+ return $this->errorCodes;
+ }
}
diff --git a/app/code/Magento/Payment/Gateway/Validator/ResultInterface.php b/app/code/Magento/Payment/Gateway/Validator/ResultInterface.php
index 9c93efe73f34..c1ad947e49c5 100644
--- a/app/code/Magento/Payment/Gateway/Validator/ResultInterface.php
+++ b/app/code/Magento/Payment/Gateway/Validator/ResultInterface.php
@@ -28,4 +28,11 @@ public function isValid();
* @return Phrase[]
*/
public function getFailsDescription();
+
+ /**
+ * Returns list of error codes.
+ *
+ * @return string[]
+ */
+ public function getErrorCodes();
}
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Command/GatewayCommandTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Command/GatewayCommandTest.php
index df8bdc9bca54..7acb59538433 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Command/GatewayCommandTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Command/GatewayCommandTest.php
@@ -6,11 +6,15 @@
namespace Magento\Payment\Test\Unit\Gateway\Command;
use Magento\Payment\Gateway\Command\GatewayCommand;
+use Magento\Payment\Gateway\ErrorMapper\ErrorMessageMapperInterface;
use Magento\Payment\Gateway\Http\ClientInterface;
use Magento\Payment\Gateway\Http\TransferFactoryInterface;
+use Magento\Payment\Gateway\Http\TransferInterface;
use Magento\Payment\Gateway\Request\BuilderInterface;
use Magento\Payment\Gateway\Response\HandlerInterface;
+use Magento\Payment\Gateway\Validator\ResultInterface;
use Magento\Payment\Gateway\Validator\ValidatorInterface;
+use PHPUnit_Framework_MockObject_MockObject as MockObject;
use Psr\Log\LoggerInterface;
/**
@@ -18,175 +22,186 @@
*/
class GatewayCommandTest extends \PHPUnit\Framework\TestCase
{
- /** @var GatewayCommand */
- protected $command;
+ /**
+ * @var GatewayCommand
+ */
+ private $command;
/**
- * @var BuilderInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var BuilderInterface|MockObject
*/
- protected $requestBuilderMock;
+ private $requestBuilder;
/**
- * @var TransferFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var TransferFactoryInterface|MockObject
*/
- protected $transferFactoryMock;
+ private $transferFactory;
/**
- * @var ClientInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ClientInterface|MockObject
*/
- protected $clientMock;
+ private $client;
/**
- * @var HandlerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var HandlerInterface|MockObject
*/
- protected $responseHandlerMock;
+ private $responseHandler;
/**
- * @var ValidatorInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ValidatorInterface|MockObject
*/
- protected $validatorMock;
+ private $validator;
/**
- * @var LoggerInterface |\PHPUnit_Framework_MockObject_MockObject
+ * @var LoggerInterface|MockObject
*/
private $logger;
+ /**
+ * @var ErrorMessageMapperInterface|MockObject
+ */
+ private $errorMessageMapper;
+
protected function setUp()
{
- $this->requestBuilderMock = $this->createMock(
- BuilderInterface::class
- );
- $this->transferFactoryMock = $this->createMock(
- TransferFactoryInterface::class
- );
- $this->clientMock = $this->createMock(
- ClientInterface::class
- );
- $this->responseHandlerMock = $this->createMock(
- HandlerInterface::class
- );
- $this->validatorMock = $this->createMock(
- ValidatorInterface::class
- );
+ $this->requestBuilder = $this->createMock(BuilderInterface::class);
+ $this->transferFactory = $this->createMock(TransferFactoryInterface::class);
+ $this->client = $this->createMock(ClientInterface::class);
+ $this->responseHandler = $this->createMock(HandlerInterface::class);
+ $this->validator = $this->createMock(ValidatorInterface::class);
$this->logger = $this->createMock(LoggerInterface::class);
+ $this->errorMessageMapper = $this->createMock(ErrorMessageMapperInterface::class);
$this->command = new GatewayCommand(
- $this->requestBuilderMock,
- $this->transferFactoryMock,
- $this->clientMock,
+ $this->requestBuilder,
+ $this->transferFactory,
+ $this->client,
$this->logger,
- $this->responseHandlerMock,
- $this->validatorMock
+ $this->responseHandler,
+ $this->validator,
+ $this->errorMessageMapper
);
}
public function testExecute()
{
$commandSubject = ['authorize'];
- $request = [
- 'request_field1' => 'request_value1',
- 'request_field2' => 'request_value2'
- ];
- $response = ['response_field1' => 'response_value1'];
- $validationResult = $this->getMockBuilder(
- \Magento\Payment\Gateway\Validator\ResultInterface::class
- )
- ->getMockForAbstractClass();
+ $this->processRequest($commandSubject, true);
- $transferO = $this->getMockBuilder(
- \Magento\Payment\Gateway\Http\TransferInterface::class
- )
- ->getMockForAbstractClass();
+ $this->responseHandler->method('handle')
+ ->with($commandSubject, ['response_field1' => 'response_value1']);
- $this->requestBuilderMock->expects(static::once())
- ->method('build')
- ->with($commandSubject)
- ->willReturn($request);
+ $this->command->execute($commandSubject);
+ }
- $this->transferFactoryMock->expects(static::once())
- ->method('create')
- ->with($request)
- ->willReturn($transferO);
+ /**
+ * Checks a case when request fails.
+ *
+ * @expectedException \Magento\Payment\Gateway\Command\CommandException
+ * @expectedExceptionMessage Transaction has been declined. Please try again later.
+ */
+ public function testExecuteValidationFail()
+ {
+ $commandSubject = ['authorize'];
+ $validationFailures = [
+ __('Failure #1'),
+ __('Failure #2'),
+ ];
- $this->clientMock->expects(static::once())
- ->method('placeRequest')
- ->with($transferO)
- ->willReturn($response);
- $this->validatorMock->expects(static::once())
- ->method('validate')
- ->with(array_merge($commandSubject, ['response' =>$response]))
- ->willReturn($validationResult);
- $validationResult->expects(static::once())
- ->method('isValid')
- ->willReturn(true);
+ $this->processRequest($commandSubject, false, $validationFailures);
- $this->responseHandlerMock->expects(static::once())
- ->method('handle')
- ->with($commandSubject, $response);
+ $this->logger->expects(self::exactly(count($validationFailures)))
+ ->method('critical')
+ ->withConsecutive(
+ [self::equalTo('Payment Error: ' . $validationFailures[0])],
+ [self::equalTo('Payment Error: ' . $validationFailures[1])]
+ );
$this->command->execute($commandSubject);
}
- public function testExecuteValidationFail()
+ /**
+ * Checks a case when request fails and response errors are mapped.
+ *
+ * @expectedException \Magento\Payment\Gateway\Command\CommandException
+ * @expectedExceptionMessage Failure Mapped
+ */
+ public function testExecuteValidationFailWithMappedErrors()
{
- $this->expectException(
- \Magento\Payment\Gateway\Command\CommandException::class
- );
-
$commandSubject = ['authorize'];
- $request = [
- 'request_field1' => 'request_value1',
- 'request_field2' => 'request_value2'
- ];
- $response = ['response_field1' => 'response_value1'];
$validationFailures = [
__('Failure #1'),
__('Failure #2'),
];
- $validationResult = $this->getMockBuilder(
- \Magento\Payment\Gateway\Validator\ResultInterface::class
- )
- ->getMockForAbstractClass();
+ $errorCodes = ['401'];
+
+ $this->processRequest($commandSubject, false, $validationFailures, $errorCodes);
+
+ $this->errorMessageMapper->method('getMessage')
+ ->willReturnMap(
+ [
+ ['401', 'Unauthorized'],
+ ['Failure #1', 'Failure Mapped'],
+ ['Failure #2', null]
+ ]
+ );
+
+ $this->logger->expects(self::exactly(count(array_merge($validationFailures, $errorCodes))))
+ ->method('critical')
+ ->withConsecutive(
+ [self::equalTo('Payment Error: Unauthorized')],
+ [self::equalTo('Payment Error: Failure Mapped')],
+ [self::equalTo('Payment Error: Failure #2')]
+ );
- $transferO = $this->getMockBuilder(
- \Magento\Payment\Gateway\Http\TransferInterface::class
- )
+ $this->command->execute($commandSubject);
+ }
+
+ /**
+ * Performs command actions like request, response and validation.
+ *
+ * @param array $commandSubject
+ * @param bool $validationResult
+ * @param array $validationFailures
+ * @param array $errorCodes
+ */
+ private function processRequest(
+ array $commandSubject,
+ bool $validationResult,
+ array $validationFailures = [],
+ array $errorCodes = []
+ ) {
+ $request = [
+ 'request_field1' => 'request_value1',
+ 'request_field2' => 'request_value2'
+ ];
+ $response = ['response_field1' => 'response_value1'];
+ $transferO = $this->getMockBuilder(TransferInterface::class)
->getMockForAbstractClass();
- $this->requestBuilderMock->expects(static::once())
- ->method('build')
+ $this->requestBuilder->method('build')
->with($commandSubject)
->willReturn($request);
- $this->transferFactoryMock->expects(static::once())
- ->method('create')
+ $this->transferFactory->method('create')
->with($request)
->willReturn($transferO);
- $this->clientMock->expects(static::once())
- ->method('placeRequest')
+ $this->client->method('placeRequest')
->with($transferO)
->willReturn($response);
- $this->validatorMock->expects(static::once())
- ->method('validate')
- ->with(array_merge($commandSubject, ['response' =>$response]))
- ->willReturn($validationResult);
- $validationResult->expects(static::once())
- ->method('isValid')
- ->willReturn(false);
- $validationResult->expects(static::once())
- ->method('getFailsDescription')
- ->willReturn(
- $validationFailures
- );
- $this->logger->expects(static::exactly(count($validationFailures)))
- ->method('critical')
- ->withConsecutive(
- [$validationFailures[0]],
- [$validationFailures[1]]
- );
+ $result = $this->getMockBuilder(ResultInterface::class)
+ ->getMockForAbstractClass();
- $this->command->execute($commandSubject);
+ $this->validator->method('validate')
+ ->with(array_merge($commandSubject, ['response' => $response]))
+ ->willReturn($result);
+ $result->method('isValid')
+ ->willReturn($validationResult);
+ $result->method('getFailsDescription')
+ ->willReturn($validationFailures);
+ $result->method('getErrorCodes')
+ ->willReturn($errorCodes);
}
}
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/CountryValidatorTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/CountryValidatorTest.php
index 0c808cb7c1fa..3054a705373e 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/CountryValidatorTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/CountryValidatorTest.php
@@ -62,7 +62,7 @@ public function testValidateAllowspecificTrue($storeId, $country, $allowspecific
$this->resultFactoryMock->expects($this->once())
->method('create')
- ->with(['isValid' => $isValid, 'failsDescription' => []])
+ ->with(['isValid' => $isValid, 'failsDescription' => [], 'errorCodes' => []])
->willReturn($this->resultMock);
$this->assertSame($this->resultMock, $this->model->validate($validationSubject));
@@ -90,7 +90,7 @@ public function testValidateAllowspecificFalse($storeId, $allowspecific, $isVali
$this->resultFactoryMock->expects($this->once())
->method('create')
- ->with(['isValid' => $isValid, 'failsDescription' => []])
+ ->with(['isValid' => $isValid, 'failsDescription' => [], 'errorCodes' => []])
->willReturn($this->resultMock);
$this->assertSame($this->resultMock, $this->model->validate($validationSubject));
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php
index 7b86db369b97..7352cb7a4ac6 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php
@@ -75,7 +75,8 @@ public function testValidate()
->with(
[
'isValid' => false,
- 'failsDescription' => ['Fail']
+ 'failsDescription' => ['Fail'],
+ 'errorCodes' => []
]
)
->willReturn($compositeResult);
diff --git a/app/code/Magento/Payment/Test/Unit/Model/Method/FactoryTest.php b/app/code/Magento/Payment/Test/Unit/Model/Method/FactoryTest.php
deleted file mode 100644
index f0cb19ef0fa0..000000000000
--- a/app/code/Magento/Payment/Test/Unit/Model/Method/FactoryTest.php
+++ /dev/null
@@ -1,89 +0,0 @@
-_objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
- $this->_factory = $objectManagerHelper->getObject(
- \Magento\Payment\Model\Method\Factory::class,
- ['objectManager' => $this->_objectManagerMock]
- );
- }
-
- public function testCreateMethod()
- {
- $className = \Magento\Payment\Model\Method\AbstractMethod::class;
- $methodMock = $this->createMock($className);
- $this->_objectManagerMock->expects(
- $this->once()
- )->method(
- 'create'
- )->with(
- $className,
- []
- )->will(
- $this->returnValue($methodMock)
- );
-
- $this->assertEquals($methodMock, $this->_factory->create($className));
- }
-
- public function testCreateMethodWithArguments()
- {
- $className = \Magento\Payment\Model\Method\AbstractMethod::class;
- $data = ['param1', 'param2'];
- $methodMock = $this->createMock($className);
- $this->_objectManagerMock->expects(
- $this->once()
- )->method(
- 'create'
- )->with(
- $className,
- $data
- )->will(
- $this->returnValue($methodMock)
- );
-
- $this->assertEquals($methodMock, $this->_factory->create($className, $data));
- }
-
- /**
- * @expectedException \Magento\Framework\Exception\LocalizedException
- * @expectedExceptionMessage WrongClass class doesn't implement \Magento\Payment\Model\MethodInterface
- */
- public function testWrongTypeException()
- {
- $className = 'WrongClass';
- $methodMock = $this->createMock($className);
- $this->_objectManagerMock->expects(
- $this->once()
- )->method(
- 'create'
- )->with(
- $className,
- []
- )->will(
- $this->returnValue($methodMock)
- );
-
- $this->_factory->create($className);
- }
-}
diff --git a/app/code/Magento/Payment/Test/Unit/Model/Method/Specification/FactoryTest.php b/app/code/Magento/Payment/Test/Unit/Model/Method/Specification/FactoryTest.php
deleted file mode 100644
index 9bdc90829f6f..000000000000
--- a/app/code/Magento/Payment/Test/Unit/Model/Method/Specification/FactoryTest.php
+++ /dev/null
@@ -1,71 +0,0 @@
-objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
-
- $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->factory = $objectManagerHelper->getObject(
- \Magento\Payment\Model\Method\Specification\Factory::class,
- ['objectManager' => $this->objectManagerMock]
- );
- }
-
- public function testCreateMethod()
- {
- $className = \Magento\Payment\Model\Method\SpecificationInterface::class;
- $methodMock = $this->createMock($className);
- $this->objectManagerMock->expects(
- $this->once()
- )->method(
- 'get'
- )->with(
- $className
- )->will(
- $this->returnValue($methodMock)
- );
-
- $this->assertEquals($methodMock, $this->factory->create($className));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Specification must implement SpecificationInterface
- */
- public function testWrongTypeException()
- {
- $className = 'WrongClass';
- $methodMock = $this->createMock($className);
- $this->objectManagerMock->expects(
- $this->once()
- )->method(
- 'get'
- )->with(
- $className
- )->will(
- $this->returnValue($methodMock)
- );
-
- $this->factory->create($className);
- }
-}
diff --git a/app/code/Magento/Payment/etc/di.xml b/app/code/Magento/Payment/etc/di.xml
index 8eea32cc5839..74f553cc6409 100644
--- a/app/code/Magento/Payment/etc/di.xml
+++ b/app/code/Magento/Payment/etc/di.xml
@@ -12,6 +12,7 @@
+
@@ -37,6 +38,31 @@
+
+
+ Magento_Payment
+ error_mapping.xsd
+
+
+
+
+ Magento\Payment\Gateway\ErrorMapper\XmlToArrayConverter
+ Magento\Payment\Gateway\ErrorMapper\VirtualSchemaLocator
+ error_mapping.xml
+
+
+
+
+ Magento\Payment\Gateway\ErrorMapper\VirtualConfigReader
+ payment_error_mapper
+
+
+
+
+ Magento\Payment\Gateway\ErrorMapper\NullMappingData
+
+
+
/var/log/payment.log
diff --git a/app/code/Magento/Payment/etc/error_mapping.xsd b/app/code/Magento/Payment/etc/error_mapping.xsd
new file mode 100644
index 000000000000..97f3c181beb3
--- /dev/null
+++ b/app/code/Magento/Payment/etc/error_mapping.xsd
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Paypal/etc/db_schema.xml b/app/code/Magento/Paypal/etc/db_schema.xml
index f6f5448dbc2f..2703ee4f5be3 100644
--- a/app/code/Magento/Paypal/etc/db_schema.xml
+++ b/app/code/Magento/Paypal/etc/db_schema.xml
@@ -145,7 +145,7 @@
-
+
diff --git a/app/code/Magento/Persistent/etc/db_schema.xml b/app/code/Magento/Persistent/etc/db_schema.xml
index 31adf5be6f0c..68678fc60f09 100644
--- a/app/code/Magento/Persistent/etc/db_schema.xml
+++ b/app/code/Magento/Persistent/etc/db_schema.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php b/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php
index 0971dd4c2766..61d8d1987c2d 100644
--- a/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php
+++ b/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php
@@ -60,10 +60,7 @@ public function getImage(Product $product, $imageId, $attributes = [])
$this->appEmulation->startEnvironmentEmulation($storeId, Area::AREA_FRONTEND, true);
try {
- $image = $this->imageBuilder->setProduct($product)
- ->setImageId($imageId)
- ->setAttributes($attributes)
- ->create();
+ $image = $this->imageBuilder->create($product, $imageId, $attributes);
} catch (\Exception $exception) {
$this->appEmulation->stopEnvironmentEmulation();
throw $exception;
diff --git a/app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php b/app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php
index 39b07161934f..172e5f486f30 100644
--- a/app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php
+++ b/app/code/Magento/ProductAlert/Test/Unit/Block/Product/ImageProviderTest.php
@@ -54,23 +54,16 @@ public function testGetImage()
$imageId = 'test_image_id';
$attributes = [];
- $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
- ->disableOriginalConstructor()
- ->getMock();
- $imageMock = $this->getMockBuilder(\Magento\Catalog\Block\Product\Image::class)
- ->disableOriginalConstructor()
- ->getMock();
- $storeMock = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
- ->disableOriginalConstructor()
- ->getMock();
+ $productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $imageMock = $this->createMock(\Magento\Catalog\Block\Product\Image::class);
+ $storeMock = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class);
$this->storeManagerMock->expects($this->atLeastOnce())->method('getStore')->willReturn($storeMock);
- $storeMock->expects($this->atLeastOnce())->method('getId')->willReturn(42);
$this->emulationMock->expects($this->once())->method('startEnvironmentEmulation');
- $this->imageBuilderMock->expects($this->once())->method('setProduct')->with($productMock)->willReturnSelf();
- $this->imageBuilderMock->expects($this->once())->method('setImageId')->with($imageId)->willReturnSelf();
- $this->imageBuilderMock->expects($this->once())->method('setAttributes')->with($attributes)->willReturnSelf();
- $this->imageBuilderMock->expects($this->once())->method('create')->willReturn($imageMock);
+ $this->imageBuilderMock->expects($this->once())
+ ->method('create')
+ ->with($productMock, $imageId, $attributes)
+ ->willReturn($imageMock);
$this->emulationMock->expects($this->once())->method('stopEnvironmentEmulation');
$this->assertEquals($imageMock, $this->model->getImage($productMock, $imageId, $attributes));
@@ -84,6 +77,7 @@ public function testGetImage()
*/
public function testGetImageThrowsAnException()
{
+ $imageId = 1;
$productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
->disableOriginalConstructor()
->getMock();
@@ -93,13 +87,13 @@ public function testGetImageThrowsAnException()
$this->emulationMock->expects($this->once())->method('startEnvironmentEmulation');
$this->storeManagerMock->expects($this->atLeastOnce())->method('getStore')->willReturn($storeMock);
- $storeMock->expects($this->atLeastOnce())->method('getId')->willReturn(42);
$this->imageBuilderMock->expects($this->once())
- ->method('setProduct')
+ ->method('create')
+ ->with($productMock, $imageId)
->willThrowException(new \Exception("Image Builder Exception"));
$this->emulationMock->expects($this->once())->method('stopEnvironmentEmulation');
- $this->model->getImage($productMock, 1);
+ $this->model->getImage($productMock, $imageId);
}
}
diff --git a/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php b/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php
index 78730d625e44..2277aa980f66 100644
--- a/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php
+++ b/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php
@@ -11,6 +11,8 @@
*/
namespace Magento\ProductVideo\Block\Product\View;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
+
/**
* @api
* @since 100.0.2
@@ -28,7 +30,7 @@ class Gallery extends \Magento\Catalog\Block\Product\View\Gallery
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
* @param \Magento\ProductVideo\Helper\Media $mediaHelper
* @param array $data
- * @param \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory
+ * @param \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface|null $imagesConfigFactory
* @param array $galleryImagesConfig
*/
public function __construct(
diff --git a/app/code/Magento/Quote/Api/ChangeQuoteControlInterface.php b/app/code/Magento/Quote/Api/ChangeQuoteControlInterface.php
new file mode 100644
index 000000000000..4212b289c4bc
--- /dev/null
+++ b/app/code/Magento/Quote/Api/ChangeQuoteControlInterface.php
@@ -0,0 +1,25 @@
+userContext = $userContext;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isAllowed(CartInterface $quote): bool
+ {
+ switch ($this->userContext->getUserType()) {
+ case UserContextInterface::USER_TYPE_CUSTOMER:
+ $isAllowed = ($quote->getCustomerId() == $this->userContext->getUserId());
+ break;
+ case UserContextInterface::USER_TYPE_GUEST:
+ $isAllowed = ($quote->getCustomerId() === null);
+ break;
+ case UserContextInterface::USER_TYPE_ADMIN:
+ case UserContextInterface::USER_TYPE_INTEGRATION:
+ $isAllowed = true;
+ break;
+ default:
+ $isAllowed = false;
+ }
+
+ return $isAllowed;
+ }
+}
diff --git a/app/code/Magento/Quote/Model/QuoteRepository/Plugin/AccessChangeQuoteControl.php b/app/code/Magento/Quote/Model/QuoteRepository/Plugin/AccessChangeQuoteControl.php
index 3eff09faac1f..79b518fc5453 100644
--- a/app/code/Magento/Quote/Model/QuoteRepository/Plugin/AccessChangeQuoteControl.php
+++ b/app/code/Magento/Quote/Model/QuoteRepository/Plugin/AccessChangeQuoteControl.php
@@ -3,10 +3,10 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Quote\Model\QuoteRepository\Plugin;
-use Magento\Authorization\Model\UserContextInterface;
-use Magento\Quote\Model\Quote;
+use Magento\Quote\Api\ChangeQuoteControlInterface;
use Magento\Framework\Exception\StateException;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Api\Data\CartInterface;
@@ -17,24 +17,23 @@
class AccessChangeQuoteControl
{
/**
- * @var UserContextInterface
+ * @var ChangeQuoteControlInterface $changeQuoteControl
*/
- private $userContext;
+ private $changeQuoteControl;
/**
- * @param UserContextInterface $userContext
+ * @param ChangeQuoteControlInterface $changeQuoteControl
*/
- public function __construct(
- UserContextInterface $userContext
- ) {
- $this->userContext = $userContext;
+ public function __construct(ChangeQuoteControlInterface $changeQuoteControl)
+ {
+ $this->changeQuoteControl = $changeQuoteControl;
}
/**
* Checks if change quote's customer id is allowed for current user.
*
* @param CartRepositoryInterface $subject
- * @param Quote $quote
+ * @param CartInterface $quote
* @throws StateException if Guest has customer_id or Customer's customer_id not much with user_id
* or unknown user's type
* @return void
@@ -42,34 +41,8 @@ public function __construct(
*/
public function beforeSave(CartRepositoryInterface $subject, CartInterface $quote)
{
- if (!$this->isAllowed($quote)) {
+ if (! $this->changeQuoteControl->isAllowed($quote)) {
throw new StateException(__("Invalid state change requested"));
}
}
-
- /**
- * Checks if user is allowed to change the quote.
- *
- * @param Quote $quote
- * @return bool
- */
- private function isAllowed(Quote $quote)
- {
- switch ($this->userContext->getUserType()) {
- case UserContextInterface::USER_TYPE_CUSTOMER:
- $isAllowed = ($quote->getCustomerId() == $this->userContext->getUserId());
- break;
- case UserContextInterface::USER_TYPE_GUEST:
- $isAllowed = ($quote->getCustomerId() === null);
- break;
- case UserContextInterface::USER_TYPE_ADMIN:
- case UserContextInterface::USER_TYPE_INTEGRATION:
- $isAllowed = true;
- break;
- default:
- $isAllowed = false;
- }
-
- return $isAllowed;
- }
}
diff --git a/app/code/Magento/Quote/Model/ResourceModel/Quote.php b/app/code/Magento/Quote/Model/ResourceModel/Quote.php
index e171d88dae6f..571f1b4686bc 100644
--- a/app/code/Magento/Quote/Model/ResourceModel/Quote.php
+++ b/app/code/Magento/Quote/Model/ResourceModel/Quote.php
@@ -180,7 +180,7 @@ public function getReservedOrderId($quote)
public function isOrderIncrementIdUsed($orderIncrementId)
{
/** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
- $adapter = $this->getConnection();
+ $adapter = $this->_resources->getConnection('sales');
$bind = [':increment_id' => $orderIncrementId];
/** @var \Magento\Framework\DB\Select $select */
$select = $adapter->select();
diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteRepository/Plugin/AccessChangeQuoteControlTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteRepository/Plugin/AccessChangeQuoteControlTest.php
index f330ebda1731..043e04319362 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/QuoteRepository/Plugin/AccessChangeQuoteControlTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteRepository/Plugin/AccessChangeQuoteControlTest.php
@@ -3,9 +3,11 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Quote\Test\Unit\Model\QuoteRepository\Plugin;
use Magento\Authorization\Model\UserContextInterface;
+use Magento\Quote\Model\ChangeQuoteControl;
use Magento\Quote\Model\QuoteRepository\Plugin\AccessChangeQuoteControl;
use Magento\Quote\Model\Quote;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
@@ -34,6 +36,11 @@ class AccessChangeQuoteControlTest extends \PHPUnit\Framework\TestCase
*/
private $quoteRepositoryMock;
+ /**
+ * @var ChangeQuoteControl|MockObject
+ */
+ private $changeQuoteControlMock;
+
protected function setUp()
{
$this->userContextMock = $this->getMockBuilder(UserContextInterface::class)
@@ -50,15 +57,19 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
+ $this->changeQuoteControlMock = $this->getMockBuilder(ChangeQuoteControl::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$objectManagerHelper = new ObjectManager($this);
$this->accessChangeQuoteControl = $objectManagerHelper->getObject(
AccessChangeQuoteControl::class,
- ['userContext' => $this->userContextMock]
+ ['changeQuoteControl' => $this->changeQuoteControlMock]
);
}
/**
- * User with role Customer and customer_id much with context user_id.
+ * User with role Customer and customer_id matches context user_id.
*/
public function testBeforeSaveForCustomer()
{
@@ -68,6 +79,9 @@ public function testBeforeSaveForCustomer()
$this->userContextMock->method('getUserType')
->willReturn(UserContextInterface::USER_TYPE_CUSTOMER);
+ $this->changeQuoteControlMock->method('isAllowed')
+ ->willReturn(true);
+
$result = $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
$this->assertNull($result);
@@ -81,11 +95,15 @@ public function testBeforeSaveForCustomer()
*/
public function testBeforeSaveException()
{
- $this->userContextMock->method('getUserType')
- ->willReturn(UserContextInterface::USER_TYPE_CUSTOMER);
$this->quoteMock->method('getCustomerId')
->willReturn(2);
+ $this->userContextMock->method('getUserType')
+ ->willReturn(UserContextInterface::USER_TYPE_CUSTOMER);
+
+ $this->changeQuoteControlMock->method('isAllowed')
+ ->willReturn(false);
+
$this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
}
@@ -100,6 +118,9 @@ public function testBeforeSaveForAdmin()
$this->userContextMock->method('getUserType')
->willReturn(UserContextInterface::USER_TYPE_ADMIN);
+ $this->changeQuoteControlMock->method('isAllowed')
+ ->willReturn(true);
+
$result = $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
$this->assertNull($result);
@@ -116,6 +137,9 @@ public function testBeforeSaveForGuest()
$this->userContextMock->method('getUserType')
->willReturn(UserContextInterface::USER_TYPE_GUEST);
+ $this->changeQuoteControlMock->method('isAllowed')
+ ->willReturn(true);
+
$result = $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
$this->assertNull($result);
@@ -135,6 +159,9 @@ public function testBeforeSaveForGuestException()
$this->userContextMock->method('getUserType')
->willReturn(UserContextInterface::USER_TYPE_GUEST);
+ $this->changeQuoteControlMock->method('isAllowed')
+ ->willReturn(false);
+
$this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
}
@@ -152,6 +179,9 @@ public function testBeforeSaveForUnknownUserTypeException()
$this->userContextMock->method('getUserType')
->willReturn(10);
+ $this->changeQuoteControlMock->method('isAllowed')
+ ->willReturn(false);
+
$this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
}
}
diff --git a/app/code/Magento/Quote/etc/db_schema.xml b/app/code/Magento/Quote/etc/db_schema.xml
index ff127b9c06f0..999d23328e0e 100644
--- a/app/code/Magento/Quote/etc/db_schema.xml
+++ b/app/code/Magento/Quote/etc/db_schema.xml
@@ -7,7 +7,7 @@
-->
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json
index 00b4dd165b3b..17e0d9bebcf5 100644
--- a/app/code/Magento/Review/composer.json
+++ b/app/code/Magento/Review/composer.json
@@ -18,7 +18,7 @@
},
"suggest": {
"magento/module-cookie": "*",
- "magento/module-review-sample-data": "Sample Data version:100.3.*"
+ "magento/module-review-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/CommentRepository.php b/app/code/Magento/Sales/Model/Order/Creditmemo/CommentRepository.php
index 14d4ccae2244..991453bc6745 100644
--- a/app/code/Magento/Sales/Model/Order/Creditmemo/CommentRepository.php
+++ b/app/code/Magento/Sales/Model/Order/Creditmemo/CommentRepository.php
@@ -7,6 +7,7 @@
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\CouldNotDeleteException;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Sales\Api\CreditmemoCommentRepositoryInterface;
@@ -14,7 +15,13 @@
use Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory;
use Magento\Sales\Api\Data\CreditmemoCommentSearchResultInterfaceFactory;
use Magento\Sales\Model\Spi\CreditmemoCommentResourceInterface;
+use Magento\Sales\Model\Order\Email\Sender\CreditmemoCommentSender;
+use Magento\Sales\Api\CreditmemoRepositoryInterface;
+use Psr\Log\LoggerInterface;
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class CommentRepository implements CreditmemoCommentRepositoryInterface
{
/**
@@ -37,22 +44,48 @@ class CommentRepository implements CreditmemoCommentRepositoryInterface
*/
private $collectionProcessor;
+ /**
+ * @var CreditmemoCommentSender
+ */
+ private $creditmemoCommentSender;
+
+ /**
+ * @var CreditmemoRepositoryInterface
+ */
+ private $creditmemoRepository;
+
+ /**
+ * @var LoggerInterface
+ */
+ private $logger;
+
/**
* @param CreditmemoCommentResourceInterface $commentResource
* @param CreditmemoCommentInterfaceFactory $commentFactory
* @param CreditmemoCommentSearchResultInterfaceFactory $searchResultFactory
* @param CollectionProcessorInterface $collectionProcessor
+ * @param CreditmemoCommentSender|null $creditmemoCommentSender
+ * @param CreditmemoRepositoryInterface|null $creditmemoRepository
+ * @param LoggerInterface|null $logger
*/
public function __construct(
CreditmemoCommentResourceInterface $commentResource,
CreditmemoCommentInterfaceFactory $commentFactory,
CreditmemoCommentSearchResultInterfaceFactory $searchResultFactory,
- CollectionProcessorInterface $collectionProcessor
+ CollectionProcessorInterface $collectionProcessor,
+ CreditmemoCommentSender $creditmemoCommentSender = null,
+ CreditmemoRepositoryInterface $creditmemoRepository = null,
+ LoggerInterface $logger = null
) {
$this->commentResource = $commentResource;
$this->commentFactory = $commentFactory;
$this->searchResultFactory = $searchResultFactory;
$this->collectionProcessor = $collectionProcessor;
+ $this->creditmemoCommentSender = $creditmemoCommentSender
+ ?: ObjectManager::getInstance()->get(CreditmemoCommentSender::class);
+ $this->creditmemoRepository = $creditmemoRepository
+ ?: ObjectManager::getInstance()->get(CreditmemoRepositoryInterface::class);
+ $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
}
/**
@@ -97,8 +130,16 @@ public function save(CreditmemoCommentInterface $entity)
try {
$this->commentResource->save($entity);
} catch (\Exception $e) {
- throw new CouldNotSaveException(__('Could not save the comment.'), $e);
+ throw new CouldNotSaveException(__('Could not save the creditmemo comment.'), $e);
}
+
+ try {
+ $creditmemo = $this->creditmemoRepository->get($entity->getParentId());
+ $this->creditmemoCommentSender->send($creditmemo, $entity->getIsCustomerNotified(), $entity->getComment());
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+ }
+
return $entity;
}
}
diff --git a/app/code/Magento/Sales/Model/Order/Invoice/CommentRepository.php b/app/code/Magento/Sales/Model/Order/Invoice/CommentRepository.php
index 858490132e0c..9ad06cea775e 100644
--- a/app/code/Magento/Sales/Model/Order/Invoice/CommentRepository.php
+++ b/app/code/Magento/Sales/Model/Order/Invoice/CommentRepository.php
@@ -7,6 +7,7 @@
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\CouldNotDeleteException;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Sales\Api\Data\InvoiceCommentInterface;
@@ -14,7 +15,13 @@
use Magento\Sales\Api\Data\InvoiceCommentSearchResultInterfaceFactory;
use Magento\Sales\Api\InvoiceCommentRepositoryInterface;
use Magento\Sales\Model\Spi\InvoiceCommentResourceInterface;
+use Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender;
+use Magento\Sales\Api\InvoiceRepositoryInterface;
+use Psr\Log\LoggerInterface;
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class CommentRepository implements InvoiceCommentRepositoryInterface
{
/**
@@ -37,22 +44,48 @@ class CommentRepository implements InvoiceCommentRepositoryInterface
*/
private $collectionProcessor;
+ /**
+ * @var InvoiceCommentSender
+ */
+ private $invoiceCommentSender;
+
+ /**
+ * @var InvoiceRepositoryInterface
+ */
+ private $invoiceRepository;
+
+ /**
+ * @var LoggerInterface
+ */
+ private $logger;
+
/**
* @param InvoiceCommentResourceInterface $commentResource
* @param InvoiceCommentInterfaceFactory $commentFactory
* @param InvoiceCommentSearchResultInterfaceFactory $searchResultFactory
* @param CollectionProcessorInterface $collectionProcessor
+ * @param InvoiceCommentSender|null $invoiceCommentSender
+ * @param InvoiceRepositoryInterface|null $invoiceRepository
+ * @param LoggerInterface|null $logger
*/
public function __construct(
InvoiceCommentResourceInterface $commentResource,
InvoiceCommentInterfaceFactory $commentFactory,
InvoiceCommentSearchResultInterfaceFactory $searchResultFactory,
- CollectionProcessorInterface $collectionProcessor
+ CollectionProcessorInterface $collectionProcessor,
+ InvoiceCommentSender $invoiceCommentSender = null,
+ InvoiceRepositoryInterface $invoiceRepository = null,
+ LoggerInterface $logger = null
) {
$this->commentResource = $commentResource;
$this->commentFactory = $commentFactory;
$this->searchResultFactory = $searchResultFactory;
$this->collectionProcessor = $collectionProcessor;
+ $this->invoiceCommentSender = $invoiceCommentSender
+ ?:ObjectManager::getInstance()->get(InvoiceCommentSender::class);
+ $this->invoiceRepository = $invoiceRepository
+ ?:ObjectManager::getInstance()->get(InvoiceRepositoryInterface::class);
+ $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
}
/**
@@ -99,6 +132,14 @@ public function save(InvoiceCommentInterface $entity)
} catch (\Exception $e) {
throw new CouldNotSaveException(__('Could not save the invoice comment.'), $e);
}
+
+ try {
+ $invoice = $this->invoiceRepository->get($entity->getParentId());
+ $this->invoiceCommentSender->send($invoice, $entity->getIsCustomerNotified(), $entity->getComment());
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+ }
+
return $entity;
}
}
diff --git a/app/code/Magento/Sales/Model/Order/Shipment/CommentRepository.php b/app/code/Magento/Sales/Model/Order/Shipment/CommentRepository.php
index b0d3b03aec4e..8efc9f846191 100644
--- a/app/code/Magento/Sales/Model/Order/Shipment/CommentRepository.php
+++ b/app/code/Magento/Sales/Model/Order/Shipment/CommentRepository.php
@@ -7,6 +7,7 @@
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\CouldNotDeleteException;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Sales\Api\Data\ShipmentCommentInterface;
@@ -14,7 +15,13 @@
use Magento\Sales\Api\Data\ShipmentCommentSearchResultInterfaceFactory;
use Magento\Sales\Api\ShipmentCommentRepositoryInterface;
use Magento\Sales\Model\Spi\ShipmentCommentResourceInterface;
+use Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender;
+use Magento\Sales\Api\ShipmentRepositoryInterface;
+use Psr\Log\LoggerInterface;
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class CommentRepository implements ShipmentCommentRepositoryInterface
{
/**
@@ -37,22 +44,48 @@ class CommentRepository implements ShipmentCommentRepositoryInterface
*/
private $collectionProcessor;
+ /**
+ * @var ShipmentCommentSender
+ */
+ private $shipmentCommentSender;
+
+ /**
+ * @var ShipmentRepositoryInterface
+ */
+ private $shipmentRepository;
+
+ /**
+ * @var LoggerInterface
+ */
+ private $logger;
+
/**
* @param ShipmentCommentResourceInterface $commentResource
* @param ShipmentCommentInterfaceFactory $commentFactory
* @param ShipmentCommentSearchResultInterfaceFactory $searchResultFactory
* @param CollectionProcessorInterface $collectionProcessor
+ * @param ShipmentCommentSender|null $shipmentCommentSender
+ * @param ShipmentRepositoryInterface|null $shipmentRepository
+ * @param LoggerInterface|null $logger
*/
public function __construct(
ShipmentCommentResourceInterface $commentResource,
ShipmentCommentInterfaceFactory $commentFactory,
ShipmentCommentSearchResultInterfaceFactory $searchResultFactory,
- CollectionProcessorInterface $collectionProcessor
+ CollectionProcessorInterface $collectionProcessor,
+ ShipmentCommentSender $shipmentCommentSender = null,
+ ShipmentRepositoryInterface $shipmentRepository = null,
+ LoggerInterface $logger = null
) {
$this->commentResource = $commentResource;
$this->commentFactory = $commentFactory;
$this->searchResultFactory = $searchResultFactory;
$this->collectionProcessor = $collectionProcessor;
+ $this->shipmentCommentSender = $shipmentCommentSender
+ ?: ObjectManager::getInstance()->get(ShipmentCommentSender::class);
+ $this->shipmentRepository = $shipmentRepository
+ ?: ObjectManager::getInstance()->get(ShipmentRepositoryInterface::class);
+ $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
}
/**
@@ -99,6 +132,14 @@ public function save(ShipmentCommentInterface $entity)
} catch (\Exception $e) {
throw new CouldNotSaveException(__('Could not save the shipment comment.'), $e);
}
+
+ try {
+ $shipment = $this->shipmentRepository->get($entity->getParentId());
+ $this->shipmentCommentSender->send($shipment, $entity->getIsCustomerNotified(), $entity->getComment());
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+ }
+
return $entity;
}
}
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/CommentRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/CommentRepositoryTest.php
new file mode 100644
index 000000000000..649e8dc0600c
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/CommentRepositoryTest.php
@@ -0,0 +1,189 @@
+commentResource = $this->getMockBuilder(CreditmemoCommentResourceInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->commentFactory = $this->getMockBuilder(CreditmemoCommentInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->searchResultFactory = $this->getMockBuilder(CreditmemoCommentSearchResultInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->creditmemoRepositoryMock = $this->getMockBuilder(CreditmemoRepositoryInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->creditmemoCommentSender = $this->getMockBuilder(CreditmemoCommentSender::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->loggerMock = $this->getMockBuilder(LoggerInterface::class)->disableOriginalConstructor()->getMock();
+
+ $this->creditmemoMock = $this->getMockBuilder(Creditmemo::class)->disableOriginalConstructor()->getMock();
+ $this->commentMock = $this->getMockBuilder(Comment::class)->disableOriginalConstructor()->getMock();
+
+ $this->commentRepository = new CommentRepository(
+ $this->commentResource,
+ $this->commentFactory,
+ $this->searchResultFactory,
+ $this->collectionProcessor,
+ $this->creditmemoCommentSender,
+ $this->creditmemoRepositoryMock,
+ $this->loggerMock
+ );
+ }
+
+ public function testSave()
+ {
+ $comment = "Comment text";
+ $creditmemoId = 123;
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willReturnSelf();
+ $this->commentMock->expects($this->once())
+ ->method('getIsCustomerNotified')
+ ->willReturn(1);
+ $this->commentMock->expects($this->once())
+ ->method('getParentId')
+ ->willReturn($creditmemoId);
+ $this->commentMock->expects($this->once())
+ ->method('getComment')
+ ->willReturn($comment);
+
+ $this->creditmemoRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($creditmemoId)
+ ->willReturn($this->creditmemoMock);
+ $this->creditmemoCommentSender->expects($this->once())
+ ->method('send')
+ ->with($this->creditmemoMock, true, $comment)
+ ->willReturn(true);
+ $this->commentRepository->save($this->commentMock);
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+ * @expectedExceptionMessage Could not save the creditmemo comment.
+ */
+ public function testSaveWithException()
+ {
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willThrowException(
+ new \Magento\Framework\Exception\CouldNotSaveException(__('Could not save the creditmemo comment.'))
+ );
+
+ $this->commentRepository->save($this->commentMock);
+ }
+
+ public function testSaveSendCatchException()
+ {
+ $comment = "Comment text";
+ $creditmemoId = 123;
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willReturnSelf();
+ $this->commentMock->expects($this->once())
+ ->method('getIsCustomerNotified')
+ ->willReturn(1);
+ $this->commentMock->expects($this->once())
+ ->method('getParentId')
+ ->willReturn($creditmemoId);
+ $this->commentMock->expects($this->once())
+ ->method('getComment')
+ ->willReturn($comment);
+
+ $this->creditmemoRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($creditmemoId)
+ ->willReturn($this->creditmemoMock);
+ $this->creditmemoCommentSender->expects($this->once())
+ ->method('send')
+ ->willThrowException(new \Exception());
+ $this->loggerMock->expects($this->once())
+ ->method('critical');
+
+ $this->commentRepository->save($this->commentMock);
+ }
+}
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/CommentRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/CommentRepositoryTest.php
new file mode 100644
index 000000000000..984554b28990
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/CommentRepositoryTest.php
@@ -0,0 +1,189 @@
+commentResource = $this->getMockBuilder(InvoiceCommentResourceInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->commentFactory = $this->getMockBuilder(InvoiceCommentInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->searchResultFactory = $this->getMockBuilder(InvoiceCommentSearchResultInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->invoiceRepositoryMock = $this->getMockBuilder(InvoiceRepositoryInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->invoiceCommentSender = $this->getMockBuilder(InvoiceCommentSender::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->loggerMock = $this->getMockBuilder(LoggerInterface::class)->disableOriginalConstructor()->getMock();
+
+ $this->invoiceMock = $this->getMockBuilder(Invoice::class)->disableOriginalConstructor()->getMock();
+ $this->commentMock = $this->getMockBuilder(Comment::class)->disableOriginalConstructor()->getMock();
+
+ $this->commentRepository = new CommentRepository(
+ $this->commentResource,
+ $this->commentFactory,
+ $this->searchResultFactory,
+ $this->collectionProcessor,
+ $this->invoiceCommentSender,
+ $this->invoiceRepositoryMock,
+ $this->loggerMock
+ );
+ }
+
+ public function testSave()
+ {
+ $comment = "Comment text";
+ $invoiceId = 123;
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willReturnSelf();
+ $this->commentMock->expects($this->once())
+ ->method('getIsCustomerNotified')
+ ->willReturn(1);
+ $this->commentMock->expects($this->once())
+ ->method('getParentId')
+ ->willReturn($invoiceId);
+ $this->commentMock->expects($this->once())
+ ->method('getComment')
+ ->willReturn($comment);
+
+ $this->invoiceRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($invoiceId)
+ ->willReturn($this->invoiceMock);
+ $this->invoiceCommentSender->expects($this->once())
+ ->method('send')
+ ->with($this->invoiceMock, true, $comment)
+ ->willReturn(true);
+ $this->commentRepository->save($this->commentMock);
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+ * @expectedExceptionMessage Could not save the invoice comment.
+ */
+ public function testSaveWithException()
+ {
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willThrowException(
+ new \Magento\Framework\Exception\CouldNotSaveException(__('Could not save the invoice comment.'))
+ );
+
+ $this->commentRepository->save($this->commentMock);
+ }
+
+ public function testSaveSendCatchException()
+ {
+ $comment = "Comment text";
+ $creditmemoId = 123;
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willReturnSelf();
+ $this->commentMock->expects($this->once())
+ ->method('getIsCustomerNotified')
+ ->willReturn(1);
+ $this->commentMock->expects($this->once())
+ ->method('getParentId')
+ ->willReturn($creditmemoId);
+ $this->commentMock->expects($this->once())
+ ->method('getComment')
+ ->willReturn($comment);
+
+ $this->invoiceRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($creditmemoId)
+ ->willReturn($this->invoiceMock);
+ $this->invoiceCommentSender->expects($this->once())
+ ->method('send')
+ ->willThrowException(new \Exception());
+ $this->loggerMock->expects($this->once())
+ ->method('critical');
+
+ $this->commentRepository->save($this->commentMock);
+ }
+}
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/CommentRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/CommentRepositoryTest.php
new file mode 100644
index 000000000000..5152b359e4b6
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/CommentRepositoryTest.php
@@ -0,0 +1,188 @@
+commentResource = $this->getMockBuilder(ShipmentCommentResourceInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->commentFactory = $this->getMockBuilder(ShipmentCommentInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->searchResultFactory = $this->getMockBuilder(ShipmentCommentSearchResultInterfaceFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->shipmentRepositoryMock = $this->getMockBuilder(ShipmentRepositoryInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->shipmentCommentSender = $this->getMockBuilder(ShipmentCommentSender::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->loggerMock = $this->getMockBuilder(LoggerInterface::class)->disableOriginalConstructor()->getMock();
+
+ $this->shipmentMock = $this->getMockBuilder(Shipment::class)->disableOriginalConstructor()->getMock();
+ $this->commentMock = $this->getMockBuilder(Comment::class)->disableOriginalConstructor()->getMock();
+
+ $this->commentRepository = new CommentRepository(
+ $this->commentResource,
+ $this->commentFactory,
+ $this->searchResultFactory,
+ $this->collectionProcessor,
+ $this->shipmentCommentSender,
+ $this->shipmentRepositoryMock,
+ $this->loggerMock
+ );
+ }
+
+ public function testSave()
+ {
+ $comment = "Comment text";
+ $shipmentId = 123;
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willReturnSelf();
+ $this->commentMock->expects($this->once())
+ ->method('getIsCustomerNotified')
+ ->willReturn(1);
+ $this->commentMock->expects($this->once())
+ ->method('getParentId')
+ ->willReturn($shipmentId);
+ $this->commentMock->expects($this->once())
+ ->method('getComment')
+ ->willReturn($comment);
+
+ $this->shipmentRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($shipmentId)
+ ->willReturn($this->shipmentMock);
+ $this->shipmentCommentSender->expects($this->once())
+ ->method('send')
+ ->with($this->shipmentMock, true, $comment);
+ $this->assertEquals($this->commentMock, $this->commentRepository->save($this->commentMock));
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+ * @expectedExceptionMessage Could not save the shipment comment.
+ */
+ public function testSaveWithException()
+ {
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willThrowException(
+ new \Magento\Framework\Exception\CouldNotSaveException(__('Could not save the shipment comment.'))
+ );
+
+ $this->commentRepository->save($this->commentMock);
+ }
+
+ public function testSaveSendCatchException()
+ {
+ $comment = "Comment text";
+ $creditmemoId = 123;
+ $this->commentResource->expects($this->once())
+ ->method('save')
+ ->with($this->commentMock)
+ ->willReturnSelf();
+ $this->commentMock->expects($this->once())
+ ->method('getIsCustomerNotified')
+ ->willReturn(1);
+ $this->commentMock->expects($this->once())
+ ->method('getParentId')
+ ->willReturn($creditmemoId);
+ $this->commentMock->expects($this->once())
+ ->method('getComment')
+ ->willReturn($comment);
+
+ $this->shipmentRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($creditmemoId)
+ ->willReturn($this->shipmentMock);
+ $this->shipmentCommentSender->expects($this->once())
+ ->method('send')
+ ->willThrowException(new \Exception());
+ $this->loggerMock->expects($this->once())
+ ->method('critical');
+
+ $this->commentRepository->save($this->commentMock);
+ }
+}
diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json
index ea2e57dc73ec..4286fbb506a5 100644
--- a/app/code/Magento/Sales/composer.json
+++ b/app/code/Magento/Sales/composer.json
@@ -33,7 +33,7 @@
"magento/module-wishlist": "*"
},
"suggest": {
- "magento/module-sales-sample-data": "Sample Data version:100.3.*"
+ "magento/module-sales-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml
index 6261353332ce..9d6d11d56c81 100644
--- a/app/code/Magento/Sales/etc/adminhtml/system.xml
+++ b/app/code/Magento/Sales/etc/adminhtml/system.xml
@@ -106,15 +106,15 @@
We'll use the default error above if you leave this empty.
-
+
-
+
Magento\Config\Model\Config\Source\Yesno
Improves dashboard performance but provides non-realtime data.
-
+
diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml
index c1dc3af859d1..cbc06856f528 100644
--- a/app/code/Magento/Sales/etc/di.xml
+++ b/app/code/Magento/Sales/etc/di.xml
@@ -686,7 +686,7 @@
- ShippingAddressAggregator
- sales_order.shipping_description
- sales_invoice.base_subtotal
- - sales_order.base_shipping_amount
+ - sales_invoice.base_shipping_amount
- sales_invoice.base_grand_total
- sales_invoice.grand_total
- sales_invoice.created_at
diff --git a/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php b/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php
index 5068f53f23bc..3907261cad1b 100644
--- a/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php
+++ b/app/code/Magento/SalesRule/Model/ResourceModel/Coupon.php
@@ -106,7 +106,7 @@ public function exists($code)
}
/**
- * Update auto generated Specific Coupon if it's rule changed
+ * Update auto generated Specific Coupon if its rule changed
*
* @param \Magento\SalesRule\Model\Rule $rule
* @return $this
diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json
index e85827a6bd0a..a2e7dc8835ae 100644
--- a/app/code/Magento/SalesRule/composer.json
+++ b/app/code/Magento/SalesRule/composer.json
@@ -25,7 +25,7 @@
"magento/module-widget": "*"
},
"suggest": {
- "magento/module-sales-rule-sample-data": "Sample Data version:100.3.*"
+ "magento/module-sales-rule-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/SalesSequence/Setup/Patch/Schema/CreateSequence.php b/app/code/Magento/SalesSequence/Setup/Patch/Schema/CreateSequence.php
deleted file mode 100644
index 875817a973a9..000000000000
--- a/app/code/Magento/SalesSequence/Setup/Patch/Schema/CreateSequence.php
+++ /dev/null
@@ -1,68 +0,0 @@
-sequenceCreator = $sequenceCreator;
- }
-
- /**
- * {@inheritdoc}
- */
- public function apply()
- {
- $this->sequenceCreator->create();
- }
-
- /**
- * {@inheritdoc}
- */
- public static function getDependencies()
- {
- return [
- \Magento\Store\Setup\Patch\Schema\InitializeStoresAndWebsites::class
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public static function getVersion()
- {
- return '2.0.0';
- }
-
- /**
- * {@inheritdoc}
- */
- public function getAliases()
- {
- return [];
- }
-}
diff --git a/app/code/Magento/SalesSequence/Setup/Recurring.php b/app/code/Magento/SalesSequence/Setup/Recurring.php
new file mode 100644
index 000000000000..2beff94bfab6
--- /dev/null
+++ b/app/code/Magento/SalesSequence/Setup/Recurring.php
@@ -0,0 +1,39 @@
+sequenceCreator = $sequenceCreator;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
+ {
+ $this->sequenceCreator->create();
+ }
+}
diff --git a/app/code/Magento/SalesSequence/composer.json b/app/code/Magento/SalesSequence/composer.json
index a0475c14f91a..3865d9569c52 100644
--- a/app/code/Magento/SalesSequence/composer.json
+++ b/app/code/Magento/SalesSequence/composer.json
@@ -6,8 +6,7 @@
},
"require": {
"php": "~7.1.3||~7.2.0",
- "magento/framework": "*",
- "magento/module-store": "*"
+ "magento/framework": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/SalesSequence/etc/db_schema.xml b/app/code/Magento/SalesSequence/etc/db_schema.xml
index 0a2d1cb9e0cb..530a9a33b0cf 100644
--- a/app/code/Magento/SalesSequence/etc/db_schema.xml
+++ b/app/code/Magento/SalesSequence/etc/db_schema.xml
@@ -7,7 +7,7 @@
-->
-
+
-
+
diff --git a/app/code/Magento/SalesSequence/etc/module.xml b/app/code/Magento/SalesSequence/etc/module.xml
index e200d84a3145..dc6918830dbf 100644
--- a/app/code/Magento/SalesSequence/etc/module.xml
+++ b/app/code/Magento/SalesSequence/etc/module.xml
@@ -6,9 +6,5 @@
*/
-->
-
-
-
-
-
+
diff --git a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php
index 88df47283133..57a61fecae5c 100644
--- a/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php
+++ b/app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php
@@ -68,7 +68,7 @@ public function __construct(
protected function configure()
{
$this->setName('sampledata:deploy')
- ->setDescription('Deploy sample data modules');
+ ->setDescription('Deploy sample data modules for composer-based Magento installations');
$this->addOption(
self::OPTION_NO_UPDATE,
null,
@@ -83,6 +83,12 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $rootJson = json_decode($this->filesystem->getDirectoryRead(DirectoryList::ROOT)->readFile("composer.json"));
+ if (!isset($rootJson->version)) {
+ // @codingStandardsIgnoreLine
+ $output->writeln('' . 'Git installations must deploy sample data from GitHub; see https://devdocs.magento.com/guides/v2.3/install-gde/install/sample-data-after-clone.html for more information.' . '');
+ return;
+ }
$this->updateMemoryLimit();
$this->createAuthFile();
$sampleDataPackages = $this->sampleDataDependency->getSampleDataPackages();
diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php
index a475560dd608..d08f2d9833e8 100644
--- a/app/code/Magento/SampleData/Model/Dependency.php
+++ b/app/code/Magento/SampleData/Model/Dependency.php
@@ -81,7 +81,7 @@ public function getSampleDataPackages()
$suggests = array_merge($suggests, $this->getSuggestsFromModules());
foreach ($suggests as $name => $version) {
if (strpos($version, self::SAMPLE_DATA_SUGGEST) === 0) {
- $installExtensions[$name] = substr($version, strlen(self::SAMPLE_DATA_SUGGEST));
+ $installExtensions[$name] = trim(substr($version, strlen(self::SAMPLE_DATA_SUGGEST)));
}
}
return $installExtensions;
diff --git a/app/code/Magento/SampleData/Test/Unit/Console/Command/AbstractSampleDataCommandTest.php b/app/code/Magento/SampleData/Test/Unit/Console/Command/AbstractSampleDataCommandTest.php
index 090bb4256f80..a5790d40f782 100644
--- a/app/code/Magento/SampleData/Test/Unit/Console/Command/AbstractSampleDataCommandTest.php
+++ b/app/code/Magento/SampleData/Test/Unit/Console/Command/AbstractSampleDataCommandTest.php
@@ -83,6 +83,9 @@ protected function setupMocks(
$additionalComposerArgs = []
) {
$this->directoryReadMock->expects($this->any())->method('getAbsolutePath')->willReturn($pathToComposerJson);
+ $this->directoryReadMock->expects($this->any())->method('readFile')->with('composer.json')->willReturn(
+ '{"version": "0.0.1"}'
+ );
$this->filesystemMock->expects($this->any())->method('getDirectoryRead')->with(DirectoryList::ROOT)->willReturn(
$this->directoryReadMock
);
diff --git a/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php b/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php
index 450b2d8798f5..7ca27a7d746c 100644
--- a/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php
+++ b/app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataDeployCommandTest.php
@@ -115,6 +115,15 @@ public function processDataProvider()
*/
public function testExecuteWithException()
{
+ $this->directoryReadMock->expects($this->once())
+ ->method('readFile')
+ ->with('composer.json')
+ ->willReturn('{"version": "0.0.1"}');
+ $this->filesystemMock->expects($this->once())
+ ->method('getDirectoryRead')
+ ->with(DirectoryList::ROOT)
+ ->willReturn($this->directoryReadMock);
+
$this->directoryWriteMock->expects($this->once())
->method('isExist')
->with(PackagesAuth::PATH_TO_AUTH_FILE)
diff --git a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php
index adf5a9eb6ebe..5343b4f867ad 100644
--- a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php
+++ b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php
@@ -152,8 +152,8 @@ public static function dataPackagesFromComposerSuggest()
];
},
'suggestions' => [
- 'magento/foo-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '100.0.0',
- 'thirdparty/bar-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.2.3',
+ 'magento/foo-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . ' 100.0.0',
+ 'thirdparty/bar-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . ' 1.2.3',
'thirdparty/something-else' => 'Just a suggested package',
],
'expectedPackages' => [
diff --git a/app/code/Magento/SampleData/composer.json b/app/code/Magento/SampleData/composer.json
index 89677a98cad4..17bb4d03dd55 100644
--- a/app/code/Magento/SampleData/composer.json
+++ b/app/code/Magento/SampleData/composer.json
@@ -9,7 +9,7 @@
"magento/framework": "*"
},
"suggest": {
- "magento/sample-data-media": "Sample Data version:100.3.*"
+ "magento/sample-data-media": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Signifyd/etc/db_schema.xml b/app/code/Magento/Signifyd/etc/db_schema.xml
index d416112c20d7..6a31eacbb45f 100644
--- a/app/code/Magento/Signifyd/etc/db_schema.xml
+++ b/app/code/Magento/Signifyd/etc/db_schema.xml
@@ -7,7 +7,7 @@
-->
-
+
-
+
diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php
index 840a6a1858fa..a536ec998b82 100644
--- a/app/code/Magento/Sitemap/Model/Observer.php
+++ b/app/code/Magento/Sitemap/Model/Observer.php
@@ -19,6 +19,8 @@ class Observer
/**
* Cronjob expression configuration
+ *
+ * @deprecated Use \Magento\Cron\Model\Config\Backend\Sitemap::CRON_STRING_PATH instead.
*/
const XML_PATH_CRON_EXPR = 'crontab/default/jobs/generate_sitemaps/schedule/cron_expr';
diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php
index 2e71a225b457..11a59cfa59f1 100644
--- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php
+++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php
@@ -5,6 +5,7 @@
*/
namespace Magento\Sitemap\Model\ResourceModel\Catalog;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;
use Magento\Store\Model\Store;
use Magento\Framework\App\ObjectManager;
@@ -90,7 +91,12 @@ class Product extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
* @var \Magento\Catalog\Helper\Image
*/
private $catalogImageHelper;
-
+
+ /**
+ * @var UrlBuilder
+ */
+ private $imageUrlBuilder;
+
/**
* Scope Config
*
@@ -112,6 +118,7 @@ class Product extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
* @param \Magento\Catalog\Model\Product $productModel
* @param \Magento\Catalog\Helper\Image $catalogImageHelper
* @param \Magento\Framework\App\Config\ScopeConfigInterface|null $scopeConfig
+ * @param UrlBuilder $urlBuilder
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
@@ -127,7 +134,8 @@ public function __construct(
$connectionName = null,
\Magento\Catalog\Model\Product $productModel = null,
\Magento\Catalog\Helper\Image $catalogImageHelper = null,
- \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig = null
+ \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig = null,
+ UrlBuilder $urlBuilder = null
) {
$this->_productResource = $productResource;
$this->_storeManager = $storeManager;
@@ -138,10 +146,13 @@ public function __construct(
$this->_mediaConfig = $mediaConfig;
$this->_sitemapData = $sitemapData;
$this->productModel = $productModel ?: ObjectManager::getInstance()->get(\Magento\Catalog\Model\Product::class);
+ $this->catalogImageHelper = $catalogImageHelper;
+ $this->imageUrlBuilder = $urlBuilder ?? ObjectManager::getInstance()->get(UrlBuilder::class);
$this->catalogImageHelper = $catalogImageHelper ?: ObjectManager::getInstance()
->get(\Magento\Catalog\Helper\Image::class);
$this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()
->get(\Magento\Framework\App\Config\ScopeConfigInterface::class);
+
parent::__construct($context, $connectionName);
}
@@ -452,20 +463,14 @@ public function prepareSelectStatement(\Magento\Framework\DB\Select $select)
}
/**
- * Get product image URL from image filename and path
+ * Get product image URL from image filename
*
* @param string $image
* @return string
*/
private function getProductImageUrl($image)
{
- $productObject = $this->productModel;
- $imgUrl = $this->catalogImageHelper
- ->init($productObject, 'product_page_image_large')
- ->setImageFile($image)
- ->getUrl();
-
- return $imgUrl;
+ return $this->imageUrlBuilder->getUrl($image, 'product_page_image_large');
}
/**
diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php
index f78c3d656ed5..d58ff732c81d 100644
--- a/app/code/Magento/Sitemap/Model/Sitemap.php
+++ b/app/code/Magento/Sitemap/Model/Sitemap.php
@@ -646,7 +646,7 @@ protected function _finalizeSitemap($type = self::TYPE_URL)
*/
protected function _getCurrentSitemapFilename($index)
{
- return self::INDEX_FILE_PREFIX . '-' . $this->getStoreId() . '-' . $index . '.xml';
+ return str_replace('.xml', '', $this->getSitemapFilename()) . '-' . $this->getStoreId() . '-' . $index . '.xml';
}
/**
diff --git a/app/code/Magento/Sitemap/etc/config.xml b/app/code/Magento/Sitemap/etc/config.xml
index 73468baadcb9..6f14ff728ac4 100644
--- a/app/code/Magento/Sitemap/etc/config.xml
+++ b/app/code/Magento/Sitemap/etc/config.xml
@@ -42,5 +42,16 @@
+
+
+
+
+
+ 0 0 * * *
+
+
+
+
+
diff --git a/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php b/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php
index bd8ac4b6048c..039609217667 100644
--- a/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php
+++ b/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php
@@ -34,7 +34,7 @@ protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->websiteFactoryMock =
- $this->getMockBuilder('Magento\Store\Model\WebsiteFactory')
+ $this->getMockBuilder(\Magento\Store\Model\WebsiteFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();
diff --git a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php
index aef8a25da283..6550bc6ce790 100644
--- a/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php
+++ b/app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php
@@ -8,6 +8,7 @@
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Helper\Product as CatalogProduct;
use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
use Magento\ConfigurableProduct\Helper\Data;
use Magento\ConfigurableProduct\Model\ConfigurableAttributeData;
use Magento\Customer\Helper\Session\CurrentCustomer;
@@ -76,6 +77,12 @@ class Configurable extends \Magento\ConfigurableProduct\Block\Product\View\Type\
private $swatchAttributesProvider;
/**
+ * @var UrlBuilder
+ */
+ private $imageUrlBuilder;
+
+ /**
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @param Context $context
* @param ArrayUtils $arrayUtils
* @param EncoderInterface $jsonEncoder
@@ -86,9 +93,9 @@ class Configurable extends \Magento\ConfigurableProduct\Block\Product\View\Type\
* @param ConfigurableAttributeData $configurableAttributeData
* @param SwatchData $swatchHelper
* @param Media $swatchMediaHelper
- * @param array $data other data
- * @param SwatchAttributesProvider $swatchAttributesProvider
- * @SuppressWarnings(PHPMD.ExcessiveParameterList)
+ * @param array $data
+ * @param SwatchAttributesProvider|null $swatchAttributesProvider
+ * @param UrlBuilder|null $imageUrlBuilder
*/
public function __construct(
Context $context,
@@ -102,12 +109,14 @@ public function __construct(
SwatchData $swatchHelper,
Media $swatchMediaHelper,
array $data = [],
- SwatchAttributesProvider $swatchAttributesProvider = null
+ SwatchAttributesProvider $swatchAttributesProvider = null,
+ UrlBuilder $imageUrlBuilder = null
) {
$this->swatchHelper = $swatchHelper;
$this->swatchMediaHelper = $swatchMediaHelper;
$this->swatchAttributesProvider = $swatchAttributesProvider
?: ObjectManager::getInstance()->get(SwatchAttributesProvider::class);
+ $this->imageUrlBuilder = $imageUrlBuilder ?? ObjectManager::getInstance()->get(UrlBuilder::class);
parent::__construct(
$context,
$arrayUtils,
@@ -358,8 +367,9 @@ protected function getSwatchProductImage(Product $childProduct, $imageType)
$swatchImageId = $imageType == Swatch::SWATCH_IMAGE_NAME ? 'swatch_image_base' : 'swatch_thumb_base';
$imageAttributes = ['type' => 'image'];
}
- if (isset($swatchImageId)) {
- return $this->_imageHelper->init($childProduct, $swatchImageId, $imageAttributes)->getUrl();
+
+ if (!empty($swatchImageId) && !empty($imageAttributes['type'])) {
+ return $this->imageUrlBuilder->getUrl($childProduct->getData($imageAttributes['type']), $swatchImageId);
}
}
diff --git a/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php b/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php
index 85633475205e..e13373fb7255 100644
--- a/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php
+++ b/app/code/Magento/Swatches/Block/Product/Renderer/Listing/Configurable.php
@@ -8,6 +8,7 @@
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Helper\Product as CatalogProduct;
use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
use Magento\ConfigurableProduct\Helper\Data;
use Magento\ConfigurableProduct\Model\ConfigurableAttributeData;
use Magento\Customer\Helper\Session\CurrentCustomer;
@@ -39,6 +40,7 @@ class Configurable extends \Magento\Swatches\Block\Product\Renderer\Configurable
private $variationPrices;
/**
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @param Context $context
* @param ArrayUtils $arrayUtils
* @param EncoderInterface $jsonEncoder
@@ -49,11 +51,10 @@ class Configurable extends \Magento\Swatches\Block\Product\Renderer\Configurable
* @param ConfigurableAttributeData $configurableAttributeData
* @param SwatchData $swatchHelper
* @param Media $swatchMediaHelper
- * @param array $data other data
- * @param SwatchAttributesProvider $swatchAttributesProvider
+ * @param array $data
+ * @param SwatchAttributesProvider|null $swatchAttributesProvider
* @param \Magento\Framework\Locale\Format|null $localeFormat
* @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Variations\Prices|null $variationPrices
- * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
Context $context,
diff --git a/app/code/Magento/Swatches/Helper/Data.php b/app/code/Magento/Swatches/Helper/Data.php
index c1883cdc48e7..05daf3ddf584 100644
--- a/app/code/Magento/Swatches/Helper/Data.php
+++ b/app/code/Magento/Swatches/Helper/Data.php
@@ -9,6 +9,7 @@
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Helper\Image;
use Magento\Catalog\Model\Product as ModelProduct;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
@@ -58,13 +59,6 @@ class Data
*/
protected $swatchCollectionFactory;
- /**
- * Catalog Image Helper
- *
- * @var Image
- */
- protected $imageHelper;
-
/**
* Product metadata pool
*
@@ -100,12 +94,17 @@ class Data
*/
private $swatchTypeChecker;
+ /**
+ * @var UrlBuilder
+ */
+ private $imageUrlBuilder;
+
/**
* @param CollectionFactory $productCollectionFactory
* @param ProductRepositoryInterface $productRepository
* @param StoreManagerInterface $storeManager
* @param SwatchCollectionFactory $swatchCollectionFactory
- * @param Image $imageHelper
+ * @param UrlBuilder $urlBuilder
* @param Json|null $serializer
* @param SwatchAttributesProvider $swatchAttributesProvider
* @param SwatchAttributeType|null $swatchTypeChecker
@@ -115,7 +114,7 @@ public function __construct(
ProductRepositoryInterface $productRepository,
StoreManagerInterface $storeManager,
SwatchCollectionFactory $swatchCollectionFactory,
- Image $imageHelper,
+ UrlBuilder $urlBuilder,
Json $serializer = null,
SwatchAttributesProvider $swatchAttributesProvider = null,
SwatchAttributeType $swatchTypeChecker = null
@@ -124,12 +123,12 @@ public function __construct(
$this->productRepository = $productRepository;
$this->storeManager = $storeManager;
$this->swatchCollectionFactory = $swatchCollectionFactory;
- $this->imageHelper = $imageHelper;
$this->serializer = $serializer ?: ObjectManager::getInstance()->create(Json::class);
$this->swatchAttributesProvider = $swatchAttributesProvider
?: ObjectManager::getInstance()->get(SwatchAttributesProvider::class);
$this->swatchTypeChecker = $swatchTypeChecker
?: ObjectManager::getInstance()->create(SwatchAttributeType::class);
+ $this->imageUrlBuilder = $urlBuilder;
}
/**
@@ -309,7 +308,7 @@ public function getProductMediaGallery(ModelProduct $product)
return [];
}
- $resultGallery = $this->getAllSizeImages($product, $baseImage);
+ $resultGallery = $this->getAllSizeImages($baseImage);
$resultGallery['gallery'] = $this->getGalleryImages($product);
return $resultGallery;
@@ -327,31 +326,21 @@ private function getGalleryImages(ModelProduct $product)
$result = [];
$mediaGallery = $product->getMediaGalleryImages();
foreach ($mediaGallery as $media) {
- $result[$media->getData('value_id')] = $this->getAllSizeImages(
- $product,
- $media->getData('file')
- );
+ $result[$media->getData('value_id')] = $this->getAllSizeImages($media->getData('file'));
}
return $result;
}
/**
- * @param ModelProduct $product
* @param string $imageFile
* @return array
*/
- private function getAllSizeImages(ModelProduct $product, $imageFile)
+ private function getAllSizeImages($imageFile)
{
return [
- 'large' => $this->imageHelper->init($product, 'product_page_image_large_no_frame')
- ->setImageFile($imageFile)
- ->getUrl(),
- 'medium' => $this->imageHelper->init($product, 'product_page_image_medium_no_frame')
- ->setImageFile($imageFile)
- ->getUrl(),
- 'small' => $this->imageHelper->init($product, 'product_page_image_small')
- ->setImageFile($imageFile)
- ->getUrl(),
+ 'large' => $this->imageUrlBuilder->getUrl($imageFile, 'product_swatch_image_large'),
+ 'medium' => $this->imageUrlBuilder->getUrl($imageFile, 'product_swatch_image_medium'),
+ 'small' => $this->imageUrlBuilder->getUrl($imageFile, 'product_swatch_image_small')
];
}
diff --git a/app/code/Magento/Swatches/Model/Plugin/ProductImage.php b/app/code/Magento/Swatches/Model/Plugin/ProductImage.php
index 0569a249260f..afdd43a77cb6 100644
--- a/app/code/Magento/Swatches/Model/Plugin/ProductImage.php
+++ b/app/code/Magento/Swatches/Model/Plugin/ProductImage.php
@@ -5,6 +5,15 @@
*/
namespace Magento\Swatches\Model\Plugin;
+use Magento\Catalog\Model\Product;
+use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
+use Magento\Swatches\Helper\Data;
+use Magento\Eav\Model\Config;
+use Magento\Framework\App\Request\Http;
+use Magento\Catalog\Block\Product\AbstractProduct;
+use Magento\Catalog\Model\Product as ProductModel;
+use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
+
/**
* Class ProductImage replace original configurable product with first child
*/
@@ -20,29 +29,29 @@ class ProductImage
/**
* Data helper to get child product image
*
- * @var \Magento\Swatches\Helper\Data $productHelper
+ * @var Data $productHelper
*/
protected $swatchHelperData;
/**
- * @var \Magento\Eav\Model\Config
+ * @var Config
*/
protected $eavConfig;
/**
- * @var \Magento\Framework\App\Request\Http
+ * @var Http
*/
protected $request;
/**
- * @param \Magento\Swatches\Helper\Data $swatchesHelperData
- * @param \Magento\Eav\Model\Config $eavConfig
- * @param \Magento\Framework\App\Request\Http $request
+ * @param Data $swatchesHelperData
+ * @param Config $eavConfig
+ * @param Http $request
*/
public function __construct(
- \Magento\Swatches\Helper\Data $swatchesHelperData,
- \Magento\Eav\Model\Config $eavConfig,
- \Magento\Framework\App\Request\Http $request
+ Data $swatchesHelperData,
+ Config $eavConfig,
+ Http $request
) {
$this->swatchHelperData = $swatchesHelperData;
$this->eavConfig = $eavConfig;
@@ -53,19 +62,19 @@ public function __construct(
* Replace original configurable product with first child
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
- * @param \Magento\Catalog\Block\Product\AbstractProduct $subject
- * @param \Magento\Catalog\Model\Product $product
+ * @param AbstractProduct $subject
+ * @param ProductModel $product
* @param string $location
* @param array $attributes
* @return array
*/
public function beforeGetImage(
- \Magento\Catalog\Block\Product\AbstractProduct $subject,
- \Magento\Catalog\Model\Product $product,
+ AbstractProduct $subject,
+ ProductModel $product,
$location,
array $attributes = []
) {
- if ($product->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE
+ if ($product->getTypeId() == Configurable::TYPE_CODE
&& ($location == self::CATEGORY_PAGE_GRID_LOCATION || $location == self::CATEGORY_PAGE_LIST_LOCATION)) {
$request = $this->request->getParams();
if (is_array($request)) {
@@ -79,11 +88,11 @@ public function beforeGetImage(
}
/**
- * @param \Magento\Catalog\Model\Product $parentProduct
+ * @param Product $parentProduct
* @param array $filterArray
- * @return bool|\Magento\Catalog\Model\Product
+ * @return bool|Product
*/
- protected function loadSimpleVariation(\Magento\Catalog\Model\Product $parentProduct, array $filterArray)
+ private function loadSimpleVariation(Product $parentProduct, array $filterArray)
{
$childProduct = $this->swatchHelperData->loadVariationByFallback($parentProduct, $filterArray);
if ($childProduct && !$childProduct->getImage()) {
@@ -101,13 +110,13 @@ protected function loadSimpleVariation(\Magento\Catalog\Model\Product $parentPro
* @param array $request
* @return array
*/
- protected function getFilterArray(array $request)
+ private function getFilterArray(array $request)
{
$filterArray = [];
- $attributeCodes = $this->eavConfig->getEntityAttributeCodes(\Magento\Catalog\Model\Product::ENTITY);
+ $attributeCodes = $this->eavConfig->getEntityAttributeCodes(Product::ENTITY);
foreach ($request as $code => $value) {
if (in_array($code, $attributeCodes)) {
- $attribute = $this->eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $code);
+ $attribute = $this->eavConfig->getAttribute(Product::ENTITY, $code);
if ($attribute->getId() && $this->canReplaceImageWithSwatch($attribute)) {
$filterArray[$code] = $value;
}
@@ -119,10 +128,10 @@ protected function getFilterArray(array $request)
/**
* Check if we can replace original image with swatch image on catalog/category/list page
*
- * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
+ * @param Attribute $attribute
* @return bool
*/
- protected function canReplaceImageWithSwatch($attribute)
+ private function canReplaceImageWithSwatch($attribute)
{
$result = true;
if (!$this->swatchHelperData->isSwatchAttribute($attribute)) {
diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php
deleted file mode 100644
index 3786887f1bf7..000000000000
--- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/ConfigurableTest.php
+++ /dev/null
@@ -1,322 +0,0 @@
-arrayUtils = $this->createMock(\Magento\Framework\Stdlib\ArrayUtils::class);
- $this->jsonEncoder = $this->createMock(\Magento\Framework\Json\EncoderInterface::class);
- $this->helper = $this->createMock(\Magento\ConfigurableProduct\Helper\Data::class);
- $this->swatchHelper = $this->createMock(\Magento\Swatches\Helper\Data::class);
- $this->swatchMediaHelper = $this->createMock(\Magento\Swatches\Helper\Media::class);
- $this->catalogProduct = $this->createMock(\Magento\Catalog\Helper\Product::class);
- $this->currentCustomer = $this->createMock(\Magento\Customer\Helper\Session\CurrentCustomer::class);
- $this->priceCurrency = $this->createMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class);
- $this->configurableAttributeData = $this->createMock(
- \Magento\ConfigurableProduct\Model\ConfigurableAttributeData::class
- );
- $this->product = $this->createMock(\Magento\Catalog\Model\Product::class);
- $this->typeInstance = $this->createMock(\Magento\Catalog\Model\Product\Type\AbstractType::class);
- $this->scopeConfig = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
- $this->imageHelper = $this->createMock(\Magento\Catalog\Helper\Image::class);
- $this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class);
-
- $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->configurable = $objectManager->getObject(
- \Magento\Swatches\Block\Product\Renderer\Configurable::class,
- [
- 'scopeConfig' => $this->scopeConfig,
- 'imageHelper' => $this->imageHelper,
- 'urlBuilder' => $this->urlBuilder,
- 'arrayUtils' => $this->arrayUtils,
- 'jsonEncoder' => $this->jsonEncoder,
- 'helper' => $this->helper,
- 'swatchHelper' => $this->swatchHelper,
- 'swatchMediaHelper' => $this->swatchMediaHelper,
- 'catalogProduct' => $this->catalogProduct,
- 'currentCustomer' => $this->currentCustomer,
- 'priceCurrency' => $this->priceCurrency,
- 'configurableAttributeData' => $this->configurableAttributeData,
- 'data' => [],
- ]
- );
- }
-
- public function testGetAndSetProduct()
- {
- $this->configurable->setProduct($this->product);
-
- $this->assertEquals(
- $this->product,
- $this->configurable->getProduct()
- );
- }
-
- public function testGetProductParent()
- {
- $this->typeInstance->expects($this->once())->method('getStoreFilter')
- ->with($this->product)
- ->willReturn(true);
-
- $this->product->expects($this->once())->method('getTypeInstance')
- ->willReturn($this->typeInstance);
-
- $this->configurable->setData('product', $this->product);
-
- $this->assertEquals(
- $this->product,
- $this->configurable->getProduct()
- );
- }
-
- public function testGetNumberSwatchesPerProduct()
- {
- $expectedValue = 123;
-
- $this->scopeConfig->expects($this->once())->method('getValue')
- ->with('catalog/frontend/swatches_per_product')
- ->willReturn($expectedValue);
-
- $this->assertEquals(
- $expectedValue,
- $this->configurable->getNumberSwatchesPerProduct()
- );
- }
-
- public function testSetIsProductListingContext()
- {
- $this->assertEquals(
- $this->configurable,
- $this->configurable->setIsProductListingContext(1)
- );
- }
-
- private function prepareGetJsonSwatchConfig()
- {
- $product1 = $this->createMock(\Magento\Catalog\Model\Product::class);
- $product1->expects($this->atLeastOnce())->method('isSaleable')->willReturn(true);
- $product1->expects($this->atLeastOnce())->method('getData')->with('code')->willReturn(1);
-
- $product2 = $this->createMock(\Magento\Catalog\Model\Product::class);
- $product2->expects($this->atLeastOnce())->method('isSaleable')->willReturn(true);
- $product2->expects($this->atLeastOnce())->method('getData')->with('code')->willReturn(3);
-
- $simpleProducts = [$product1, $product2];
- $configurableType = $this->createMock(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::class);
- $configurableType->expects($this->atLeastOnce())->method('getUsedProducts')->with($this->product, null)
- ->willReturn($simpleProducts);
- $this->product->expects($this->any())->method('getTypeInstance')->willReturn($configurableType);
-
- $productAttribute1 = $this->createMock(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class);
- $productAttribute1->expects($this->any())->method('getId')->willReturn(1);
- $productAttribute1->expects($this->any())->method('getAttributeCode')->willReturn('code');
-
- $attribute1 = $this->createPartialMock(
- \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute::class,
- ['getProductAttribute']
- );
- $attribute1->expects($this->any())->method('getProductAttribute')->willReturn($productAttribute1);
-
- $this->helper->expects($this->any())->method('getAllowAttributes')->with($this->product)
- ->willReturn([$attribute1]);
- }
-
- public function testGetJsonSwatchConfigNotVisualImageType()
- {
- $this->prepareGetJsonSwatchConfig();
- $this->configurable->setProduct($this->product);
-
- $this->swatchHelper->expects($this->once())->method('getSwatchAttributesAsArray')
- ->with($this->product)
- ->willReturn([
- 1 => [
- 'options' => [1 => 'testA', 3 => 'testB'],
- 'use_product_image_for_swatch' => true,
- 'attribute_code' => 'code',
- ],
- ]);
-
- $this->swatchHelper->expects($this->once())->method('getSwatchesByOptionsId')
- ->with([1, 3])
- ->willReturn([
- 3 => ['type' => null, 'value' => 'hello']
- ]);
-
- $this->swatchHelper->expects($this->once())->method('loadFirstVariationWithSwatchImage')
- ->with($this->product, ['code' => 3])
- ->willReturn($this->product);
-
- $this->product->expects($this->exactly(4))->method('getData')
- ->with('swatch_image')
- ->willReturn('/path');
-
- $this->imageHelper->expects($this->exactly(2))->method('init')
- ->willReturnMap([
- [$this->product, 'swatch_image', ['type' => 'swatch_image'], $this->imageHelper],
- [$this->product, 'swatch_thumb', ['type' => 'swatch_image'], $this->imageHelper],
- ]);
-
- $this->jsonEncoder->expects($this->once())->method('encode');
-
- $this->configurable->getJsonSwatchConfig();
- }
-
- public function testGetJsonSwatchConfigVisualImageType()
- {
- $this->prepareGetJsonSwatchConfig();
- $this->configurable->setProduct($this->product);
-
- $this->swatchHelper->expects($this->once())->method('getSwatchAttributesAsArray')
- ->with($this->product)
- ->willReturn([
- 1 => [
- 'options' => [1 => 'testA', 3 => 'testB'],
- 'use_product_image_for_swatch' => true,
- 'attribute_code' => 'code',
- ],
- ]);
-
- $this->swatchHelper->expects($this->once())->method('getSwatchesByOptionsId')
- ->with([1, 3])
- ->willReturn([
- 3 => ['type' => Swatch::SWATCH_TYPE_VISUAL_IMAGE, 'value' => 'hello']
- ]);
-
- $this->swatchHelper->expects($this->once())->method('loadFirstVariationWithSwatchImage')
- ->with($this->product, ['code' => 3])
- ->willReturn($this->product);
-
- $this->swatchMediaHelper->expects($this->exactly(2))->method('getSwatchAttributeImage')
- ->withConsecutive(
- ['swatch_image', 'hello'],
- ['swatch_thumb', 'hello']
- )
- ->willReturn('/path');
-
- $this->product->expects($this->exactly(6))->method('getData')
- ->withConsecutive(['swatch_image'], ['image'], ['image'], ['swatch_image'], ['image'], ['image'])
- ->will($this->onConsecutiveCalls(null, '/path', '/path', null, '/path', '/path'));
-
- $this->imageHelper->expects($this->exactly(2))->method('init')
- ->willReturnMap([
- [$this->product, 'swatch_image_base', ['type' => 'image'], $this->imageHelper],
- [$this->product, 'swatch_thumb_base', ['type' => 'image'], $this->imageHelper],
- ]);
-
- $this->jsonEncoder->expects($this->once())->method('encode');
-
- $this->configurable->getJsonSwatchConfig();
- }
-
- public function testGetJsonSwatchConfigWithoutVisualImageType()
- {
- $this->prepareGetJsonSwatchConfig();
-
- $this->configurable->setProduct($this->product);
-
- $this->swatchHelper->expects($this->once())->method('getSwatchAttributesAsArray')
- ->with($this->product)
- ->willReturn([
- 1 => [
- 'options' => [1 => 'testA', 3 => 'testB'],
- 'use_product_image_for_swatch' => true,
- 'attribute_code' => 'code',
- ],
- ]);
-
- $this->swatchHelper->expects($this->once())->method('getSwatchesByOptionsId')
- ->with([1, 3])
- ->willReturn([
- 3 => ['type' => Swatch::SWATCH_TYPE_VISUAL_IMAGE, 'value' => 'hello']
- ]);
-
- $this->swatchHelper->expects($this->once())->method('loadFirstVariationWithSwatchImage')
- ->with($this->product, ['code' => 3])
- ->willReturn($this->product);
-
- $this->swatchMediaHelper->expects($this->exactly(2))->method('getSwatchAttributeImage')
- ->withConsecutive(
- ['swatch_image', 'hello'],
- ['swatch_thumb', 'hello']
- )
- ->willReturn('/path');
-
- $this->product->expects($this->exactly(4))->method('getData')
- ->withConsecutive(['swatch_image'], ['image'], ['swatch_image'], ['image'])
- ->will($this->onConsecutiveCalls(null, null, null, null));
-
- $this->imageHelper->expects($this->never())->method('init');
- $this->imageHelper->expects($this->never())->method('resize');
- $this->jsonEncoder->expects($this->once())->method('encode');
-
- $this->configurable->getJsonSwatchConfig();
- }
-
- public function testGetMediaCallback()
- {
- $url = 'http://localhost/' . Configurable::MEDIA_CALLBACK_ACTION;
-
- $this->urlBuilder->expects($this->once())
- ->method('getUrl')
- ->with(Configurable::MEDIA_CALLBACK_ACTION)
- ->willReturn($url);
-
- $this->assertEquals($url, $this->configurable->getMediaCallback());
- }
-}
diff --git a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php
index 6b72422d0501..49dbb5cdc962 100644
--- a/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php
+++ b/app/code/Magento/Swatches/Test/Unit/Block/Product/Renderer/Listing/ConfigurableTest.php
@@ -55,8 +55,8 @@ class ConfigurableTest extends \PHPUnit\Framework\TestCase
/** @var \Magento\Catalog\Helper\Image|\PHPUnit_Framework_MockObject_MockObject */
private $imageHelper;
- /** @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */
- private $urlBuilder;
+ /** @var \Magento\Catalog\Model\Product\Image\UrlBuilder|\PHPUnit_Framework_MockObject_MockObject */
+ private $imageUrlBuilder;
/** @var \PHPUnit_Framework_MockObject_MockObject */
private $variationPricesMock;
@@ -78,7 +78,7 @@ public function setUp()
$this->typeInstance = $this->createMock(\Magento\Catalog\Model\Product\Type\AbstractType::class);
$this->scopeConfig = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
$this->imageHelper = $this->createMock(\Magento\Catalog\Helper\Image::class);
- $this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class);
+ $this->imageUrlBuilder = $this->createMock(\Magento\Catalog\Model\Product\Image\UrlBuilder::class);
$this->variationPricesMock = $this->createMock(
\Magento\ConfigurableProduct\Model\Product\Type\Configurable\Variations\Prices::class
);
@@ -89,7 +89,7 @@ public function setUp()
[
'scopeConfig' => $this->scopeConfig,
'imageHelper' => $this->imageHelper,
- 'urlBuilder' => $this->urlBuilder,
+ 'imageUrlBuilder' => $this->imageUrlBuilder,
'arrayUtils' => $this->arrayUtils,
'jsonEncoder' => $this->jsonEncoder,
'helper' => $this->helper,
diff --git a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php
index 5b3964b9abb3..3029094c9ef4 100644
--- a/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php
+++ b/app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php
@@ -364,8 +364,8 @@ public function testGetProductMediaGallery($mediaGallery, $image)
$this->imageHelperMock->expects($this->any())
->method('init')
->willReturnMap([
- [$this->productMock, 'product_page_image_large_no_frame', [], $this->imageHelperMock],
- [$this->productMock, 'product_page_image_medium_no_frame', [], $this->imageHelperMock],
+ [$this->productMock, 'product_page_image_large', [], $this->imageHelperMock],
+ [$this->productMock, 'product_page_image_medium', [], $this->imageHelperMock],
[$this->productMock, 'product_page_image_small', [], $this->imageHelperMock],
]);
diff --git a/app/code/Magento/Swatches/composer.json b/app/code/Magento/Swatches/composer.json
index f7ec0fcc0db5..71f9fc8f80ba 100644
--- a/app/code/Magento/Swatches/composer.json
+++ b/app/code/Magento/Swatches/composer.json
@@ -19,7 +19,7 @@
},
"suggest": {
"magento/module-layered-navigation": "*",
- "magento/module-swatches-sample-data": "Sample Data version:100.3.*"
+ "magento/module-swatches-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Swatches/etc/adminhtml/system.xml b/app/code/Magento/Swatches/etc/adminhtml/system.xml
index 7c61c240f996..219fa9c913e5 100644
--- a/app/code/Magento/Swatches/etc/adminhtml/system.xml
+++ b/app/code/Magento/Swatches/etc/adminhtml/system.xml
@@ -9,10 +9,10 @@
-
+
-
+
Magento\Config\Model\Config\Source\Yesno
diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json
index 799d784b16aa..a09ebbd53750 100644
--- a/app/code/Magento/Tax/composer.json
+++ b/app/code/Magento/Tax/composer.json
@@ -22,7 +22,7 @@
"magento/module-store": "*"
},
"suggest": {
- "magento/module-tax-sample-data": "Sample Data version:100.3.*"
+ "magento/module-tax-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json
index c1165b4eb98b..0c2b092b8d7d 100644
--- a/app/code/Magento/Theme/composer.json
+++ b/app/code/Magento/Theme/composer.json
@@ -20,7 +20,7 @@
},
"suggest": {
"magento/module-translation": "*",
- "magento/module-theme-sample-data": "Sample Data version:100.3.*",
+ "magento/module-theme-sample-data": "*",
"magento/module-deploy": "*",
"magento/module-directory": "*"
},
diff --git a/app/code/Magento/Ui/Component/Form/Element/DataType/Media/Image.php b/app/code/Magento/Ui/Component/Form/Element/DataType/Media/Image.php
index 130d5037e77f..691c6bfdd420 100644
--- a/app/code/Magento/Ui/Component/Form/Element/DataType/Media/Image.php
+++ b/app/code/Magento/Ui/Component/Form/Element/DataType/Media/Image.php
@@ -72,7 +72,7 @@ public function prepare()
'config' => [
'maxFileSize' => $maxFileSize,
'mediaGallery' => [
- 'openDialogUrl' => $this->getContext()->getUrl('cms/wysiwyg_images/index'),
+ 'openDialogUrl' => $this->getContext()->getUrl('cms/wysiwyg_images/index', ['_secure' => true]),
'openDialogTitle' => $this->getConfiguration()['openDialogTitle'] ?? __('Insert Images...'),
'initialOpenSubpath' => $this->getConfiguration()['initialMediaGalleryOpenSubpath'],
'storeId' => $this->storeManager->getStore()->getId(),
diff --git a/app/code/Magento/Ui/i18n/en_US.csv b/app/code/Magento/Ui/i18n/en_US.csv
index 225d83387563..ed4386f6000c 100644
--- a/app/code/Magento/Ui/i18n/en_US.csv
+++ b/app/code/Magento/Ui/i18n/en_US.csv
@@ -201,3 +201,4 @@ CSV,CSV
"Please enter at least {0} characters.","Please enter at least {0} characters."
"Please enter a value between {0} and {1} characters long.","Please enter a value between {0} and {1} characters long."
"Please enter a value between {0} and {1}.","Please enter a value between {0} and {1}."
+"was not uploaded","was not uploaded"
\ No newline at end of file
diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js
index bbac27141ba2..b583d0be69f3 100644
--- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js
+++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js
@@ -13,13 +13,16 @@ define([
'Magento_Ui/js/modal/alert',
'Magento_Ui/js/lib/validation/validator',
'Magento_Ui/js/form/element/abstract',
+ 'mage/backend/notification',
+ 'mage/translate',
'jquery/file-uploader'
-], function ($, _, utils, uiAlert, validator, Element) {
+], function ($, _, utils, uiAlert, validator, Element, notification, $t) {
'use strict';
return Element.extend({
defaults: {
value: [],
+ aggregatedErrors: [],
maxFileSize: false,
isMultipleFiles: false,
placeholderType: 'document', // 'image', 'video'
@@ -278,9 +281,15 @@ define([
* @returns {FileUploader} Chainable.
*/
notifyError: function (msg) {
- uiAlert({
+ var data = {
content: msg
- });
+ };
+
+ if (this.isMultipleFiles) {
+ data.modalClass = '_image-box';
+ }
+
+ uiAlert(data);
return this;
},
@@ -309,13 +318,19 @@ define([
},
/**
- * Abstract handler which is invoked when files are choosed for upload.
+ * Handler which is invoked when files are choosed for upload.
* May be used for implementation of aditional validation rules,
* e.g. total files and a total size rules.
*
- * @abstract
+ * @param {Event} e - Event object.
+ * @param {Object} data - File data that will be uploaded.
*/
- onFilesChoosed: function () {},
+ onFilesChoosed: function (e, data) {
+ // no option exists in fileuploader for restricting upload chains to single files; this enforces that policy
+ if (!this.isMultipleFiles) {
+ data.files.splice(1);
+ }
+ },
/**
* Handler which is invoked prior to the start of a file upload.
@@ -337,10 +352,28 @@ define([
data.submit();
});
} else {
- this.notifyError(allowed.message);
+ this.aggregateError(file.name, allowed.message);
+
+ // if all files in upload chain are invalid, stop callback is never called; this resolves promise
+ if (this.aggregatedErrors.length === data.originalFiles.length) {
+ this.uploaderConfig.stop();
+ }
}
},
+ /**
+ * Add error message associated with filename for display when upload chain is complete
+ *
+ * @param {String} filename
+ * @param {String} message
+ */
+ aggregateError: function (filename, message) {
+ this.aggregatedErrors.push({
+ filename: filename,
+ message: message
+ });
+ },
+
/**
* Handler of the file upload complete event.
*
@@ -348,11 +381,12 @@ define([
* @param {Object} data
*/
onFileUploaded: function (e, data) {
- var file = data.result,
+ var uploadedFilename = data.files[0].name,
+ file = data.result,
error = file.error;
error ?
- this.notifyError(error) :
+ this.aggregateError(uploadedFilename, error) :
this.addFile(file);
},
@@ -367,7 +401,45 @@ define([
* Load stop event handler.
*/
onLoadingStop: function () {
+ var aggregatedErrorMessages = [];
+
this.isLoading = false;
+
+ if (!this.aggregatedErrors.length) {
+ return;
+ }
+
+ if (!this.isMultipleFiles) { // only single file upload occurred; use first file's error message
+ aggregatedErrorMessages.push(this.aggregatedErrors[0].message);
+ } else { // construct message from all aggregatedErrors
+ _.each(this.aggregatedErrors, function (error) {
+ notification().add({
+ error: true,
+ message: '%s' + error.message, // %s to be used as placeholder for html injection
+
+ /**
+ * Adds constructed error notification to aggregatedErrorMessages
+ *
+ * @param {String} constructedMessage
+ */
+ insertMethod: function (constructedMessage) {
+ var errorMsgBodyHtml = '%s %s.
'
+ .replace('%s', error.filename)
+ .replace('%s', $t('was not uploaded'));
+
+ // html is escaped in message body for notification widget; prepend unescaped html here
+ constructedMessage = constructedMessage.replace('%s', errorMsgBodyHtml);
+
+ aggregatedErrorMessages.push(constructedMessage);
+ }
+ });
+ });
+ }
+
+ this.notifyError(aggregatedErrorMessages.join(''));
+
+ // clear out aggregatedErrors array for this completed upload chain
+ this.aggregatedErrors = [];
},
/**
diff --git a/app/code/Magento/Ups/etc/adminhtml/system.xml b/app/code/Magento/Ups/etc/adminhtml/system.xml
index 07bfaeea6337..f427c5960123 100644
--- a/app/code/Magento/Ups/etc/adminhtml/system.xml
+++ b/app/code/Magento/Ups/etc/adminhtml/system.xml
@@ -106,7 +106,7 @@
Magento\Config\Model\Config\Source\Yesno
-
+
Magento\Ups\Model\Config\Source\Unitofmeasure
diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php
index a5dd6ac2e781..29618c981a2b 100644
--- a/app/code/Magento/User/Model/User.php
+++ b/app/code/Magento/User/Model/User.php
@@ -48,6 +48,8 @@ class User extends AbstractModel implements StorageInterface, UserInterface
/** @deprecated */
const XML_PATH_RESET_PASSWORD_TEMPLATE = 'admin/emails/reset_password_template';
+ const MESSAGE_ID_PASSWORD_EXPIRED = 'magento_user_password_expired';
+
/**
* Model event prefix
*
diff --git a/app/code/Magento/User/Observer/Backend/AuthObserver.php b/app/code/Magento/User/Observer/Backend/AuthObserver.php
index 6021302a5aeb..06b15a477d84 100644
--- a/app/code/Magento/User/Observer/Backend/AuthObserver.php
+++ b/app/code/Magento/User/Observer/Backend/AuthObserver.php
@@ -152,7 +152,7 @@ public function execute(EventObserver $observer)
/**
* Update locking information for the user
*
- * @param \Magento\User\Model\User $user
+ * @param User $user
* @return void
*/
private function _updateLockingInformation($user)
@@ -198,10 +198,16 @@ private function _checkExpiredPassword($latestPassword)
$myAccountUrl = $this->url->getUrl('adminhtml/system_account/');
$message = __('It\'s time to change your password.', $myAccountUrl);
}
+
+ $messages = $this->messageManager->getMessages();
+
+ // Remove existing messages with same ID to avoid duplication
+ $messages->deleteMessageByIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED);
+
$this->messageManager->addNoticeMessage($message);
- $message = $this->messageManager->getMessages()->getLastAddedMessage();
+ $message = $messages->getLastAddedMessage();
if ($message) {
- $message->setIdentifier('magento_user_password_expired')->setIsSticky(true);
+ $message->setIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED)->setIsSticky(true);
$this->authSession->setPciAdminUserIsPasswordExpired(true);
}
}
diff --git a/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php b/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php
index 09605372df18..059879ab9613 100644
--- a/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php
+++ b/app/code/Magento/User/Observer/Backend/TrackAdminNewPasswordObserver.php
@@ -8,6 +8,7 @@
use Magento\Framework\Event\Observer as EventObserver;
use Magento\Framework\Event\ObserverInterface;
+use Magento\User\Model\User;
/**
* User backend observer model for passwords
@@ -74,7 +75,7 @@ public function execute(EventObserver $observer)
$passwordHash = $user->getPassword();
if ($passwordHash && !$user->getForceNewPassword()) {
$this->userResource->trackPassword($user, $passwordHash);
- $this->messageManager->getMessages()->deleteMessageByIdentifier('magento_user_password_expired');
+ $this->messageManager->getMessages()->deleteMessageByIdentifier(User::MESSAGE_ID_PASSWORD_EXPIRED);
$this->authSession->unsPciAdminUserIsPasswordExpired();
}
}
diff --git a/app/code/Magento/Weee/etc/db_schema.xml b/app/code/Magento/Weee/etc/db_schema.xml
index 71d957ecaf5b..96c3be9740e5 100644
--- a/app/code/Magento/Weee/etc/db_schema.xml
+++ b/app/code/Magento/Weee/etc/db_schema.xml
@@ -48,7 +48,7 @@
-
+
diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json
index d8ca681af3fd..f0b0121ac60c 100644
--- a/app/code/Magento/Widget/composer.json
+++ b/app/code/Magento/Widget/composer.json
@@ -15,7 +15,7 @@
"magento/module-variable": "*"
},
"suggest": {
- "magento/module-widget-sample-data": "Sample Data version:100.3.*"
+ "magento/module-widget-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php
index 0a4f09227f88..8b4a8df1bf99 100644
--- a/app/code/Magento/Wishlist/Block/AbstractBlock.php
+++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php
@@ -6,6 +6,11 @@
namespace Magento\Wishlist\Block;
+use Magento\Catalog\Helper\Image;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
+use Magento\Framework\View\ConfigInterface;
+use Magento\Framework\App\ObjectManager;
+
/**
* Wishlist Product Items abstract Block
*/
@@ -30,21 +35,37 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd
*/
protected $httpContext;
+ /**
+ * @var ConfigInterface
+ */
+ private $viewConfig;
+
+ /**
+ * @var UrlBuilder
+ */
+ private $imageUrlBuilder;
+
/**
* @param \Magento\Catalog\Block\Product\Context $context
* @param \Magento\Framework\App\Http\Context $httpContext
* @param array $data
+ * @param ConfigInterface|null $config
+ * @param UrlBuilder|null $urlBuilder
*/
public function __construct(
\Magento\Catalog\Block\Product\Context $context,
\Magento\Framework\App\Http\Context $httpContext,
- array $data = []
+ array $data = [],
+ ConfigInterface $config = null,
+ UrlBuilder $urlBuilder = null
) {
$this->httpContext = $httpContext;
parent::__construct(
$context,
$data
);
+ $this->viewConfig = $config ?? ObjectManager::getInstance()->get(ConfigInterface::class);
+ $this->imageUrlBuilder = $urlBuilder ?? ObjectManager::getInstance()->get(UrlBuilder::class);
}
/**
@@ -288,7 +309,15 @@ public function getProductUrl($item, $additional = [])
*/
public function getImageUrl($product)
{
- return $this->_imageHelper->init($product, 'wishlist_small_image')->getUrl();
+ $viewImageConfig = $this->viewConfig->getViewConfig()->getMediaAttributes(
+ 'Magento_Catalog',
+ Image::MEDIA_TYPE_CONFIG_NODE,
+ 'wishlist_small_image'
+ );
+ return $this->imageUrlBuilder->getUrl(
+ $product->getData($viewImageConfig['type']),
+ 'wishlist_small_image'
+ );
}
/**
diff --git a/app/code/Magento/Wishlist/CustomerData/Wishlist.php b/app/code/Magento/Wishlist/CustomerData/Wishlist.php
index 14d651f43afd..9583a83a3942 100644
--- a/app/code/Magento/Wishlist/CustomerData/Wishlist.php
+++ b/app/code/Magento/Wishlist/CustomerData/Wishlist.php
@@ -153,9 +153,7 @@ protected function getImageData($product)
$helper = $this->imageHelperFactory->create()
->init($product, 'wishlist_sidebar_block');
- $template = $helper->getFrame()
- ? 'Magento_Catalog/product/image'
- : 'Magento_Catalog/product/image_with_borders';
+ $template = 'Magento_Catalog/product/image_with_borders';
try {
$imagesize = $helper->getResizedImageInfo();
diff --git a/app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php b/app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php
index 027860fe01ab..e1fafe35e43f 100644
--- a/app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php
+++ b/app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php
@@ -7,15 +7,51 @@
use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
use Magento\Catalog\Pricing\Price\ConfiguredPriceInterface;
-use Magento\Catalog\Pricing\Price\FinalPrice;
+use Magento\Framework\Pricing\Price\AbstractPrice;
-class ConfigurableProduct extends FinalPrice implements ConfiguredPriceInterface
+/**
+ * Pricing configuration of wishlist product.
+ */
+class ConfigurableProduct extends AbstractPrice
{
+ /**
+ * Price type final.
+ */
+ const PRICE_CODE = 'final_price';
+
/**
* @var ItemInterface
*/
private $item;
+ /**
+ * Get Configured Price Amount object by price type.
+ *
+ * @return \Magento\Framework\Pricing\Amount\AmountInterface
+ */
+ public function getConfiguredAmount(): \Magento\Framework\Pricing\Amount\AmountInterface
+ {
+ /** @var \Magento\Wishlist\Model\Item\Option $customOption */
+ $customOption = $this->getProduct()->getCustomOption('simple_product');
+ $product = $customOption ? $customOption->getProduct() : $this->getProduct();
+
+ return $product->getPriceInfo()->getPrice(ConfiguredPriceInterface::CONFIGURED_PRICE_CODE)->getAmount();
+ }
+
+ /**
+ * Get Configured Regular Price Amount object by price type.
+ *
+ * @return \Magento\Framework\Pricing\Amount\AmountInterface
+ */
+ public function getConfiguredRegularAmount(): \Magento\Framework\Pricing\Amount\AmountInterface
+ {
+ /** @var \Magento\Wishlist\Model\Item\Option $customOption */
+ $customOption = $this->getProduct()->getCustomOption('simple_product');
+ $product = $customOption ? $customOption->getProduct() : $this->getProduct();
+
+ return $product->getPriceInfo()->getPrice(ConfiguredPriceInterface::CONFIGURED_REGULAR_PRICE_CODE)->getAmount();
+ }
+
/**
* @inheritdoc
*/
diff --git a/app/code/Magento/Wishlist/Test/Unit/Block/Customer/SidebarTest.php b/app/code/Magento/Wishlist/Test/Unit/Block/Customer/SidebarTest.php
index f53f299c4a40..92c36470d7f7 100644
--- a/app/code/Magento/Wishlist/Test/Unit/Block/Customer/SidebarTest.php
+++ b/app/code/Magento/Wishlist/Test/Unit/Block/Customer/SidebarTest.php
@@ -46,9 +46,14 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
- $this->block = new Sidebar(
- $this->productContext,
- $this->httpContext
+ $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+
+ $this->block = $objectManager->getObject(
+ Sidebar::class,
+ [
+ 'context' => $this->productContext,
+ 'httpContext' => $this->httpContext
+ ]
);
}
diff --git a/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php b/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php
index be31cb8f8d0c..d2e81b0236ce 100644
--- a/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php
+++ b/app/code/Magento/Wishlist/Test/Unit/CustomerData/WishlistTest.php
@@ -93,7 +93,7 @@ public function testGetSectionData()
'items' => [
[
'image' => [
- 'template' => 'Magento_Catalog/product/image',
+ 'template' => 'Magento_Catalog/product/image_with_borders',
'src' => $imageUrl,
'alt' => $imageLabel,
'width' => $imageWidth,
@@ -278,7 +278,7 @@ public function testGetSectionDataWithTwoItems()
'items' => [
[
'image' => [
- 'template' => 'Magento_Catalog/product/image',
+ 'template' => 'Magento_Catalog/product/image_with_borders',
'src' => $imageUrl,
'alt' => $imageLabel,
'width' => $imageWidth,
@@ -296,7 +296,7 @@ public function testGetSectionDataWithTwoItems()
],
[
'image' => [
- 'template' => 'Magento_Catalog/product/image',
+ 'template' => 'Magento_Catalog/product/image_with_borders',
'src' => $imageUrl,
'alt' => $imageLabel,
'width' => $imageWidth,
diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json
index 57073ed25721..ce43f6faae20 100644
--- a/app/code/Magento/Wishlist/composer.json
+++ b/app/code/Magento/Wishlist/composer.json
@@ -23,7 +23,7 @@
"magento/module-bundle": "*",
"magento/module-cookie": "*",
"magento/module-grouped-product": "*",
- "magento/module-wishlist-sample-data": "Sample Data version:100.3.*"
+ "magento/module-wishlist-sample-data": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/Wishlist/view/base/layout/catalog_product_prices.xml b/app/code/Magento/Wishlist/view/base/layout/catalog_product_prices.xml
index e80ef742079a..5755b80f1def 100644
--- a/app/code/Magento/Wishlist/view/base/layout/catalog_product_prices.xml
+++ b/app/code/Magento/Wishlist/view/base/layout/catalog_product_prices.xml
@@ -16,6 +16,20 @@
+
+ -
+
-
+
- Magento_Wishlist::product/price/configurable/configured_price.phtml
+
+
+
+
+ -
+
-
+
- Magento_Wishlist::product/price/bundle/configured_price.phtml
+
+
+
diff --git a/app/code/Magento/Wishlist/view/base/templates/product/price/bundle/configured_price.phtml b/app/code/Magento/Wishlist/view/base/templates/product/price/bundle/configured_price.phtml
new file mode 100644
index 000000000000..260dd5a24396
--- /dev/null
+++ b/app/code/Magento/Wishlist/view/base/templates/product/price/bundle/configured_price.phtml
@@ -0,0 +1,57 @@
+
+getZone() == 'item_view');
+$idSuffix = $block->getIdSuffix() ?: '';
+?>
+hasSpecialPrice()) : ?>
+
+
+ = /* @noEscape */ $block->renderAmount(
+ $block->getConfiguredPrice()->getAmount(),
+ [
+ 'display_label' => $block->escapeHtml(__('Special Price')),
+ 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)),
+ 'price_type' => 'finalPrice',
+ 'include_container' => true,
+ 'schema' => $schema,
+ ]
+ ); ?>
+
+
+ = /* @noEscape */ $block->renderAmount(
+ $block->getConfiguredRegularPrice()->getAmount(),
+ [
+ 'display_label' => $block->escapeHtml(__('Regular Price')),
+ 'price_id' => $block->escapeHtml($block->getPriceId('old-price-' . $idSuffix)),
+ 'price_type' => 'oldPrice',
+ 'include_container' => true,
+ 'skip_adjustments' => true,
+ ]
+ ); ?>
+
+
+
+ getPriceLabel() !== null)
+ ? $block->getPriceLabel()
+ : '';
+ ?>
+
+ = /* @noEscape */ $block->renderAmount(
+ $block->getConfiguredPrice()->getAmount(),
+ [
+ 'display_label' => $block->escapeHtml($priceLabel),
+ 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)),
+ 'price_type' => 'finalPrice',
+ 'include_container' => true,
+ 'schema' => $schema,
+ ]
+ ); ?>
+
+
diff --git a/app/code/Magento/Wishlist/view/base/templates/product/price/configurable/configured_price.phtml b/app/code/Magento/Wishlist/view/base/templates/product/price/configurable/configured_price.phtml
new file mode 100644
index 000000000000..f9517a106a79
--- /dev/null
+++ b/app/code/Magento/Wishlist/view/base/templates/product/price/configurable/configured_price.phtml
@@ -0,0 +1,62 @@
+
+getZone() == 'item_view');
+$idSuffix = $block->getIdSuffix() ?: '';
+/** @var \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct $configuredPrice */
+$configuredPrice = $block->getPrice();
+$configuredRegularAmountValue = $configuredPrice->getConfiguredRegularAmount()->getValue();
+?>
+hasSpecialPrice()
+ && $configuredRegularAmountValue
+ && $configuredPrice->getConfiguredAmount()->getValue() !== $configuredRegularAmountValue) : ?>
+
+
+ = /* @noEscape */ $block->renderAmount(
+ $configuredPrice->getConfiguredAmount(),
+ [
+ 'display_label' => $block->escapeHtml(__('Special Price')),
+ 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)),
+ 'price_type' => 'finalPrice',
+ 'include_container' => true,
+ 'schema' => $schema,
+ ]
+ ); ?>
+
+
+ = /* @noEscape */ $block->renderAmount(
+ $configuredPrice->getConfiguredRegularAmount(),
+ [
+ 'display_label' => $block->escapeHtml(__('Regular Price')),
+ 'price_id' => $block->escapeHtml($block->getPriceId('old-price-' . $idSuffix)),
+ 'price_type' => 'oldPrice',
+ 'include_container' => true,
+ 'skip_adjustments' => true,
+ ]
+ ); ?>
+
+
+
+ getPriceLabel() !== null)
+ ? $block->getPriceLabel()
+ : '';
+ ?>
+
+ = /* @noEscape */ $block->renderAmount(
+ $configuredPrice->getAmount(),
+ [
+ 'display_label' => $block->escapeHtml($priceLabel),
+ 'price_id' => $block->escapeHtml($block->getPriceId('product-price-' . $idSuffix)),
+ 'price_type' => 'finalPrice',
+ 'include_container' => true,
+ 'schema' => $schema,
+ ]
+ ); ?>
+
+
diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less
index 63d97dc52e45..95d7f8f65fdc 100644
--- a/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less
+++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_modals_extend.less
@@ -80,7 +80,7 @@
&.confirm,
&.prompt {
.modal-inner-wrap {
- .message {
+ .message:not(.message-error) {
background: @modal-popup-colorless__background;
}
}
diff --git a/app/design/frontend/Magento/blank/etc/view.xml b/app/design/frontend/Magento/blank/etc/view.xml
index 78fb54c0b54e..572632b6683e 100644
--- a/app/design/frontend/Magento/blank/etc/view.xml
+++ b/app/design/frontend/Magento/blank/etc/view.xml
@@ -73,22 +73,23 @@
140
-
- false
-
700
700
-
- 700
- 700
- false
-
90
90
+
+
+ 240
+ 300
+
+
+ 88
+ 110
+
700
700
diff --git a/app/design/frontend/Magento/luma/etc/view.xml b/app/design/frontend/Magento/luma/etc/view.xml
index 08e6883da995..41d565789c25 100644
--- a/app/design/frontend/Magento/luma/etc/view.xml
+++ b/app/design/frontend/Magento/luma/etc/view.xml
@@ -77,22 +77,23 @@
140
-
- false
-
- 700
- 560
-
-
700
700
- false
88
110
+
+
+ 240
+ 300
+
+
+ 88
+ 110
+
700
560
diff --git a/app/design/frontend/Magento/rush/etc/view.xml b/app/design/frontend/Magento/rush/etc/view.xml
index cb963250c5e6..1b62c30fa9c4 100644
--- a/app/design/frontend/Magento/rush/etc/view.xml
+++ b/app/design/frontend/Magento/rush/etc/view.xml
@@ -74,18 +74,10 @@
140
-
- false
-
700
700
-
- 700
- 700
- false
-
90
90
@@ -98,6 +90,15 @@
700
700
+
+
+ 240
+ 300
+
+
+ 88
+ 110
+
90
90
diff --git a/app/etc/di.xml b/app/etc/di.xml
index 986652bc6baf..17850b089d60 100755
--- a/app/etc/di.xml
+++ b/app/etc/di.xml
@@ -1472,8 +1472,8 @@
- Magento\Framework\Setup\Declaration\Schema\Operations\ReCreateTable
- - Magento\Framework\Setup\Declaration\Schema\Operations\DropTable
- Magento\Framework\Setup\Declaration\Schema\Operations\CreateTable
+ - Magento\Framework\Setup\Declaration\Schema\Operations\DropTable
- Magento\Framework\Setup\Declaration\Schema\Operations\DropReference
- Magento\Framework\Setup\Declaration\Schema\Operations\ModifyColumn
- Magento\Framework\Setup\Declaration\Schema\Operations\AddColumn
@@ -1547,9 +1547,14 @@
\Magento\Framework\Setup\Patch\SchemaPatchReader
-
+
+
+ \Magento\Framework\Setup\Patch\DataPatchReader
+
+
+
- \Magento\Framework\Setup\Patch\DataPatchReader
+ \Magento\Framework\Setup\Patch\SchemaPatchReader
@@ -1658,6 +1663,13 @@
+
+
+
+ - Magento\Framework\Setup\Declaration\Schema\Db\MySQL\DDL\Triggers\MigrateDataFromAnotherTable
+
+
+
diff --git a/dev/tests/acceptance/RoboFile.php b/dev/tests/acceptance/RoboFile.php
index be9be5a2cc87..dd84b4131e50 100644
--- a/dev/tests/acceptance/RoboFile.php
+++ b/dev/tests/acceptance/RoboFile.php
@@ -4,6 +4,8 @@
* See COPYING.txt for license details.
*/
+use Symfony\Component\Yaml\Yaml;
+
/** This is project's console commands configuration for Robo task runner.
*
* @codingStandardsIgnoreStart
@@ -13,6 +15,12 @@ class RoboFile extends \Robo\Tasks
{
use Robo\Task\Base\loadShortcuts;
+ public function __construct()
+ {
+ require 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
+ define('VENDOR_BIN_PATH', PROJECT_ROOT . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR);
+
+ }
/**
* Duplicate the Example configuration files used to customize the Project for customization.
*
@@ -25,6 +33,66 @@ function cloneFiles()
$this->_exec('cp -vf tests'. DIRECTORY_SEPARATOR .'functional.suite.dist.yml tests'. DIRECTORY_SEPARATOR .'functional.suite.yml');
}
+ /**
+ * Finds relative paths between codeception.yml file and MFTF path, and overwrites the default paths.
+ *
+ * @return void
+ */
+ private function buildCodeceptionPaths()
+ {
+ $relativePathFunc = function ($from, $to)
+ {
+ $from = is_dir($from) ? rtrim($from, '\/') . '/' : $from;
+ $to = is_dir($to) ? rtrim($to, '\/') . '/' : $to;
+ $from = str_replace('\\', '/', $from);
+ $to = str_replace('\\', '/', $to);
+
+ $from = explode('/', $from);
+ $to = explode('/', $to);
+ $relPath = $to;
+
+ foreach($from as $depth => $dir) {
+ // find first non-matching dir
+ if($dir === $to[$depth]) {
+ // ignore this directory
+ array_shift($relPath);
+ } else {
+ // get number of remaining dirs to $from
+ $remaining = count($from) - $depth;
+ if($remaining > 1) {
+ // add traversals up to first matching dir
+ $padLength = (count($relPath) + $remaining - 1) * -1;
+ $relPath = array_pad($relPath, $padLength, '..');
+ break;
+ } else {
+ $relPath[0] = './' . $relPath[0];
+ }
+ }
+ }
+ return implode('/', $relPath);
+ };
+
+ //Find travel path from codeception.yml to FW_BP
+ $configYmlPath = dirname(dirname(TESTS_BP)) . DIRECTORY_SEPARATOR;
+ $relativePath = call_user_func($relativePathFunc, $configYmlPath, FW_BP);
+ $configYmlFile = $configYmlPath . "codeception.yml";
+ $defaultConfigYmlFile = $configYmlPath . "codeception.dist.yml";
+
+ if (file_exists($configYmlFile)) {
+ $ymlContents = file_get_contents($configYmlFile);
+ } else {
+ $ymlContents = file_get_contents($defaultConfigYmlFile);
+ }
+ $ymlArray = Yaml::parse($ymlContents) ?? [];
+ if (!array_key_exists("paths", $ymlArray)) {
+ $ymlArray["paths"] = [];
+ }
+ $ymlArray["paths"]["support"] = $relativePath . 'src/Magento/FunctionalTestingFramework';
+ $ymlArray["paths"]["envs"] = $relativePath . 'etc/_envs';
+ $ymlText = Yaml::dump($ymlArray, 10);
+ file_put_contents($configYmlFile, $ymlText);
+ }
+
/**
* Duplicate the Example configuration files for the Project.
* Build the Codeception project.
@@ -34,29 +102,110 @@ function cloneFiles()
function buildProject()
{
$this->cloneFiles();
- $this->_exec('vendor'. DIRECTORY_SEPARATOR .'bin'. DIRECTORY_SEPARATOR .'codecept build');
+ $this->buildCodeceptionPaths();
+ $this->_exec(VENDOR_BIN_PATH .'codecept build');
}
/**
- * Generate all Tests in PHP.
+ * Generate all Tests in PHP OR Generate set of tests via passing array of tests
*
+ * @param array $tests
* @param array $opts
* @return void
*/
- function generateTests($opts = ['config' => null, 'force' => false, 'nodes' => null])
+ function generateTests(array $tests, $opts = [
+ 'config' => null,
+ 'force' => false,
+ 'nodes' => null,
+ 'lines' => 500,
+ 'tests' => null
+ ])
{
- $GLOBALS['GENERATE_TESTS'] = true;
+ require 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
+ $testConfiguration = $this->createTestConfiguration($tests, $opts);
- if ($opts['force'])
- {
- $GLOBALS['FORCE_PHP_GENERATE'] = true;
+ // maintain backwards compatability for devops by not removing the nodes option yet
+ $lines = $opts['lines'];
+
+ // create our manifest file here
+ $testManifest = \Magento\FunctionalTestingFramework\Util\Manifest\TestManifestFactory::makeManifest($opts['config'],$testConfiguration['suites']);
+ \Magento\FunctionalTestingFramework\Util\TestGenerator::getInstance(null, $testConfiguration['tests'])->createAllTestFiles($testManifest);
+
+ if ($opts['config'] == 'parallel') {
+ $testManifest->createTestGroups($lines);
}
- require 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
- \Magento\FunctionalTestingFramework\Util\TestGenerator::getInstance()->createAllTestFiles($opts['config'], $opts['nodes']);
+ \Magento\FunctionalTestingFramework\Suite\SuiteGenerator::getInstance()->generateAllSuites($testManifest);
+ $testManifest->generate();
+
$this->say("Generate Tests Command Run");
}
+
+ /**
+ * Function which builds up a configuration including test and suites for consumption of Magento generation methods.
+ *
+ * @param array $tests
+ * @param array $opts
+ * @return array
+ */
+ private function createTestConfiguration($tests, $opts)
+ {
+ // set our application configuration so we can references the user options in our framework
+ Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::create(
+ $opts['force'],
+ Magento\FunctionalTestingFramework\Config\MftfApplicationConfig::GENERATION_PHASE,
+ $opts['verbose']
+ );
+
+ $testConfiguration = [];
+ $testConfiguration['tests'] = $tests;
+ $testConfiguration['suites'] = [];
+
+ $testConfiguration = $this->parseTestsConfigJson($opts['tests'], $testConfiguration);
+
+ // if we have references to specific tests, we resolve the test objects and pass them to the config
+ if (!empty($testConfiguration['tests']))
+ {
+ $testObjects = [];
+
+ foreach ($testConfiguration['tests'] as $test)
+ {
+ $testObjects[$test] = Magento\FunctionalTestingFramework\Test\Handlers\TestObjectHandler::getInstance()->getObject($test);
+ }
+
+ $testConfiguration['tests'] = $testObjects;
+ }
+
+ return $testConfiguration;
+ }
+
+ /**
+ * Function which takes a json string of potential custom configuration and parses/validates the resulting json
+ * passed in by the user. The result is a testConfiguration array.
+ *
+ * @param string $json
+ * @param array $testConfiguration
+ * @return array
+ */
+ private function parseTestsConfigJson($json, $testConfiguration) {
+ if ($json == null) {
+ return $testConfiguration;
+ }
+
+ $jsonTestConfiguration = [];
+ $testConfigArray = json_decode($json, true);
+
+ // stop execution if we have failed to properly parse any json
+ if (json_last_error() != JSON_ERROR_NONE) {
+ throw new \Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException("JSON could not be parsed: " . json_last_error_msg());
+ }
+
+ $jsonTestConfiguration['tests'] = $testConfigArray['tests'] ?? null;;
+ $jsonTestConfiguration['suites'] = $testConfigArray['suites'] ?? null;
+ return $jsonTestConfiguration;
+ }
+
/**
* Generate a suite based on name(s) passed in as args.
*
@@ -70,7 +219,6 @@ function generateSuite(array $args)
throw new Exception("Please provide suite name(s) after generate:suite command");
}
- require 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
$sg = \Magento\FunctionalTestingFramework\Suite\SuiteGenerator::getInstance();
foreach ($args as $arg) {
@@ -85,18 +233,18 @@ function generateSuite(array $args)
*/
function functional()
{
- $this->_exec('.' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'codecept run functional --skip-group skip');
+ $this->_exec(VENDOR_BIN_PATH . 'codecept run functional');
}
/**
- * Run all Tests with the specified @group tag, excluding @group 'skip'.
+ * Run all Tests with the specified @group tag'.
*
* @param string $args
* @return void
*/
function group($args = '')
{
- $this->taskExec('.' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'codecept run functional --verbose --steps --skip-group skip --group')->args($args)->run();
+ $this->taskExec(VENDOR_BIN_PATH . 'codecept run functional --verbose --steps --group')->args($args)->run();
}
/**
@@ -107,7 +255,7 @@ function group($args = '')
*/
function folder($args = '')
{
- $this->taskExec('.' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'codecept run functional')->args($args)->run();
+ $this->taskExec(VENDOR_BIN_PATH . 'codecept run functional')->args($args)->run();
}
/**
@@ -117,7 +265,7 @@ function folder($args = '')
*/
function example()
{
- $this->_exec('.' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'codecept run --group example --skip-group skip');
+ $this->_exec(VENDOR_BIN_PATH . 'codecept run --group example');
}
/**
diff --git a/dev/tests/acceptance/codeception.dist.yml b/dev/tests/acceptance/codeception.dist.yml
index 207671b27a15..683edcb107fd 100644
--- a/dev/tests/acceptance/codeception.dist.yml
+++ b/dev/tests/acceptance/codeception.dist.yml
@@ -5,8 +5,8 @@ paths:
tests: tests
log: tests/_output
data: tests/_data
- support: vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework
- envs: vendor/magento/magento2-functional-testing-framework/etc/_envs
+ support: "%REPLACED IN BUILD:PROJECT%"
+ envs: "%REPLACED IN BUILD:PROJECT%"
settings:
bootstrap: _bootstrap.php
colors: true
@@ -14,7 +14,8 @@ settings:
extensions:
enabled:
- Codeception\Extension\RunFailed
- - Yandex\Allure\Adapter\AllureAdapter
+ - Magento\FunctionalTestingFramework\Extension\TestContextExtension
+ - Magento\FunctionalTestingFramework\Allure\Adapter\MagentoAllureAdapter
config:
Yandex\Allure\Adapter\AllureAdapter:
deletePreviousResults: true
diff --git a/dev/tests/acceptance/composer.json b/dev/tests/acceptance/composer.json
index 8d8a3f56921b..787d2579e03c 100755
--- a/dev/tests/acceptance/composer.json
+++ b/dev/tests/acceptance/composer.json
@@ -16,14 +16,8 @@
}
],
"require": {
- "allure-framework/allure-codeception": "~1.2.6",
- "codeception/codeception": "~2.3.4",
- "consolidation/robo": "^1.0.0",
- "symfony/process": ">=2.7 <3.4",
- "henrikbjorn/lurker": "^1.2",
- "magento/magento2-functional-testing-framework": "~2.1.1",
"php": "~7.1.3||~7.2.0",
- "vlucas/phpdotenv": "~2.4"
+ "magento/magento2-functional-testing-framework": "~2.2.0"
},
"autoload": {
"psr-4": {
diff --git a/dev/tests/acceptance/composer.lock b/dev/tests/acceptance/composer.lock
index 0870217c962c..afe2640b442f 100644
--- a/dev/tests/acceptance/composer.lock
+++ b/dev/tests/acceptance/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "2771fad0a15e2894a259dca0ced002f3",
+ "content-hash": "9f292f6e226938ad82d1189da7aa4024",
"packages": [
{
"name": "allure-framework/allure-codeception",
- "version": "1.2.6",
+ "version": "1.2.7",
"source": {
"type": "git",
"url": "https://github.com/allure-framework/allure-codeception.git",
- "reference": "e2672e57e6839edb770fa5de5f2b3fcc47917aa1"
+ "reference": "48598f4b4603b50b663bfe977260113a40912131"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/allure-framework/allure-codeception/zipball/e2672e57e6839edb770fa5de5f2b3fcc47917aa1",
- "reference": "e2672e57e6839edb770fa5de5f2b3fcc47917aa1",
+ "url": "https://api.github.com/repos/allure-framework/allure-codeception/zipball/48598f4b4603b50b663bfe977260113a40912131",
+ "reference": "48598f4b4603b50b663bfe977260113a40912131",
"shasum": ""
},
"require": {
@@ -55,7 +55,7 @@
"steps",
"testing"
],
- "time": "2017-12-27T11:38:21+00:00"
+ "time": "2018-03-07T11:18:27+00:00"
},
{
"name": "allure-framework/allure-php-api",
@@ -170,20 +170,21 @@
},
{
"name": "codeception/codeception",
- "version": "2.3.7",
+ "version": "2.3.9",
"source": {
"type": "git",
"url": "https://github.com/Codeception/Codeception.git",
- "reference": "151de88277878adc18784ef3eaddd87f4a2fdc14"
+ "reference": "104f46fa0bde339f1bcc3a375aac21eb36e65a1e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeception/Codeception/zipball/151de88277878adc18784ef3eaddd87f4a2fdc14",
- "reference": "151de88277878adc18784ef3eaddd87f4a2fdc14",
+ "url": "https://api.github.com/repos/Codeception/Codeception/zipball/104f46fa0bde339f1bcc3a375aac21eb36e65a1e",
+ "reference": "104f46fa0bde339f1bcc3a375aac21eb36e65a1e",
"shasum": ""
},
"require": {
"behat/gherkin": "~4.4.0",
+ "codeception/stub": "^1.0",
"ext-json": "*",
"ext-mbstring": "*",
"facebook/webdriver": ">=1.1.3 <2.0",
@@ -192,7 +193,6 @@
"php": ">=5.4.0 <8.0",
"phpunit/php-code-coverage": ">=2.2.4 <6.0",
"phpunit/phpunit": ">=4.8.28 <5.0.0 || >=5.6.3 <7.0",
- "phpunit/phpunit-mock-objects": ">2.3 <5.0",
"sebastian/comparator": ">1.1 <3.0",
"sebastian/diff": ">=1.4 <3.0",
"symfony/browser-kit": ">=2.7 <5.0",
@@ -207,8 +207,6 @@
"codeception/specify": "~0.3",
"facebook/graph-sdk": "~5.3",
"flow/jsonpath": "~0.2",
- "league/factory-muffin": "^3.0",
- "league/factory-muffin-faker": "^1.0",
"monolog/monolog": "~1.8",
"pda/pheanstalk": "~3.0",
"php-amqplib/php-amqplib": "~2.4",
@@ -262,20 +260,53 @@
"functional testing",
"unit testing"
],
- "time": "2017-12-12T04:22:17+00:00"
+ "time": "2018-02-26T23:29:41+00:00"
+ },
+ {
+ "name": "codeception/stub",
+ "version": "1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Codeception/Stub.git",
+ "reference": "95fb7a36b81890dd2e5163e7ab31310df6f1bb99"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Codeception/Stub/zipball/95fb7a36b81890dd2e5163e7ab31310df6f1bb99",
+ "reference": "95fb7a36b81890dd2e5163e7ab31310df6f1bb99",
+ "shasum": ""
+ },
+ "require": {
+ "phpunit/phpunit-mock-objects": ">2.3 <7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": ">=4.8 <8.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Codeception\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Flexible Stub wrapper for PHPUnit's Mock Builder",
+ "time": "2018-02-18T13:56:56+00:00"
},
{
"name": "consolidation/annotated-command",
- "version": "2.8.2",
+ "version": "2.8.3",
"source": {
"type": "git",
"url": "https://github.com/consolidation/annotated-command.git",
- "reference": "e97c38717eae23a2bafcf3f09438290eee6ebeb4"
+ "reference": "8f8f5da2ca06fbd3a85f7d551c49f844b7c59437"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/e97c38717eae23a2bafcf3f09438290eee6ebeb4",
- "reference": "e97c38717eae23a2bafcf3f09438290eee6ebeb4",
+ "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/8f8f5da2ca06fbd3a85f7d551c49f844b7c59437",
+ "reference": "8f8f5da2ca06fbd3a85f7d551c49f844b7c59437",
"shasum": ""
},
"require": {
@@ -287,6 +318,7 @@
"symfony/finder": "^2.5|^3|^4"
},
"require-dev": {
+ "greg-1-anderson/composer-test-scenarios": "^1",
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "^1.0.2 | dev-master",
"squizlabs/php_codesniffer": "^2.7"
@@ -313,7 +345,7 @@
}
],
"description": "Initialize Symfony Console commands from annotated command class methods.",
- "time": "2017-11-29T16:23:23+00:00"
+ "time": "2018-02-23T16:32:04+00:00"
},
{
"name": "consolidation/config",
@@ -419,16 +451,16 @@
},
{
"name": "consolidation/output-formatters",
- "version": "3.1.13",
+ "version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/consolidation/output-formatters.git",
- "reference": "3188461e965b32148c8fb85261833b2b72d34b8c"
+ "reference": "da889e4bce19f145ca4ec5b1725a946f4eb625a9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/3188461e965b32148c8fb85261833b2b72d34b8c",
- "reference": "3188461e965b32148c8fb85261833b2b72d34b8c",
+ "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/da889e4bce19f145ca4ec5b1725a946f4eb625a9",
+ "reference": "da889e4bce19f145ca4ec5b1725a946f4eb625a9",
"shasum": ""
},
"require": {
@@ -437,11 +469,17 @@
"symfony/finder": "^2.5|^3|^4"
},
"require-dev": {
- "phpunit/phpunit": "^4.8",
- "satooshi/php-coveralls": "^1.0.2 | dev-master",
+ "g-1-a/composer-test-scenarios": "^2",
+ "phpunit/phpunit": "^5.7.27",
+ "satooshi/php-coveralls": "^2",
"squizlabs/php_codesniffer": "^2.7",
+ "symfony/console": "3.2.3",
+ "symfony/var-dumper": "^2.8|^3|^4",
"victorjonsson/markdowndocs": "^1.3"
},
+ "suggest": {
+ "symfony/var-dumper": "For using the var_dump formatter"
+ },
"type": "library",
"extra": {
"branch-alias": {
@@ -464,20 +502,20 @@
}
],
"description": "Format text by applying transformations provided by plug-in formatters.",
- "time": "2017-11-29T15:25:38+00:00"
+ "time": "2018-03-20T15:18:32+00:00"
},
{
"name": "consolidation/robo",
- "version": "1.2.1",
+ "version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/consolidation/Robo.git",
- "reference": "b6296f1cf1088f1a11b0b819f9e42ef6f00b79a9"
+ "reference": "54a13e268917b92576d75e10dca8227b95a574d9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/Robo/zipball/b6296f1cf1088f1a11b0b819f9e42ef6f00b79a9",
- "reference": "b6296f1cf1088f1a11b0b819f9e42ef6f00b79a9",
+ "url": "https://api.github.com/repos/consolidation/Robo/zipball/54a13e268917b92576d75e10dca8227b95a574d9",
+ "reference": "54a13e268917b92576d75e10dca8227b95a574d9",
"shasum": ""
},
"require": {
@@ -501,8 +539,11 @@
"codeception/aspect-mock": "^1|^2.1.1",
"codeception/base": "^2.3.7",
"codeception/verify": "^0.3.2",
- "greg-1-anderson/composer-test-scenarios": "^1",
+ "g-1-a/composer-test-scenarios": "^2",
+ "goaop/framework": "~2.1.2",
+ "goaop/parser-reflection": "^1.1.0",
"natxet/cssmin": "3.0.4",
+ "nikic/php-parser": "^3.1.5",
"patchwork/jsqueeze": "~2",
"pear/archive_tar": "^1.4.2",
"phpunit/php-code-coverage": "~2|~4",
@@ -541,7 +582,7 @@
}
],
"description": "Modern task runner",
- "time": "2017-12-29T06:48:35+00:00"
+ "time": "2018-04-06T05:27:37+00:00"
},
{
"name": "container-interop/container-interop",
@@ -635,30 +676,30 @@
},
{
"name": "doctrine/annotations",
- "version": "v1.4.0",
+ "version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
- "reference": "54cacc9b81758b14e3ce750f205a393d52339e97"
+ "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97",
- "reference": "54cacc9b81758b14e3ce750f205a393d52339e97",
+ "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
+ "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
- "php": "^5.6 || ^7.0"
+ "php": "^7.1"
},
"require-dev": {
"doctrine/cache": "1.*",
- "phpunit/phpunit": "^5.7"
+ "phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.4.x-dev"
+ "dev-master": "1.6.x-dev"
}
},
"autoload": {
@@ -699,24 +740,24 @@
"docblock",
"parser"
],
- "time": "2017-02-24T16:22:25+00:00"
+ "time": "2017-12-06T07:11:42+00:00"
},
{
"name": "doctrine/collections",
- "version": "v1.4.0",
+ "version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
- "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba"
+ "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba",
- "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba",
+ "url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
+ "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
"shasum": ""
},
"require": {
- "php": "^5.6 || ^7.0"
+ "php": "^7.1"
},
"require-dev": {
"doctrine/coding-standard": "~0.1@dev",
@@ -766,36 +807,36 @@
"collections",
"iterator"
],
- "time": "2017-01-03T10:49:41+00:00"
+ "time": "2017-07-22T10:37:32+00:00"
},
{
"name": "doctrine/instantiator",
- "version": "1.0.5",
+ "version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
+ "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
"shasum": ""
},
"require": {
- "php": ">=5.3,<8.0-DEV"
+ "php": "^7.1"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "~2.0"
+ "phpunit/phpunit": "^6.2.3",
+ "squizlabs/php_codesniffer": "^3.0.2"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.2.x-dev"
}
},
"autoload": {
@@ -820,7 +861,7 @@
"constructor",
"instantiate"
],
- "time": "2015-06-14T21:17:01+00:00"
+ "time": "2017-07-22T11:58:36+00:00"
},
{
"name": "doctrine/lexer",
@@ -979,16 +1020,16 @@
},
{
"name": "flow/jsonpath",
- "version": "0.3.4",
+ "version": "0.4.0",
"source": {
"type": "git",
"url": "https://github.com/FlowCommunications/JSONPath.git",
- "reference": "00aa9c361e4d0a210dd95f3c917a1e0dde3a957f"
+ "reference": "f0222818d5c938e4ab668ab2e2c079bd51a27112"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/FlowCommunications/JSONPath/zipball/00aa9c361e4d0a210dd95f3c917a1e0dde3a957f",
- "reference": "00aa9c361e4d0a210dd95f3c917a1e0dde3a957f",
+ "url": "https://api.github.com/repos/FlowCommunications/JSONPath/zipball/f0222818d5c938e4ab668ab2e2c079bd51a27112",
+ "reference": "f0222818d5c938e4ab668ab2e2c079bd51a27112",
"shasum": ""
},
"require": {
@@ -1016,7 +1057,7 @@
}
],
"description": "JSONPath implementation for parsing, searching and flattening arrays",
- "time": "2016-09-06T17:43:18+00:00"
+ "time": "2018-03-04T16:39:47+00:00"
},
{
"name": "fzaninotto/faker",
@@ -1165,16 +1206,16 @@
},
{
"name": "guzzlehttp/guzzle",
- "version": "6.3.0",
+ "version": "6.3.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
+ "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
- "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90",
+ "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90",
"shasum": ""
},
"require": {
@@ -1184,7 +1225,7 @@
},
"require-dev": {
"ext-curl": "*",
- "phpunit/phpunit": "^4.0 || ^5.0",
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
"psr/log": "^1.0"
},
"suggest": {
@@ -1193,7 +1234,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "6.2-dev"
+ "dev-master": "6.3-dev"
}
},
"autoload": {
@@ -1226,7 +1267,7 @@
"rest",
"web service"
],
- "time": "2017-06-22T18:50:49+00:00"
+ "time": "2018-03-26T16:33:04+00:00"
},
{
"name": "guzzlehttp/promises",
@@ -1344,65 +1385,6 @@
],
"time": "2017-03-20T17:10:46+00:00"
},
- {
- "name": "henrikbjorn/lurker",
- "version": "1.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/flint/Lurker.git",
- "reference": "712d3ef19bef161daa2ba0e0237c6b875587a089"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/flint/Lurker/zipball/712d3ef19bef161daa2ba0e0237c6b875587a089",
- "reference": "712d3ef19bef161daa2ba0e0237c6b875587a089",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "symfony/config": "^2.2|^3.0",
- "symfony/event-dispatcher": "^2.2|^3.0"
- },
- "suggest": {
- "ext-inotify": ">=0.1.6"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Lurker": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Yaroslav Kiliba",
- "email": "om.dattaya@gmail.com"
- },
- {
- "name": "Konstantin Kudryashov",
- "email": "ever.zet@gmail.com"
- },
- {
- "name": "Henrik Bjrnskov",
- "email": "henrik@bjrnskov.dk"
- }
- ],
- "description": "Resource Watcher.",
- "keywords": [
- "filesystem",
- "resource",
- "watching"
- ],
- "time": "2016-03-16T15:22:20+00:00"
- },
{
"name": "jms/metadata",
"version": "1.6.0",
@@ -1491,16 +1473,16 @@
},
{
"name": "jms/serializer",
- "version": "1.10.0",
+ "version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/serializer.git",
- "reference": "62c7ff6d61f8692eac8be024c542b3d9d0ab8c8a"
+ "reference": "e7c53477ff55c21d1b1db7d062edc050a24f465f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/62c7ff6d61f8692eac8be024c542b3d9d0ab8c8a",
- "reference": "62c7ff6d61f8692eac8be024c542b3d9d0ab8c8a",
+ "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/e7c53477ff55c21d1b1db7d062edc050a24f465f",
+ "reference": "e7c53477ff55c21d1b1db7d062edc050a24f465f",
"shasum": ""
},
"require": {
@@ -1508,12 +1490,11 @@
"doctrine/instantiator": "^1.0.3",
"jms/metadata": "~1.1",
"jms/parser-lib": "1.*",
- "php": ">=5.5.0",
+ "php": "^5.5|^7.0",
"phpcollection/phpcollection": "~0.1",
"phpoption/phpoption": "^1.1"
},
"conflict": {
- "jms/serializer-bundle": "<1.2.1",
"twig/twig": "<1.12"
},
"require-dev": {
@@ -1541,7 +1522,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.10-dev"
+ "dev-master": "1.11-dev"
}
},
"autoload": {
@@ -1572,7 +1553,7 @@
"serialization",
"xml"
],
- "time": "2017-11-30T18:23:40+00:00"
+ "time": "2018-02-04T17:48:54+00:00"
},
{
"name": "league/container",
@@ -1641,19 +1622,23 @@
},
{
"name": "magento/magento2-functional-testing-framework",
- "version": "2.1.2",
+ "version": "2.2.0",
"source": {
"type": "git",
"url": "git@github.com:magento/magento2-functional-testing-framework.git",
- "reference": "10d547a984cde1e1e9d9100c658011b467b10010"
+ "reference": "4dd196d745bf836cbf0c5904a1df6dd241124309"
},
"require": {
+ "allure-framework/allure-codeception": "~1.2.6",
"codeception/codeception": "~2.3.4",
+ "consolidation/robo": "^1.0.0",
"epfremme/swagger-php": "^2.0",
"flow/jsonpath": ">0.2",
"fzaninotto/faker": "^1.6",
"mustache/mustache": "~2.5",
- "php": "7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0"
+ "php": "7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0",
+ "symfony/process": "^2.8 || ^3.1 || ^4.0",
+ "vlucas/phpdotenv": "^2.4"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.3",
@@ -1667,6 +1652,9 @@
"squizlabs/php_codesniffer": "1.5.3",
"symfony/stopwatch": "~3.4.6"
},
+ "bin": [
+ "bin/mftf"
+ ],
"type": "library",
"extra": {
"hooks": {
@@ -1675,7 +1663,8 @@
},
"autoload": {
"psr-4": {
- "Magento\\FunctionalTestingFramework\\": "src/Magento/FunctionalTestingFramework"
+ "Magento\\FunctionalTestingFramework\\": "src/Magento/FunctionalTestingFramework",
+ "MFTF\\": "dev/tests/functional/MFTF"
}
},
"autoload-dev": {
@@ -1701,7 +1690,7 @@
"magento",
"testing"
],
- "time": "2018-03-14T19:09:58+00:00"
+ "time": "2018-04-24T01:46:09+00:00"
},
{
"name": "moontoast/math",
@@ -1845,16 +1834,16 @@
},
{
"name": "paragonie/random_compat",
- "version": "v2.0.11",
+ "version": "v2.0.12",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
- "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
+ "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
- "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
+ "url": "https://api.github.com/repos/paragonie/random_compat/zipball/258c89a6b97de7dfaf5b8c7607d0478e236b04fb",
+ "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb",
"shasum": ""
},
"require": {
@@ -1889,7 +1878,7 @@
"pseudorandom",
"random"
],
- "time": "2017-09-27T21:40:39+00:00"
+ "time": "2018-04-04T21:24:14+00:00"
},
{
"name": "phar-io/manifest",
@@ -2097,16 +2086,16 @@
},
{
"name": "phpdocumentor/reflection-docblock",
- "version": "4.2.0",
+ "version": "4.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
- "reference": "66465776cfc249844bde6d117abff1d22e06c2da"
+ "reference": "94fd0001232e47129dd3504189fa1c7225010d08"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da",
- "reference": "66465776cfc249844bde6d117abff1d22e06c2da",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08",
+ "reference": "94fd0001232e47129dd3504189fa1c7225010d08",
"shasum": ""
},
"require": {
@@ -2144,7 +2133,7 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
- "time": "2017-11-27T17:38:31+00:00"
+ "time": "2017-11-30T07:14:17+00:00"
},
{
"name": "phpdocumentor/type-resolver",
@@ -2245,28 +2234,28 @@
},
{
"name": "phpspec/prophecy",
- "version": "1.7.3",
+ "version": "1.7.6",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
- "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf"
+ "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
- "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
+ "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
- "sebastian/comparator": "^1.1|^2.0",
+ "sebastian/comparator": "^1.1|^2.0|^3.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
- "phpunit/phpunit": "^4.8.35 || ^5.7"
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
},
"type": "library",
"extra": {
@@ -2304,20 +2293,20 @@
"spy",
"stub"
],
- "time": "2017-11-24T13:59:53+00:00"
+ "time": "2018-04-18T13:57:24+00:00"
},
{
"name": "phpunit/php-code-coverage",
- "version": "5.3.0",
+ "version": "5.3.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1"
+ "reference": "c89677919c5dd6d3b3852f230a663118762218ac"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1",
- "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac",
+ "reference": "c89677919c5dd6d3b3852f230a663118762218ac",
"shasum": ""
},
"require": {
@@ -2367,7 +2356,7 @@
"testing",
"xunit"
],
- "time": "2017-12-06T09:29:45+00:00"
+ "time": "2018-04-06T15:36:58+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -2557,16 +2546,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "6.4.4",
+ "version": "6.5.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932"
+ "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/562f7dc75d46510a4ed5d16189ae57fbe45a9932",
- "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
+ "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
"shasum": ""
},
"require": {
@@ -2580,12 +2569,12 @@
"phar-io/version": "^1.0",
"php": "^7.0",
"phpspec/prophecy": "^1.7",
- "phpunit/php-code-coverage": "^5.2.2",
- "phpunit/php-file-iterator": "^1.4.2",
+ "phpunit/php-code-coverage": "^5.3",
+ "phpunit/php-file-iterator": "^1.4.3",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^1.0.9",
- "phpunit/phpunit-mock-objects": "^4.0.3",
- "sebastian/comparator": "^2.0.2",
+ "phpunit/phpunit-mock-objects": "^5.0.5",
+ "sebastian/comparator": "^2.1",
"sebastian/diff": "^2.0",
"sebastian/environment": "^3.1",
"sebastian/exporter": "^3.1",
@@ -2611,7 +2600,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "6.4.x-dev"
+ "dev-master": "6.5.x-dev"
}
},
"autoload": {
@@ -2637,33 +2626,33 @@
"testing",
"xunit"
],
- "time": "2017-11-08T11:26:09+00:00"
+ "time": "2018-04-10T11:38:34+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
- "version": "4.0.4",
+ "version": "5.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "2f789b59ab89669015ad984afa350c4ec577ade0"
+ "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0",
- "reference": "2f789b59ab89669015ad984afa350c4ec577ade0",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
+ "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.5",
"php": "^7.0",
"phpunit/php-text-template": "^1.2.1",
- "sebastian/exporter": "^3.0"
+ "sebastian/exporter": "^3.1"
},
"conflict": {
"phpunit/phpunit": "<6.0"
},
"require-dev": {
- "phpunit/phpunit": "^6.0"
+ "phpunit/phpunit": "^6.5"
},
"suggest": {
"ext-soap": "*"
@@ -2671,7 +2660,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.0.x-dev"
+ "dev-master": "5.0.x-dev"
}
},
"autoload": {
@@ -2686,7 +2675,7 @@
"authors": [
{
"name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
+ "email": "sebastian@phpunit.de",
"role": "lead"
}
],
@@ -2696,7 +2685,7 @@
"mock",
"xunit"
],
- "time": "2017-08-03T14:08:16+00:00"
+ "time": "2018-01-06T05:45:45+00:00"
},
{
"name": "psr/container",
@@ -2846,16 +2835,16 @@
},
{
"name": "ramsey/uuid",
- "version": "3.7.2",
+ "version": "3.7.3",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
- "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d"
+ "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ramsey/uuid/zipball/bba83ad77bb9deb6d3c352a7361b818e415b221d",
- "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d",
+ "url": "https://api.github.com/repos/ramsey/uuid/zipball/44abcdad877d9a46685a3a4d221e3b2c4b87cb76",
+ "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76",
"shasum": ""
},
"require": {
@@ -2866,17 +2855,15 @@
"rhumsaa/uuid": "self.version"
},
"require-dev": {
- "apigen/apigen": "^4.1",
"codeception/aspect-mock": "^1.0 | ~2.0.0",
"doctrine/annotations": "~1.2.0",
"goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1",
"ircmaxell/random-lib": "^1.1",
"jakub-onderka/php-parallel-lint": "^0.9.0",
- "mockery/mockery": "^0.9.4",
+ "mockery/mockery": "^0.9.9",
"moontoast/math": "^1.1",
"php-mock/php-mock-phpunit": "^0.3|^1.1",
"phpunit/phpunit": "^4.7|^5.0",
- "satooshi/php-coveralls": "^0.6.1",
"squizlabs/php_codesniffer": "^2.3"
},
"suggest": {
@@ -2924,7 +2911,7 @@
"identifier",
"uuid"
],
- "time": "2018-01-13T22:22:03+00:00"
+ "time": "2018-01-20T00:28:24+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@@ -2973,21 +2960,21 @@
},
{
"name": "sebastian/comparator",
- "version": "2.1.2",
+ "version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
- "reference": "11c07feade1d65453e06df3b3b90171d6d982087"
+ "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/11c07feade1d65453e06df3b3b90171d6d982087",
- "reference": "11c07feade1d65453e06df3b3b90171d6d982087",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9",
+ "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9",
"shasum": ""
},
"require": {
"php": "^7.0",
- "sebastian/diff": "^2.0",
+ "sebastian/diff": "^2.0 || ^3.0",
"sebastian/exporter": "^3.1"
},
"require-dev": {
@@ -3033,7 +3020,7 @@
"compare",
"equality"
],
- "time": "2018-01-12T06:34:42+00:00"
+ "time": "2018-02-01T13:46:46+00:00"
},
{
"name": "sebastian/diff",
@@ -3487,25 +3474,25 @@
},
{
"name": "symfony/browser-kit",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
- "reference": "490f27762705c8489bd042fe3e9377a191dba9b4"
+ "reference": "c43bfa0182363b3fd64331b5e64e467349ff4670"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/browser-kit/zipball/490f27762705c8489bd042fe3e9377a191dba9b4",
- "reference": "490f27762705c8489bd042fe3e9377a191dba9b4",
+ "url": "https://api.github.com/repos/symfony/browser-kit/zipball/c43bfa0182363b3fd64331b5e64e467349ff4670",
+ "reference": "c43bfa0182363b3fd64331b5e64e467349ff4670",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/dom-crawler": "~2.8|~3.0|~4.0"
+ "php": "^7.1.3",
+ "symfony/dom-crawler": "~3.4|~4.0"
},
"require-dev": {
- "symfony/css-selector": "~2.8|~3.0|~4.0",
- "symfony/process": "~2.8|~3.0|~4.0"
+ "symfony/css-selector": "~3.4|~4.0",
+ "symfony/process": "~3.4|~4.0"
},
"suggest": {
"symfony/process": ""
@@ -3513,7 +3500,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -3540,87 +3527,24 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
- },
- {
- "name": "symfony/config",
- "version": "v3.4.3",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/config.git",
- "reference": "cfd5c972f7b4992a5df41673d25d980ab077aa5b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/cfd5c972f7b4992a5df41673d25d980ab077aa5b",
- "reference": "cfd5c972f7b4992a5df41673d25d980ab077aa5b",
- "shasum": ""
- },
- "require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/filesystem": "~2.8|~3.0|~4.0"
- },
- "conflict": {
- "symfony/dependency-injection": "<3.3",
- "symfony/finder": "<3.3"
- },
- "require-dev": {
- "symfony/dependency-injection": "~3.3|~4.0",
- "symfony/finder": "~3.3|~4.0",
- "symfony/yaml": "~3.0|~4.0"
- },
- "suggest": {
- "symfony/yaml": "To use the yaml reference dumper"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.4-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Config\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Config Component",
- "homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
+ "time": "2018-03-19T22:35:49+00:00"
},
{
"name": "symfony/console",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d"
+ "reference": "aad9a6fe47319f22748fd764f52d3a7ca6fa6b64"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/8394c8ef121949e8f858f13bc1e34f05169e4e7d",
- "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d",
+ "url": "https://api.github.com/repos/symfony/console/zipball/aad9a6fe47319f22748fd764f52d3a7ca6fa6b64",
+ "reference": "aad9a6fe47319f22748fd764f52d3a7ca6fa6b64",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/debug": "~2.8|~3.0|~4.0",
+ "php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
@@ -3629,11 +3553,11 @@
},
"require-dev": {
"psr/log": "~1.0",
- "symfony/config": "~3.3|~4.0",
+ "symfony/config": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
- "symfony/event-dispatcher": "~2.8|~3.0|~4.0",
+ "symfony/event-dispatcher": "~3.4|~4.0",
"symfony/lock": "~3.4|~4.0",
- "symfony/process": "~3.3|~4.0"
+ "symfony/process": "~3.4|~4.0"
},
"suggest": {
"psr/log": "For using the console logger",
@@ -3644,7 +3568,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -3671,29 +3595,29 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
+ "time": "2018-04-03T05:24:00+00:00"
},
{
"name": "symfony/css-selector",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
- "reference": "e66394bc7610e69279bfdb3ab11b4fe65403f556"
+ "reference": "03f965583147957f1ecbad7ea1c9d6fd5e525ec2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/css-selector/zipball/e66394bc7610e69279bfdb3ab11b4fe65403f556",
- "reference": "e66394bc7610e69279bfdb3ab11b4fe65403f556",
+ "url": "https://api.github.com/repos/symfony/css-selector/zipball/03f965583147957f1ecbad7ea1c9d6fd5e525ec2",
+ "reference": "03f965583147957f1ecbad7ea1c9d6fd5e525ec2",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8"
+ "php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -3724,84 +3648,28 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
- },
- {
- "name": "symfony/debug",
- "version": "v3.4.3",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/debug.git",
- "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/debug/zipball/603b95dda8b00020e4e6e60dc906e7b715b1c245",
- "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245",
- "shasum": ""
- },
- "require": {
- "php": "^5.5.9|>=7.0.8",
- "psr/log": "~1.0"
- },
- "conflict": {
- "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
- },
- "require-dev": {
- "symfony/http-kernel": "~2.8|~3.0|~4.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.4-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Debug\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Debug Component",
- "homepage": "https://symfony.com",
- "time": "2018-01-03T17:14:19+00:00"
+ "time": "2018-03-19T22:35:49+00:00"
},
{
"name": "symfony/dom-crawler",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
- "reference": "09bd97b844b3151fab82f2fdd62db9c464b3910a"
+ "reference": "d6c04c7532535b5e0b63db45b543cd60818e0fbc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/09bd97b844b3151fab82f2fdd62db9c464b3910a",
- "reference": "09bd97b844b3151fab82f2fdd62db9c464b3910a",
+ "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/d6c04c7532535b5e0b63db45b543cd60818e0fbc",
+ "reference": "d6c04c7532535b5e0b63db45b543cd60818e0fbc",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8",
+ "php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
- "symfony/css-selector": "~2.8|~3.0|~4.0"
+ "symfony/css-selector": "~3.4|~4.0"
},
"suggest": {
"symfony/css-selector": ""
@@ -3809,7 +3677,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -3836,34 +3704,34 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
+ "time": "2018-03-19T22:35:49+00:00"
},
{
"name": "symfony/event-dispatcher",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca"
+ "reference": "63353a71073faf08f62caab4e6889b06a787f07b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/26b87b6bca8f8f797331a30b76fdae5342dc26ca",
- "reference": "26b87b6bca8f8f797331a30b76fdae5342dc26ca",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/63353a71073faf08f62caab4e6889b06a787f07b",
+ "reference": "63353a71073faf08f62caab4e6889b06a787f07b",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8"
+ "php": "^7.1.3"
},
"conflict": {
- "symfony/dependency-injection": "<3.3"
+ "symfony/dependency-injection": "<3.4"
},
"require-dev": {
"psr/log": "~1.0",
- "symfony/config": "~2.8|~3.0|~4.0",
- "symfony/dependency-injection": "~3.3|~4.0",
- "symfony/expression-language": "~2.8|~3.0|~4.0",
- "symfony/stopwatch": "~2.8|~3.0|~4.0"
+ "symfony/config": "~3.4|~4.0",
+ "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/expression-language": "~3.4|~4.0",
+ "symfony/stopwatch": "~3.4|~4.0"
},
"suggest": {
"symfony/dependency-injection": "",
@@ -3872,7 +3740,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -3899,29 +3767,29 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
+ "time": "2018-04-06T07:35:43+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "e078773ad6354af38169faf31c21df0f18ace03d"
+ "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/e078773ad6354af38169faf31c21df0f18ace03d",
- "reference": "e078773ad6354af38169faf31c21df0f18ace03d",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21",
+ "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8"
+ "php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -3948,29 +3816,29 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
+ "time": "2018-02-22T10:50:29+00:00"
},
{
"name": "symfony/finder",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "613e26310776f49a1773b6737c6bd554b8bc8c6f"
+ "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/613e26310776f49a1773b6737c6bd554b8bc8c6f",
- "reference": "613e26310776f49a1773b6737c6bd554b8bc8c6f",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/ca27c02b7a3fef4828c998c2ff9ba7aae1641c49",
+ "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8"
+ "php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -3997,34 +3865,33 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
+ "time": "2018-04-04T05:10:37+00:00"
},
{
"name": "symfony/http-foundation",
- "version": "v3.4.3",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
- "reference": "4a213be1cc8598089b8c7451529a2927b49b5d26"
+ "reference": "d0864a82e5891ab61d31eecbaa48bed5a09b8e6c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/4a213be1cc8598089b8c7451529a2927b49b5d26",
- "reference": "4a213be1cc8598089b8c7451529a2927b49b5d26",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d0864a82e5891ab61d31eecbaa48bed5a09b8e6c",
+ "reference": "d0864a82e5891ab61d31eecbaa48bed5a09b8e6c",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/polyfill-mbstring": "~1.1",
- "symfony/polyfill-php70": "~1.6"
+ "php": "^7.1.3",
+ "symfony/polyfill-mbstring": "~1.1"
},
"require-dev": {
- "symfony/expression-language": "~2.8|~3.0|~4.0"
+ "symfony/expression-language": "~3.4|~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -4051,20 +3918,20 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T17:14:19+00:00"
+ "time": "2018-04-03T05:24:00+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.6.0",
+ "version": "v1.7.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
+ "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
- "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b",
+ "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b",
"shasum": ""
},
"require": {
@@ -4076,7 +3943,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.6-dev"
+ "dev-master": "1.7-dev"
}
},
"autoload": {
@@ -4110,88 +3977,29 @@
"portable",
"shim"
],
- "time": "2017-10-11T12:05:26+00:00"
- },
- {
- "name": "symfony/polyfill-php70",
- "version": "v1.6.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-php70.git",
- "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff",
- "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff",
- "shasum": ""
- },
- "require": {
- "paragonie/random_compat": "~1.0|~2.0",
- "php": ">=5.3.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.6-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Polyfill\\Php70\\": ""
- },
- "files": [
- "bootstrap.php"
- ],
- "classmap": [
- "Resources/stubs"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
- "homepage": "https://symfony.com",
- "keywords": [
- "compatibility",
- "polyfill",
- "portable",
- "shim"
- ],
- "time": "2017-10-11T12:05:26+00:00"
+ "time": "2018-01-30T19:27:44+00:00"
},
{
"name": "symfony/process",
- "version": "v3.3.15",
+ "version": "v4.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "0350bf42a9c5d62bbbed725aaa2d5c741078c0bc"
+ "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/0350bf42a9c5d62bbbed725aaa2d5c741078c0bc",
- "reference": "0350bf42a9c5d62bbbed725aaa2d5c741078c0bc",
+ "url": "https://api.github.com/repos/symfony/process/zipball/d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25",
+ "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8"
+ "php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -4218,20 +4026,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:11+00:00"
+ "time": "2018-04-03T05:24:00+00:00"
},
{
"name": "symfony/yaml",
- "version": "v3.4.3",
+ "version": "v3.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "25c192f25721a74084272671f658797d9e0e0146"
+ "reference": "a42f9da85c7c38d59f5e53f076fe81a091f894d0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/25c192f25721a74084272671f658797d9e0e0146",
- "reference": "25c192f25721a74084272671f658797d9e0e0146",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/a42f9da85c7c38d59f5e53f076fe81a091f894d0",
+ "reference": "a42f9da85c7c38d59f5e53f076fe81a091f894d0",
"shasum": ""
},
"require": {
@@ -4276,7 +4084,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2018-01-03T07:37:34+00:00"
+ "time": "2018-04-03T05:14:20+00:00"
},
{
"name": "theseer/tokenizer",
@@ -4370,16 +4178,16 @@
},
{
"name": "webmozart/assert",
- "version": "1.2.0",
+ "version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
- "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
+ "reference": "0df1908962e7a3071564e857d86874dad1ef204a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
- "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a",
+ "reference": "0df1908962e7a3071564e857d86874dad1ef204a",
"shasum": ""
},
"require": {
@@ -4416,7 +4224,7 @@
"check",
"validate"
],
- "time": "2016-11-23T20:04:58+00:00"
+ "time": "2018-01-29T19:49:41+00:00"
}
],
"packages-dev": [],
@@ -4425,8 +4233,6 @@
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
- "platform": {
- "php": "7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0"
- },
+ "platform": [],
"platform-dev": []
}
diff --git a/dev/tests/acceptance/tests/_bootstrap.php b/dev/tests/acceptance/tests/_bootstrap.php
index ee1b588ca2e8..d15481d18098 100644
--- a/dev/tests/acceptance/tests/_bootstrap.php
+++ b/dev/tests/acceptance/tests/_bootstrap.php
@@ -4,32 +4,104 @@
* See COPYING.txt for license details.
*/
-define('PROJECT_ROOT', dirname(__DIR__));
-require_once PROJECT_ROOT . '/vendor/autoload.php';
-$RELATIVE_FW_PATH = '/vendor/magento/magento2-functional-testing-framework';
+$bootstrapRoot = dirname(__DIR__);
+$projectRootPath = $bootstrapRoot;
+
+// If we're under a vendor directory, find project root.
+if (strpos($bootstrapRoot, '/vendor') !== false) {
+ $projectRootPath = substr($bootstrapRoot, 0, strpos($bootstrapRoot, '/vendor/'));
+}
+
+define('PROJECT_ROOT', $projectRootPath);
+
+
+//Load base paths from composer autoload file
+$autoloadFile = PROJECT_ROOT . '/vendor/autoload.php';
+
+$loader = require $autoloadFile;
+
+// Package Names.
+$FW_PACKAGE_NAME = "Magento\FunctionalTestingFramework\\";
+$TESTS_PACKAGE_NAME = "TODO";
+$MAGENTO_PACKAGE_NAME = "Magento\\";
+
+// Find framework path
+$COMPOSER_FW_FULL_PREFIX = $loader->getPrefixesPsr4()[$FW_PACKAGE_NAME][0] ?? null;
+if ($COMPOSER_FW_FULL_PREFIX === null) {
+ throw new Exception(
+ "You must have the magento/magento2-functional-testing-framework
+ installed to be able to generate tests."
+ );
+}
+$FW_PATH = substr(
+ $COMPOSER_FW_FULL_PREFIX,
+ 0,
+ strpos($COMPOSER_FW_FULL_PREFIX, "/src/Magento/FunctionalTestingFramework")
+);
+
+// Find tests path
+$COMPOSER_TEST_FULL_PREFIX = $loader->getPrefixesPsr4()[$TESTS_PACKAGE_NAME][0] ?? null;
+if ($COMPOSER_TEST_FULL_PREFIX === null) {
+ $TEST_PATH = __DIR__ . "/functional";
+} else {
+ // Can't determine what to trim; we don't know the package name/structure yet
+ $TEST_PATH = $COMPOSER_TEST_FULL_PREFIX;
+}
+
+// We register "Magento\\" to "tests/functional/Magento" for our own class loading, need to try and find a
+// prefix that isn't that one.
+$COMPOSER_MAGENTO_PREFIXES = $loader->getPrefixesPsr4()[$MAGENTO_PACKAGE_NAME];
+$COMPOSER_MAGENTO_FULL_PREFIX = null;
+foreach ($COMPOSER_MAGENTO_PREFIXES as $path) {
+ if (strpos($path, "tests/functional/Magento") === 0) {
+ $COMPOSER_MAGENTO_FULL_PREFIX = $path;
+ }
+}
+if ($COMPOSER_MAGENTO_FULL_PREFIX === null) {
+ $MAGENTO_PATH = dirname(__DIR__ . "/../../../../../");
+} else {
+ $MAGENTO_PATH = substr(
+ $COMPOSER_MAGENTO_FULL_PREFIX,
+ 0,
+ strpos($COMPOSER_MAGENTO_FULL_PREFIX, "/app/code/Magento")
+ );
+}
+
+$RELATIVE_TESTS_MODULE_PATH = '/Magento/FunctionalTest';
+
+defined('MAGENTO_BP') || define('MAGENTO_BP', realpath($MAGENTO_PATH));
//Load constants from .env file
-if (file_exists(PROJECT_ROOT . '/.env')) {
- $env = new \Dotenv\Loader(PROJECT_ROOT . '/.env');
+if (file_exists(MAGENTO_BP . '/dev/tests/acceptance/.env')) {
+ $env = new \Dotenv\Loader(MAGENTO_BP . '/dev/tests/acceptance/.env');
$env->load();
if (array_key_exists('TESTS_MODULE_PATH', $_ENV) xor array_key_exists('TESTS_BP', $_ENV)) {
- throw new Exception('You must define both parameters TESTS_BP and TESTS_MODULE_PATH or neither parameter');
+ throw new Exception(
+ 'You must define both parameters TESTS_BP and TESTS_MODULE_PATH or neither parameter'
+ );
}
foreach ($_ENV as $key => $var) {
defined($key) || define($key, $var);
}
+
+ defined('MAGENTO_CLI_COMMAND_PATH') || define(
+ 'MAGENTO_CLI_COMMAND_PATH',
+ 'dev/tests/acceptance/utils/command.php'
+ );
+ $env->setEnvironmentVariable('MAGENTO_CLI_COMMAND_PATH', MAGENTO_CLI_COMMAND_PATH);
+
+ defined('MAGENTO_CLI_COMMAND_PARAMETER') || define('MAGENTO_CLI_COMMAND_PARAMETER', 'command');
+ $env->setEnvironmentVariable('MAGENTO_CLI_COMMAND_PARAMETER', MAGENTO_CLI_COMMAND_PARAMETER);
}
-if (!defined('MAGENTO_CLI_COMMAND_PATH')) {
- define('MAGENTO_CLI_COMMAND_PATH', 'dev/tests/acceptance/utils/command.php');
- $env->setEnvironmentVariable('MAGENTO_CLI_COMMAND_PATH', 'dev/tests/acceptance/utils/command.php');
-}
-if (!defined('MAGENTO_CLI_COMMAND_PARAMETER')) {
- define('MAGENTO_CLI_COMMAND_PARAMETER', 'command');
- $env->setEnvironmentVariable('MAGENTO_CLI_COMMAND_PARAMETER', 'command');
-}
-defined('FW_BP') || define('FW_BP', PROJECT_ROOT . $RELATIVE_FW_PATH);
+
+defined('FW_BP') || define('FW_BP', realpath($FW_PATH));
+defined('TESTS_BP') || define('TESTS_BP', realpath($TEST_PATH));
+defined('TESTS_MODULE_PATH') || define(
+ 'TESTS_MODULE_PATH',
+ realpath($TEST_PATH . $RELATIVE_TESTS_MODULE_PATH)
+);
// add the debug flag here
$debug_mode = $_ENV['MFTF_DEBUG'] ?? false;
diff --git a/dev/tests/acceptance/tests/_suite/sampleSuite.xml b/dev/tests/acceptance/tests/_suite/suite.xml.sample
similarity index 100%
rename from dev/tests/acceptance/tests/_suite/sampleSuite.xml
rename to dev/tests/acceptance/tests/_suite/suite.xml.sample
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryTest.xml
similarity index 95%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryTest.xml
index cd0ee19fc497..a266cdff269a 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationBlankIndustryTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -16,12 +16,10 @@
-
-
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsTest.xml
index 3db8ec776340..8e371d24cbe4 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationIndustryCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationIndustryTest.xml
similarity index 97%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationIndustryCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationIndustryTest.xml
index 29e41735c154..7a5c67095a50 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationIndustryCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationIndustryTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionTest.xml
index d22c34222c82..b28f269f9b9a 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataTest.xml
similarity index 93%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataTest.xml
index bde91098fcf1..ad3593e1828e 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationTimeToSendDataTest.xml
@@ -8,7 +8,7 @@
-
+
@@ -17,14 +17,11 @@
-
-
-
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginAsAdminActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginAsAdminActionGroup.xml
index e9f8d4a3f2b1..2f7ce506acb1 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginAsAdminActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/ActionGroup/LoginAsAdminActionGroup.xml
@@ -13,6 +13,7 @@
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCreateRootCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCreateRootCategoryActionGroup.xml
new file mode 100644
index 000000000000..b29a03b6d181
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCreateRootCategoryActionGroup.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CheckItemInLayeredNavigationActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CheckItemInLayeredNavigationActionGroup.xml
new file mode 100644
index 000000000000..48a6c635c9d8
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CheckItemInLayeredNavigationActionGroup.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/OpenProductFromCategoryPageActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/OpenProductFromCategoryPageActionGroup.xml
new file mode 100644
index 000000000000..c76153f7be76
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/OpenProductFromCategoryPageActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/StorefrontAddToCartCustomOptionsProductPageActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/StorefrontAddToCartCustomOptionsProductPageActionGroup.xml
new file mode 100644
index 000000000000..9cf32a9103fa
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/StorefrontAddToCartCustomOptionsProductPageActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml
index e30eba182d56..a9f270c4d4de 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml
@@ -161,4 +161,18 @@
EavStockItem
CustomAttributeCategoryIds
+
+
+ magento.jpg
+ ProductOptionField
+ ProductOptionArea
+ ProductOptionFile
+ ProductOptionDropDown
+ ProductOptionRadiobutton
+ ProductOptionCheckbox
+ ProductOptionMultiSelect
+ ProductOptionDate
+ ProductOptionDateTime
+ ProductOptionTime
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml
new file mode 100644
index 000000000000..f2f6e1a6f552
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ OptionField
+ field
+ true
+ 1
+ 10
+ fixed
+ 0
+
+
+
+ OptionArea
+ area
+ true
+ 2
+ 10
+ percent
+ 0
+
+
+
+ OptionFile
+ file
+ true
+ 3
+ 9.99
+ fixed
+ png, jpg, gif
+ 0
+ 0
+
+
+
+ OptionDropDown
+ drop_down
+ 4
+ true
+ ProductOptionValueDropdown1
+ ProductOptionValueDropdown2
+
+
+
+ OptionRadioButtons
+ radio
+ 5
+ true
+ ProductOptionValueRadioButtons1
+ ProductOptionValueRadioButtons2
+
+
+
+ OptionCheckbox
+ checkbox
+ 6
+ true
+ ProductOptionValueCheckbox
+
+
+
+ OptionMultiSelect
+ multiple
+ 7
+ true
+ ProductOptionValueMultiSelect1
+ ProductOptionValueMultiSelect2
+
+
+
+ OptionDate
+ date
+ 8
+ true
+ 1234
+ fixed
+
+
+
+ OptionDateTime
+ date_time
+ 9
+ true
+ 0.00
+ fixed
+
+
+
+ OptionTime
+ time
+ 10
+ true
+ 0.00
+ percent
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionValueData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionValueData.xml
new file mode 100644
index 000000000000..615f6aaa705b
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionValueData.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+ OptionValueDropDown1
+ 1
+ 0.01
+ fixed
+
+
+ OptionValueDropDown2
+ 2
+ 0.01
+ percent
+
+
+ OptionValueRadioButtons1
+ 1
+ 99.99
+ fixed
+
+
+ OptionValueRadioButtons2
+ 2
+ 99.99
+ percent
+
+
+ OptionValueCheckbox
+ 1
+ 123
+ percent
+
+
+ OptionValueMultiSelect1
+ 1
+ 1
+ fixed
+
+
+ OptionValueMultiSelect2
+ 2
+ 2
+ fixed
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml
index 84f779d44e54..edbf1133d4fa 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml
@@ -14,7 +14,7 @@
string
string
integer
- integer
+ number
integer
integer
string
@@ -40,7 +40,7 @@
string
string
integer
- integer
+ number
integer
integer
string
@@ -69,7 +69,7 @@
string
string
integer
- integer
+ number
integer
integer
string
@@ -95,7 +95,7 @@
string
string
integer
- integer
+ number
integer
integer
string
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option-meta.xml
index 47764ed3b233..730caf69113d 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option-meta.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option-meta.xml
@@ -15,7 +15,7 @@
string
integer
boolean
- integer
+ number
string
string
string
@@ -33,7 +33,7 @@
string
integer
boolean
- integer
+ number
string
string
string
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option_value-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option_value-meta.xml
index 90c174b41023..47c5195b1917 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option_value-meta.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option_value-meta.xml
@@ -11,7 +11,7 @@
string
integer
- integer
+ number
string
string
integer
@@ -19,7 +19,7 @@
string
integer
- integer
+ number
string
string
integer
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml
index 9539bda75b01..26f56f6176f9 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml
@@ -10,7 +10,9 @@
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryWarningMessagesPopupSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryWarningMessagesPopupSection.xml
new file mode 100644
index 000000000000..b95f0d8bd214
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryWarningMessagesPopupSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCustomizableOptionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCustomizableOptionsSection.xml
new file mode 100644
index 000000000000..703ba081e312
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCustomizableOptionsSection.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormActionSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormActionSection.xml
index 39fb93ac8029..16e060557ab0 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormActionSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormActionSection.xml
@@ -5,6 +5,7 @@
* See COPYING.txt for license details.
*/
-->
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml
index 203451195828..08c3d42c0245 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml
@@ -12,6 +12,7 @@
+
@@ -143,4 +144,8 @@
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryMainSection.xml
index e2102ea351ca..d40fbbfc75d2 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryMainSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryMainSection.xml
@@ -11,11 +11,12 @@
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategorySidebarSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategorySidebarSection.xml
new file mode 100644
index 000000000000..406e9f5abd43
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategorySidebarSection.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontNavigationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontNavigationSection.xml
new file mode 100644
index 000000000000..285640ec6a30
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontNavigationSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml
index befd922ecad4..bdcbb509738a 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml
@@ -13,14 +13,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogTest.xml
similarity index 96%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogTest.xml
index 0f202e30c503..ed20d4026896 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGCatalogTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -49,7 +49,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductTest.xml
similarity index 97%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductTest.xml
index b2eeacb3bc82..1fc24f096b14 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -103,8 +103,8 @@
-
-
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateProductDuplicateUrlkeyTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateProductDuplicateUrlkeyTest.xml
index 9a95ce7ddcfd..9f16ce22745e 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateProductDuplicateUrlkeyTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateProductDuplicateUrlkeyTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml
new file mode 100644
index 000000000000..8495736b52e1
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateSimpleProductTest.xml
index 37a7aa627830..250e1c88fd0f 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateSimpleProductTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateSimpleProductTest.xml
@@ -39,6 +39,7 @@
+
@@ -68,4 +69,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml
similarity index 97%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml
index 8d6159c0f8ce..4e73647e596b 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -16,6 +16,7 @@
+
@@ -74,7 +75,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminMoveAnchoredCategoryTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminMoveAnchoredCategoryTest.xml
new file mode 100644
index 000000000000..ecdcd7fcfebe
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminMoveAnchoredCategoryTest.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml
index f95b81e8735f..7ce754e8f009 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml
@@ -12,12 +12,12 @@
-
-
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViews.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViews.xml
new file mode 100644
index 000000000000..36fd985da8cb
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViews.xml
@@ -0,0 +1,289 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontPurchaseProductWithCustomOptions.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontPurchaseProductWithCustomOptions.xml
new file mode 100644
index 000000000000..4e338c317870
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontPurchaseProductWithCustomOptions.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml
new file mode 100644
index 000000000000..3010da58b27a
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml
similarity index 99%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml
index 3c396aac369e..765730674461 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml
index 4aa6be2c4159..f7dbc78454a4 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml
index 686fadb18470..7492d78cccff 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/CheckoutActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/CheckoutActionGroup.xml
index c5b4463003bc..551ebeb1d0e0 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/CheckoutActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/CheckoutActionGroup.xml
@@ -144,4 +144,5 @@
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml
new file mode 100644
index 000000000000..e24b59e1cf11
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/StorefrontProductCartActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/StorefrontProductCartActionGroup.xml
index 945e70fa6241..d7ecdc31586b 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/StorefrontProductCartActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/StorefrontProductCartActionGroup.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/CheckoutPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/CheckoutPage.xml
index 69bb6bf57833..a0efb0668fe1 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/CheckoutPage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/CheckoutPage.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml
index b0e3af6b0244..2af5986cc092 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml
@@ -9,6 +9,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -25,5 +38,8 @@
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingMethodsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingMethodsSection.xml
index a4af5dc77ac3..a6e09494b742 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingMethodsSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingMethodsSection.xml
@@ -12,5 +12,7 @@
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingSection.xml
index 780353a8a17c..54fa168a1a4e 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingSection.xml
@@ -9,6 +9,7 @@
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CGuestUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CGuestUserTest.xml
index 8bee75f53c6b..1a056983ef3c 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CGuestUserTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CGuestUserTest.xml
@@ -35,8 +35,7 @@
-
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CLoggedInUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CLoggedInUserTest.xml
index 74f815181cf9..8d7bbdeff7fb 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CLoggedInUserTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/EndToEndB2CLoggedInUserTest.xml
@@ -35,8 +35,7 @@
-
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontBlockSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontBlockSection.xml
index 69d07ba32b9a..259eb61b4c4d 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontBlockSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontBlockSection.xml
@@ -10,6 +10,6 @@
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontCMSPageSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontCMSPageSection.xml
index 8f70dc8f1f98..b43bc436c498 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontCMSPageSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/StorefrontCMSPageSection.xml
@@ -10,6 +10,6 @@
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockTest.xml
similarity index 95%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockTest.xml
index 72d08737092c..5625dceeea05 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -54,6 +54,7 @@
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSPageCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSTest.xml
similarity index 92%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSPageCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSTest.xml
index 420361458271..c2ce1b1a5341 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSPageCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGCMSTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -45,6 +45,7 @@
+
@@ -52,7 +53,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockTest.xml
similarity index 99%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockTest.xml
index a4616d717dc7..4de72b6f2462 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSTest.xml
index 779703abea83..5bd82bfe4378 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSTest.xml
@@ -7,11 +7,10 @@
-->
-
+
-
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockTest.xml
similarity index 99%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockTest.xml
index bcb4b9141a90..818395b8376b 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml
index d8ed745dcbb2..ab1d60fb6a89 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml
index fd3e78115a40..a984c360c631 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml
index 9788d6836fb7..7e56daecb566 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml
index 0ad3533bfc65..d736350e186b 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml
index 2a23d7420f82..af1262a0113d 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml
index 0531320cddee..40311c809b2c 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml
@@ -8,7 +8,7 @@
-
+
@@ -17,7 +17,6 @@
-
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml
index 4e3ddb5ee478..5ae0ddcfb4ef 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsTest.xml
similarity index 99%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsTest.xml
index 3200089106eb..b6e4cdc61258 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml
similarity index 99%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml
index 0e220bbb4a13..8bd39c5d1e7a 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml
index b6b58537dc38..718728e737a5 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/ActionGroup/StorefrontCompareActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/ActionGroup/StorefrontCompareActionGroup.xml
index 2b27161dda5f..61bc922e6a7e 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/ActionGroup/StorefrontCompareActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/ActionGroup/StorefrontCompareActionGroup.xml
@@ -15,8 +15,8 @@
-
-
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminCreateConfigurableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminCreateTest.xml
similarity index 85%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminCreateConfigurableProductTest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminCreateTest.xml
index 0099e62c70d6..133c39f7bb44 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminCreateConfigurableProductTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminCreateTest.xml
@@ -8,35 +8,31 @@
-
+
+
+
-
-
-
-
+
+
+
+
-
+
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
@@ -45,55 +41,50 @@
-
+
+
+
-
+
-
-
-
-
-
-
-
-
+
@@ -106,25 +97,26 @@
+
-
-
-
-
-
+
+
+
-
-
+
+
+
-
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminRelatedProductsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminRelatedProductsTest.xml
index 00d53d7dbadb..74247c1a98c1 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminRelatedProductsTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminRelatedProductsTest.xml
@@ -72,12 +72,12 @@
-
+
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CGuestUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CGuestUserTest.xml
index d98ab9d50890..2102bf0a2419 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CGuestUserTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CGuestUserTest.xml
@@ -50,12 +50,12 @@
-
+
-
+
@@ -141,8 +141,7 @@
-
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CLoggedInUserTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CLoggedInUserTest.xml
index a75aa8c27f09..3d29b0e96c87 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CLoggedInUserTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/EndToEndB2CLoggedInUserTest.xml
@@ -50,12 +50,12 @@
-
+
-
+
@@ -141,8 +141,7 @@
-
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml
new file mode 100644
index 000000000000..a050161af2f4
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminCustomerPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminCustomerPage.xml
index 4e7457503fb1..4ee00034e867 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminCustomerPage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminCustomerPage.xml
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml
index e2f5187d012e..19f2cd54e799 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml
@@ -5,11 +5,10 @@
* See COPYING.txt for license details.
*/
-->
-
-
-
-
+ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminNewCustomerPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminNewCustomerPage.xml
index 79d16aa2fd7e..21307e7c3d0f 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminNewCustomerPage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminNewCustomerPage.xml
@@ -8,8 +8,8 @@
-
-
-
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontCustomerOrderViewPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontCustomerOrderViewPage.xml
new file mode 100644
index 000000000000..2e754d6da74c
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontCustomerOrderViewPage.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontHomePage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontHomePage.xml
index 4cebb33e6170..cbc04aa33b9a 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontHomePage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/StorefrontHomePage.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminNewCustomerAccountInformationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerAccountInformationSection.xml
similarity index 81%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminNewCustomerAccountInformationSection.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerAccountInformationSection.xml
index 1c1424f0eb23..362254f8a28d 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminNewCustomerAccountInformationSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerAccountInformationSection.xml
@@ -8,7 +8,8 @@
-
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridMainActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridMainActionsSection.xml
new file mode 100644
index 000000000000..3e43fdc923a0
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridMainActionsSection.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml
index 1b4ceb340e9f..314e749b1fad 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml
@@ -10,6 +10,6 @@
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerMainActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerMainActionsSection.xml
index 50eae9aa161b..cea098694771 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerMainActionsSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerMainActionsSection.xml
@@ -9,6 +9,6 @@
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminNewCustomerMainActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminNewCustomerMainActionsSection.xml
deleted file mode 100644
index e412dce0aa28..000000000000
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminNewCustomerMainActionsSection.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderSection.xml
new file mode 100644
index 000000000000..e12cbe0aa3ed
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderViewSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderViewSection.xml
index b6a4d1ce4790..4dee05cb28ed 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderViewSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/StorefrontCustomerOrderViewSection.xml
@@ -6,9 +6,12 @@
*/
-->
+ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
-
\ No newline at end of file
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Test/AdminCreateCustomerTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Test/AdminCreateCustomerTest.xml
index 5efa9c699b2b..32f882ce72bd 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Test/AdminCreateCustomerTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Test/AdminCreateCustomerTest.xml
@@ -26,11 +26,12 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml
index 53b44ddd3352..9f272d34a100 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml
@@ -13,6 +13,8 @@
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/StorefrontNewsletterSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/StorefrontNewsletterSection.xml
index f8cff8986a84..324b49997129 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/StorefrontNewsletterSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/StorefrontNewsletterSection.xml
@@ -10,6 +10,6 @@
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterTest.xml
similarity index 84%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterTest.xml
index 28f57332650e..bb27cfa5bb80 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddImageToWYSIWYGNewsletterTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -22,6 +22,7 @@
+
@@ -40,24 +41,23 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
-
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml
similarity index 99%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml
index 59e4da42bddb..312aef30c43b 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml
index 4df702f478cd..5395b0563740 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml
similarity index 98%
rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml
rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml
index 7ba781755546..1fe7db5e3f05 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Page/AdminOrderDetailsPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Page/AdminOrderDetailsPage.xml
index 4755c074a035..df8f4ed63787 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Page/AdminOrderDetailsPage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Page/AdminOrderDetailsPage.xml
@@ -21,5 +21,6 @@
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Section/AdminOrderItemsOrderedSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Section/AdminOrderItemsOrderedSection.xml
index 5f7c9ea73e04..6a49d79db201 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Section/AdminOrderItemsOrderedSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Section/AdminOrderItemsOrderedSection.xml
@@ -22,6 +22,7 @@
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Section/AdminOrderTotalSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Section/AdminOrderTotalSection.xml
new file mode 100644
index 000000000000..5bdcd6a62a89
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/Section/AdminOrderTotalSection.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml
index 1610e4dfa2cb..d9a98d4baa6c 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/AssertsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/AssertsTest.xml
index 1808424b8a46..359e2e94d8b7 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/AssertsTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/AssertsTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/MinimumTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/MinimumTest.xml
index e2e8beacb47b..8edb5a9f11c9 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/MinimumTest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/MinimumTest.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml
index 1a532119b66c..6e86f1b68dce 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminCreateStoreViewActionGroup.xml
@@ -11,6 +11,7 @@
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminDeleteStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminDeleteStoreViewActionGroup.xml
index 2e884ee262e6..794f626f45e6 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminDeleteStoreViewActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/AdminDeleteStoreViewActionGroup.xml
@@ -9,6 +9,9 @@
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/DeleteCustomStoreActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/DeleteCustomStoreActionGroup.xml
index d5fe3693f0a9..ec735091041e 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/DeleteCustomStoreActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/DeleteCustomStoreActionGroup.xml
@@ -5,6 +5,7 @@
* See COPYING.txt for license details.
*/
-->
+
@@ -17,6 +18,7 @@
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreData.xml
index 79b1785158c4..1d0fcfd57b01 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreData.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Data/StoreData.xml
@@ -21,4 +21,22 @@
group
customStoreGroup
+
+ EN
+ en
+ 1
+ null
+ add
+ group
+ customStoreGroup
+
+
+ FR
+ fr
+ 1
+ null
+ add
+ group
+ customStoreGroup
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreDeletePage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreDeletePage.xml
index 7b68d3c77e68..2d9e114f0fd6 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreDeletePage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreDeletePage.xml
@@ -6,7 +6,7 @@
*/
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreEditPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreEditPage.xml
index f6533b449475..6bcc6ea1596c 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreEditPage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreEditPage.xml
@@ -6,7 +6,7 @@
*/
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreGroupEditPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreGroupEditPage.xml
new file mode 100644
index 000000000000..186ab9fdc813
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreGroupEditPage.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStorePage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStorePage.xml
index fb6c61edb669..d9ba01a88fa4 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStorePage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStorePage.xml
@@ -6,7 +6,7 @@
*/
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml
index 6c62481d473a..b4dbfcc494a3 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Page/AdminSystemStoreViewPage.xml
@@ -6,7 +6,7 @@
*/
-->
-
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminStoreGroupActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminStoreGroupActionsSection.xml
new file mode 100644
index 000000000000..0490b4c52a07
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/AdminStoreGroupActionsSection.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/StorefrontHeaderSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/StorefrontHeaderSection.xml
new file mode 100644
index 000000000000..0af16b806d39
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/Section/StorefrontHeaderSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml
index 84ccf65eb040..35742ad90bb7 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Variable/ActionGroup/CreateCustomVariableActionGroup.xml
@@ -21,11 +21,11 @@
-
+
-
+
diff --git a/dev/tests/acceptance/tests/functional/_bootstrap.php b/dev/tests/acceptance/tests/functional/_bootstrap.php
index b142e36191e4..ac7a13ea41d2 100644
--- a/dev/tests/acceptance/tests/functional/_bootstrap.php
+++ b/dev/tests/acceptance/tests/functional/_bootstrap.php
@@ -6,8 +6,3 @@
// Here you can initialize variables that will be available to your tests
require_once dirname(__DIR__) . '/_bootstrap.php';
-
-$RELATIVE_TESTS_MODULE_PATH = '/Magento/FunctionalTest';
-
-defined('TESTS_BP') || define('TESTS_BP', __DIR__);
-defined('TESTS_MODULE_PATH') || define('TESTS_MODULE_PATH', TESTS_BP . $RELATIVE_TESTS_MODULE_PATH);
diff --git a/dev/tests/functional/etc/events.xml b/dev/tests/functional/etc/events.xml
index 5f6a771237a8..677a4c76ba88 100644
--- a/dev/tests/functional/etc/events.xml
+++ b/dev/tests/functional/etc/events.xml
@@ -48,4 +48,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml
index 32e186b865eb..3d0889baaca5 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct.xml
@@ -547,5 +547,59 @@
- checkbox_with_one_100_percent_price
+
+
+ Bundle fixed product %isolation%
+ bundle-fixed-product-%isolation%
+ sku_bundle_fixed_product_%isolation%
+ No
+ No
+ Together
+ 1
+
+ - 110
+ - default_fixed
+
+
+ - In Stock
+
+
+ -
+
- default
+
+
+
+ - default_subcategory
+
+
+ - simple_product_options_with_percent_price
+
+
+ - checkbox_with_one_100_percent_price
+
+
+
+
+ Bundle dynamic product %isolation%
+ bundle-dynamic-product-%isolation%
+ sku_bundle_dynamic_product_%isolation%
+ Yes
+ Yes
+ Together
+
+ - In Stock
+
+
+ - bundle_dynamic_with_category
+
+
+ -
+
- default
+
+
+
+ - dynamic_with_two_required_options_assigned_products_with_special_price
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductVirtual.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductVirtual.xml
index 67da24bb11fe..d2d9ce5313f4 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductVirtual.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductVirtual.xml
@@ -248,5 +248,23 @@
- virtual_order_default
+
+
+
+ - default
+
+ Virtual Product %isolation%
+ sku_virtual_product_%isolation%
+
+ - 10
+
+ This item has no weight
+
+ - 99
+ - In Stock
+
+ virtual-product-%isolation%
+ 9
+
diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php
index 52e35dd4f271..11d290a05cca 100755
--- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php
+++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php
@@ -42,7 +42,7 @@ public function fillData(\Magento\ConfigurableProduct\Test\Fixture\ConfigurableP
$confAttrSource = $confAttrData['source'];
$attributes = $confAttrSource->getAttributes();
- foreach ($options as $option) {
+ foreach (array_reverse($options) as $option) {
if (!isset($attributes[$option['title']])
|| stripos($attributes[$option['title']]->getFrontendInput(), "swatch") === false
) {
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 a872233271cc..5548443b50c4 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
@@ -85,6 +85,20 @@ class Product extends Form
*/
protected $priceInGrid = '.products-grid .price';
+ /**
+ * Locator value for item Regular Price.
+ *
+ * @var string
+ */
+ private $regularPrice = '.old-price [data-price-type="oldPrice"] .price';
+
+ /**
+ * Locator value for item Regular Price Label.
+ *
+ * @var string
+ */
+ private $regularPriceLabel = '.old-price .price-label';
+
/**
* Fill item with details.
*
@@ -170,17 +184,51 @@ public function hoverProductBlock()
}
/**
- * Returns product price
+ * Returns product price.
+ *
+ * @param string $currency
+ * @return string
+ */
+ public function getPrice(string $currency = '$'): string
+ {
+ return $this->getPriceBySelector($this->price, $currency);
+ }
+
+ /**
+ * Returns product regular price.
+ *
+ * @param string $currency
+ * @return string
+ */
+ public function getRegularPrice(string $currency = '$'): string
+ {
+ return $this->getPriceBySelector($this->regularPrice, $currency);
+ }
+
+ /**
+ * Returns product price by selector.
*
+ * @param string $selector
* @param string $currency
* @return string
*/
- public function getPrice($currency = '$')
+ private function getPriceBySelector(string $selector, string $currency = '$'): string
{
- $price = $this->_rootElement->find($this->price)->getText();
+ $price = $this->_rootElement->find($selector)->getText();
+
return str_replace($currency, '', $price);
}
+ /**
+ * Returns product regular price label.
+ *
+ * @return string
+ */
+ public function getPriceLabel(): string
+ {
+ return (string)$this->_rootElement->find($this->regularPriceLabel)->getText();
+ }
+
/**
* Get Wish List data for the Product.
*
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php
index 615998794065..ae994f84c47f 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php
@@ -32,6 +32,7 @@ public function processAssert(
WishlistIndex $wishlistIndex,
InjectableFixture $product
) {
+ $cmsIndex->open();
$cmsIndex->getLinksBlock()->openLink('My Account');
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductRegularPriceOnStorefront.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductRegularPriceOnStorefront.php
new file mode 100644
index 000000000000..68e30e13558c
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductRegularPriceOnStorefront.php
@@ -0,0 +1,107 @@
+open();
+ $cmsIndex->getLinksBlock()->openLink('My Account');
+ $customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List');
+
+ $productRegularPrice = 0;
+ if ($product instanceof GroupedProduct) {
+ $associatedProducts = $product->getAssociated();
+
+ /** @var \Magento\Catalog\Test\Fixture\CatalogProductSimple $associatedProduct */
+ foreach ($associatedProducts['products'] as $key => $associatedProduct) {
+ $qty = $associatedProducts['assigned_products'][$key]['qty'];
+ $price = $associatedProduct->getPrice();
+ $productRegularPrice += $qty * $price;
+ }
+ } elseif ($product instanceof BundleProduct) {
+ $bundleSelection = (array)$product->getBundleSelections();
+ foreach ($bundleSelection['products'] as $bundleOption) {
+ $regularBundleProductPrice = 0;
+ /** @var \Magento\Catalog\Test\Fixture\CatalogProductSimple $bundleProduct */
+ foreach ($bundleOption as $bundleProduct) {
+ $checkoutData = $bundleProduct->getCheckoutData();
+ $bundleProductPrice = $checkoutData['qty'] * $checkoutData['cartItem']['price'];
+ if (0 === $regularBundleProductPrice) {
+ $regularBundleProductPrice = $bundleProductPrice;
+ } else {
+ $regularBundleProductPrice = max([$bundleProductPrice, $regularBundleProductPrice]);
+ }
+ }
+ $productRegularPrice += $regularBundleProductPrice;
+ }
+ } else {
+ $productRegularPrice = (float)$product->getPrice();
+ }
+
+ $productItem = $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product);
+ $wishListProductRegularPrice = (float)$productItem->getRegularPrice();
+
+ \PHPUnit\Framework\Assert::assertEquals(
+ $this->regularPriceLabel,
+ $productItem->getPriceLabel(),
+ 'Wrong product regular price is displayed.'
+ );
+
+ \PHPUnit\Framework\Assert::assertNotEmpty(
+ $wishListProductRegularPrice,
+ 'Regular Price for "' . $product->getName() . '" is not correct.'
+ );
+
+ \PHPUnit\Framework\Assert::assertEquals(
+ $productRegularPrice,
+ $wishListProductRegularPrice,
+ 'Wrong product regular price is displayed.'
+ );
+ }
+
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return string
+ */
+ public function toString(): string
+ {
+ return 'Product is displayed with correct regular price.';
+ }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml
index 6931fdbf5c14..06b1a6078d5c 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml
@@ -59,5 +59,61 @@
+
+
+ - catalogProductSimple::withSpecialPrice
+
+
+
+
+
+
+
+
+ - catalogProductVirtual::product_with_special_price
+
+
+
+
+
+
+
+
+ -
+ downloadableProduct::with_two_separately_links_special_price_and_category
+
+
+
+
+
+
+
+
+
+ - groupedProduct::grouped_product_with_special_price
+
+
+
+
+
+
+
+
+ - configurableProduct::product_with_special_price
+
+
+
+
+
+
+
+
+ - bundleProduct::with_special_price_and_custom_options
+
+
+
+
+
+
diff --git a/dev/tests/integration/etc/di/preferences/ce.php b/dev/tests/integration/etc/di/preferences/ce.php
index d5aaa7e73082..b871fe190591 100644
--- a/dev/tests/integration/etc/di/preferences/ce.php
+++ b/dev/tests/integration/etc/di/preferences/ce.php
@@ -24,5 +24,7 @@
\Magento\Framework\App\ResourceConnection\ConnectionAdapterInterface::class =>
\Magento\TestFramework\Db\ConnectionAdapter::class,
\Magento\Framework\Filesystem\DriverInterface::class => \Magento\Framework\Filesystem\Driver\File::class,
- \Magento\Framework\App\Config\ScopeConfigInterface::class => \Magento\TestFramework\App\Config::class
+ \Magento\Framework\App\Config\ScopeConfigInterface::class => \Magento\TestFramework\App\Config::class,
+ \Magento\Framework\App\ResourceConnection\ConfigInterface::class =>
+ \Magento\Framework\App\ResourceConnection\Config::class,
];
diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Adapter/Mysql.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Adapter/Mysql.php
index bb2ea585ec9f..6407db749585 100644
--- a/dev/tests/integration/framework/Magento/TestFramework/Db/Adapter/Mysql.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Adapter/Mysql.php
@@ -4,13 +4,14 @@
* See COPYING.txt for license details.
*/
+// @codingStandardsIgnoreFile
+
/**
* See \Magento\TestFramework\Db\Adapter\TransactionInterface
*/
namespace Magento\TestFramework\Db\Adapter;
-class Mysql extends \Magento\Framework\DB\Adapter\Pdo\Mysql implements
- \Magento\TestFramework\Db\Adapter\TransactionInterface
+class Mysql extends \Magento\Framework\DB\Adapter\Pdo\Mysql implements \Magento\TestFramework\Db\Adapter\TransactionInterface
{
/**
* @var int
@@ -49,14 +50,4 @@ public function rollbackTransparentTransaction()
$this->_levelAdjustment -= 1;
return $this->rollback();
}
-
- /**
- * Adjust transaction level with "transparent" counter
- *
- * @return int
- */
- public function getTransactionLevel()
- {
- return parent::getTransactionLevel() - $this->_levelAdjustment;
- }
}
diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Db/Adapter/TransactionInterfaceTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Db/Adapter/TransactionInterfaceTest.php
index 1ddfbfafed13..ff06dd044a7d 100644
--- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Db/Adapter/TransactionInterfaceTest.php
+++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Db/Adapter/TransactionInterfaceTest.php
@@ -26,7 +26,7 @@ public function testBeginTransparentTransaction($class)
$connectionMock->expects($this->once())->method('beginTransaction')->will($this->returnValue($uniqid));
$this->assertSame(0, $connectionMock->getTransactionLevel());
$this->assertEquals($uniqid, $connectionMock->beginTransparentTransaction());
- $this->assertSame(-1, $connectionMock->getTransactionLevel());
+ $this->assertSame(0, $connectionMock->getTransactionLevel());
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php
new file mode 100644
index 000000000000..35c470282937
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php
@@ -0,0 +1,80 @@
+objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+ $this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $this->product = $this->productRepository->get('bundle-product', false, null, true);
+ $this->product->setPriceType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC)->save();
+ $this->objectManager->get(\Magento\Framework\Registry::class)->unregister('product');
+ $this->objectManager->get(\Magento\Framework\Registry::class)->register('product', $this->product);
+
+ $this->block = $this->objectManager->get(
+ \Magento\Framework\View\LayoutInterface::class
+ )->createBlock(
+ \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle::class
+ );
+ }
+
+ /**
+ * Test for method \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle::getJsonConfig
+ *
+ * @return void
+ */
+ public function testGetJsonConfig()
+ {
+ $option = $this->productRepository->get('simple');
+ $option->setSpecialPrice(5)
+ ->save();
+ $config = json_decode($this->block->getJsonConfig(), true);
+ $options = current($config['options']);
+ $selection = current($options['selections']);
+ $this->assertEquals(10, $selection['prices']['oldPrice']['amount']);
+ $this->assertEquals(5, $selection['prices']['basePrice']['amount']);
+ $this->assertEquals(5, $selection['prices']['finalPrice']['amount']);
+ }
+
+ protected function tearDown()
+ {
+ $this->objectManager->get(\Magento\Framework\Registry::class)->unregister('product');
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Category/ProductIndexerTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Category/ProductIndexerTest.php
index c877ae1f388f..1620297a4b42 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Category/ProductIndexerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Category/ProductIndexerTest.php
@@ -8,10 +8,7 @@
use Magento\Catalog\Model\Category;
/**
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
- * @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php
* @magentoAppIsolation enabled
- * @magentoDbIsolation enabled
*/
class ProductIndexerTest extends \PHPUnit\Framework\TestCase
{
@@ -57,6 +54,9 @@ protected function setUp()
/**
* @magentoAppArea adminhtml
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
+ * @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php
+ * @magentoDbIsolation disabled
*/
public function testReindex()
{
@@ -88,6 +88,9 @@ public function testReindex()
/**
* @magentoAppArea adminhtml
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
+ * @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php
+ * @magentoDbIsolation disabled
*/
public function testCategoryMove()
{
@@ -130,8 +133,10 @@ public function testCategoryMove()
/**
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
* @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php
* @depends testReindex
+ * @magentoDbIsolation disabled
*/
public function testCategoryDelete()
{
@@ -161,7 +166,9 @@ public function testCategoryDelete()
/**
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
* @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php
+ * @magentoDbIsolation disabled
*/
public function testCategoryCreate()
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php
index 08dc1a0132b5..75fbf827a3a0 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundlePriceCalculatorTest.php
@@ -7,7 +7,6 @@
namespace Magento\Bundle\Model\Product;
/**
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php
* @magentoAppArea frontend
*/
class DynamicBundlePriceCalculatorTest extends BundlePriceAbstract
@@ -17,6 +16,8 @@ class DynamicBundlePriceCalculatorTest extends BundlePriceAbstract
* @param array $expectedResults
* @dataProvider getTestCases
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults)
{
@@ -56,6 +57,8 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec
* @dataProvider getTestCases
* @magentoAppIsolation enabled
* @magentoConfigFixture current_store catalog/price/scope 1
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForDynamicBundleInWebsiteScope(array $strategyModifiers, array $expectedResults)
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php
index 0e21bcf8369f..e95c9f6d1e2c 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php
@@ -7,7 +7,6 @@
namespace Magento\Bundle\Model\Product;
/**
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php
* @magentoAppArea frontend
*/
class DynamicBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract
@@ -17,6 +16,8 @@ class DynamicBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract
* @param array $expectedResults
* @dataProvider getTestCases
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product_with_special_price.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults)
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php
index 3d1aa54d518f..cf15ee5602b7 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithTierPriceCalculatorTest.php
@@ -9,7 +9,6 @@
use \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory;
/**
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php
* @magentoAppArea frontend
*/
class DynamicBundleWithTierPriceCalculatorTest extends BundlePriceAbstract
@@ -28,6 +27,8 @@ protected function setUp()
* @param array $expectedResults
* @dataProvider getTestCases
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/dynamic_bundle_product.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForDynamicBundle(array $strategyModifiers, array $expectedResults)
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php
index 64e88ffb1a26..325f663c5e1d 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php
@@ -9,7 +9,6 @@
use \Magento\Bundle\Api\Data\LinkInterface;
/**
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
* @magentoAppArea frontend
*/
class FixedBundlePriceCalculatorTest extends BundlePriceAbstract
@@ -19,6 +18,8 @@ class FixedBundlePriceCalculatorTest extends BundlePriceAbstract
* @param array $expectedResults
* @dataProvider getTestCases
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults)
{
@@ -54,6 +55,8 @@ public function testPriceForFixedBundle(array $strategyModifiers, array $expecte
* @dataProvider getTestCases
* @magentoAppIsolation enabled
* @magentoConfigFixture current_store catalog/price/scope 1
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForFixedBundleInWebsiteScope(array $strategyModifiers, array $expectedResults)
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php
index 5f2827fc6ec1..b3c46c75bcfb 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithCatalogPriceRuleCalculatorTest.php
@@ -9,7 +9,6 @@
use \Magento\Bundle\Api\Data\LinkInterface;
/**
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_catalog_rule.php
* @magentoAppArea frontend
*/
class FixedBundleWithCatalogPriceRuleCalculatorTest extends BundlePriceAbstract
@@ -19,6 +18,8 @@ class FixedBundleWithCatalogPriceRuleCalculatorTest extends BundlePriceAbstract
* @param array $expectedResults
* @dataProvider getTestCases
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_catalog_rule.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults)
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php
index 7f1932203959..1113b46b1cbe 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithSpecialPriceCalculatorTest.php
@@ -9,7 +9,6 @@
use \Magento\Bundle\Api\Data\LinkInterface;
/**
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php
* @magentoAppArea frontend
*/
class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract
@@ -19,6 +18,8 @@ class FixedBundleWithSpecialPriceCalculatorTest extends BundlePriceAbstract
* @param array $expectedResults
* @dataProvider getTestCases
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product_with_special_price.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults)
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php
index 95ee123a2172..103304a86f2d 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundleWithTierPriceCalculatorTest.php
@@ -12,7 +12,6 @@
/**
* Class FixedBundleWithTierPRiceCalculatorTest
* @package Magento\Bundle\Model\Product
- * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
* @magentoAppArea frontend
*/
class FixedBundleWithTierPriceCalculatorTest extends BundlePriceAbstract
@@ -31,6 +30,8 @@ protected function setUp()
* @param array $expectedResults
* @dataProvider getTestCases
* @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Bundle/_files/PriceCalculator/fixed_bundle_product.php
+ * @magentoDbIsolation disabled
*/
public function testPriceForFixedBundle(array $strategyModifiers, array $expectedResults)
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/TypeTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/TypeTest.php
index f9e8e7528723..51250580eb6a 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/TypeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Product/TypeTest.php
@@ -51,6 +51,7 @@ protected function setUp()
* @magentoDataFixture Magento/Bundle/_files/product.php
* @covers \Magento\Indexer\Model\Indexer::reindexAll
* @covers \Magento\Bundle\Model\Product\Type::getSearchableData
+ * @magentoDbIsolation disabled
*/
public function testPrepareProductIndexForBundleProduct()
{
@@ -66,6 +67,7 @@ public function testPrepareProductIndexForBundleProduct()
/**
* @magentoDataFixture Magento/Bundle/_files/product_with_multiple_options.php
* @covers \Magento\Bundle\Model\Product\Type::getOptionsCollection
+ * @magentoDbIsolation disabled
*/
public function testGetOptionsCollection()
{
@@ -81,6 +83,7 @@ public function testGetOptionsCollection()
/**
* @magentoDataFixture Magento/Bundle/_files/product.php
* @covers \Magento\Bundle\Model\Product\Type::getParentIdsByChild()
+ * @magentoDbIsolation disabled
*/
public function testGetParentIdsByChild()
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/ProductTest.php
index 901e3db31b55..9654df29bcb4 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/Model/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/ProductTest.php
@@ -100,6 +100,7 @@ public function testIsComposite()
*
* @magentoDataFixture Magento/Bundle/_files/product_with_multiple_options.php
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
+ * @magentoDbIsolation disabled
*/
public function testMultipleStores()
{
diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/product_with_multiple_options_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/product_with_multiple_options_rollback.php
index c13f84e414a4..3748666b2513 100644
--- a/dev/tests/integration/testsuite/Magento/Bundle/_files/product_with_multiple_options_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/product_with_multiple_options_rollback.php
@@ -12,11 +12,11 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);
-/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
-$product->load(3);
-if ($product->getId()) {
- $product->delete();
+try {
+ $product = $productRepository->get('bundle-product');
+ $productRepository->delete($product);
+} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
+ //Product already removed
}
$registry->unregister('isSecureArea');
diff --git a/dev/tests/integration/testsuite/Magento/Captcha/Observer/CaseCaptchaIsRequiredAfterFailedLoginAttemptsTest.php b/dev/tests/integration/testsuite/Magento/Captcha/Observer/CaseCaptchaIsRequiredAfterFailedLoginAttemptsTest.php
index 32fab1f456b3..d15f2deebf99 100644
--- a/dev/tests/integration/testsuite/Magento/Captcha/Observer/CaseCaptchaIsRequiredAfterFailedLoginAttemptsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Captcha/Observer/CaseCaptchaIsRequiredAfterFailedLoginAttemptsTest.php
@@ -7,6 +7,11 @@
use Magento\Framework\Message\MessageInterface;
+/**
+ * Test captcha observer behavior.
+ *
+ * @magentoAppArea adminhtml
+ */
class CaseCaptchaIsRequiredAfterFailedLoginAttemptsTest extends \Magento\TestFramework\TestCase\AbstractController
{
/**
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php
index f68e509e4a8d..6c735e52f8c1 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListTest.php
@@ -10,6 +10,7 @@
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoAppArea frontend
+ * @magentoDbIsolation disabled
*/
class ListTest extends \PHPUnit\Framework\TestCase
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php
index 12ce790f17eb..6d5e2c9767ed 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php
@@ -9,6 +9,7 @@
* Test class for \Magento\Catalog\Block\Product\New.
*
* @magentoDataFixture Magento/Catalog/_files/products_new.php
+ * @magentoDbIsolation disabled
*/
class NewTest extends \PHPUnit\Framework\TestCase
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php
index 329e880c7a52..9f0f04508e46 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php
@@ -9,6 +9,7 @@
* Test class for \Magento\Catalog\Block\Product\List\Related.
*
* @magentoDataFixture Magento/Catalog/_files/products_related.php
+ * @magentoDbIsolation disabled
*/
class RelatedTest extends \PHPUnit\Framework\TestCase
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/UpsellTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/UpsellTest.php
index 8099f59b5527..57ccb48b8df6 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/UpsellTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/UpsellTest.php
@@ -9,6 +9,7 @@
* Test class for \Magento\Catalog\Block\Product\List\Upsell.
*
* @magentoDataFixture Magento/Catalog/_files/products_upsell.php
+ * @magentoDbIsolation disabled
*/
class UpsellTest extends \PHPUnit\Framework\TestCase
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Console/Command/ProductAttributesCleanUpTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Console/Command/ProductAttributesCleanUpTest.php
index 038eee6f5e94..88b59570457d 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Console/Command/ProductAttributesCleanUpTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Console/Command/ProductAttributesCleanUpTest.php
@@ -50,6 +50,7 @@ public function setUp()
* @magentoDataFixture Magento/Store/_files/website.php
* @magentoDataFixture Magento/Store/_files/fixture_store_with_catalogsearch_index.php
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testExecute()
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php
index 3e9e39425fb8..cea49d940cb6 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/AttributeTest.php
@@ -14,6 +14,7 @@ class AttributeTest extends \Magento\TestFramework\TestCase\AbstractBackendContr
* @covers \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Save::execute
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveActionRedirectsSuccessfully()
{
@@ -51,6 +52,7 @@ public function testSaveActionRedirectsSuccessfully()
* @dataProvider saveActionVisibilityAttrDataProvider
* @param array $attributes
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveActionChangeVisibility($attributes)
{
@@ -93,6 +95,7 @@ public function testSaveActionChangeVisibility($attributes)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Catalog/_files/product_simple_duplicated.php
+ * @magentoDbIsolation disabled
*/
public function testValidateActionWithMassUpdate($attributes)
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php
index 7fd2f62a0649..87b8d4a117e2 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/CategoryTest.php
@@ -55,6 +55,7 @@ public function getViewActionDataProvider()
/**
* @dataProvider getViewActionDataProvider
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories_with_product_ids.php
+ * @magentoDbIsolation disabled
*/
public function testViewAction($categoryId, array $expectedHandles, array $expectedContent)
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php
index e871ee8579a7..cc04e48adb62 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php
@@ -11,6 +11,8 @@
/**
* @magentoDataFixture Magento/Catalog/controllers/_files/products.php
*
+ * @magentoDbIsolation disabled
+ *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CompareTest extends \Magento\TestFramework\TestCase\AbstractController
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/ViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/ViewTest.php
index 93e5314055da..92a782deee65 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/ViewTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/ViewTest.php
@@ -7,6 +7,7 @@
/**
* @magentoDataFixture Magento/Catalog/controllers/_files/products.php
+ * @magentoDbIsolation disabled
*/
class ViewTest extends \Magento\TestFramework\TestCase\AbstractController
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Cron/DeleteOutdatedPriceValuesTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Cron/DeleteOutdatedPriceValuesTest.php
index 7b8d9e592895..6486c0089c20 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Cron/DeleteOutdatedPriceValuesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Cron/DeleteOutdatedPriceValuesTest.php
@@ -49,7 +49,7 @@ public function setUp()
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
* @magentoConfigFixture current_store catalog/price/scope 1
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testExecute()
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php
index 37648cb7e1ef..f99344904f68 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php
@@ -25,6 +25,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/Catalog/_files/multiple_products.php
+ * @magentoDbIsolation disabled
*/
public function testGetListUrl()
{
@@ -97,6 +98,7 @@ public function testGetItemCollection()
* getItemCount()
* hasItems()
* @magentoDataFixture Magento/Catalog/_files/multiple_products.php
+ * @magentoDbIsolation disabled
*/
public function testCalculate()
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
index cb5b77421368..6efd2638c0d5 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
@@ -10,7 +10,7 @@
/**
* @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php
* @magentoDataFixture Magento/Catalog/_files/indexer_catalog_products.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
class ProductTest extends \PHPUnit\Framework\TestCase
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/FlatTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/FlatTest.php
index 8b4e0bce35d6..cb2f436ae90a 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/FlatTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/FlatTest.php
@@ -5,10 +5,13 @@
*/
namespace Magento\Catalog\Model\Indexer;
+use Magento\TestFramework\Helper\Bootstrap;
+
/**
+ * @magentoAppIsolation enabled
* @magentoDbIsolation enabled
*/
-class FlatTest extends \PHPUnit\Framework\TestCase
+class FlatTest extends \Magento\TestFramework\Indexer\TestCase
{
/**
* @var int
@@ -56,6 +59,16 @@ class FlatTest extends \PHPUnit\Framework\TestCase
public static function setUpBeforeClass()
{
self::loadAttributeCodes();
+
+ $db = Bootstrap::getInstance()->getBootstrap()
+ ->getApplication()
+ ->getDbInstance();
+ if (!$db->isDbDumpExists()) {
+ throw new \LogicException('DB dump does not exist.');
+ }
+ $db->restoreFromDbDump();
+
+ parent::setUpBeforeClass();
}
public function testEntityItemsBefore()
@@ -71,6 +84,8 @@ public function testEntityItemsBefore()
*
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true
* @magentoAppArea frontend
+ *
+ * @magentoDbIsolation disabled
*/
public function testReindexAll()
{
@@ -105,6 +120,8 @@ public function testFlatItemsBefore()
* Populate EAV category data`
*
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true
+ *
+ * @magentoDbIsolation disabled
*/
public function testCreateCategory()
{
@@ -115,6 +132,8 @@ public function testCreateCategory()
$this->assertEquals(self::$defaultCategoryId, $result[self::$categoryOne]->getParentId());
$this->assertEquals(self::$categoryOne, $result[self::$categoryTwo]->getParentId());
+
+ $this->removeSubCategoriesInDefaultCategory();
}
/**
@@ -123,6 +142,8 @@ public function testCreateCategory()
*
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true
* @magentoAppArea frontend
+ *
+ * @magentoDbIsolation disabled
*/
public function testFlatAfterCreate()
{
@@ -150,18 +171,24 @@ public function testFlatAfterCreate()
$this->assertEquals(self::$categoryOne, $categoryTwo->getParentId());
$this->checkCategoryData($categoryTwo);
+
+ $this->removeSubCategoriesInDefaultCategory();
}
/**
* Move category and populate EAV category data
*
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true
+ *
+ * @magentoDbIsolation disabled
*/
public function testMoveCategory()
{
$this->moveSubCategoriesInDefaultCategory();
$categoryTwo = $this->getLoadedCategory(self::$categoryTwo);
$this->assertEquals($categoryTwo->getData('parent_id'), self::$defaultCategoryId);
+
+ $this->removeSubCategoriesInDefaultCategory();
}
/**
@@ -170,6 +197,8 @@ public function testMoveCategory()
*
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_category true
* @magentoAppArea frontend
+ *
+ * @magentoDbIsolation disabled
*/
public function testFlatAfterMove()
{
@@ -188,6 +217,8 @@ public function testFlatAfterMove()
$categoryTwo = $this->getLoadedCategory(self::$categoryTwo);
$this->checkCategoryData($categoryTwo);
+
+ $this->removeSubCategoriesInDefaultCategory();
}
/**
@@ -357,7 +388,17 @@ private function deleteSubCategoriesInDefaultCategory()
{
$this->executeWithFlatEnabledInAdminArea(function () {
$this->createSubCategoriesInDefaultCategory();
+ $this->removeSubCategoriesInDefaultCategory();
+ });
+ }
+ /**
+ * Invoke business logic:
+ * - delete created categories
+ */
+ private function removeSubCategoriesInDefaultCategory()
+ {
+ $this->executeWithFlatEnabledInAdminArea(function () {
$category = $this->instantiateCategoryModel();
$category->load(self::$categoryTwo);
$category->delete();
@@ -427,4 +468,12 @@ private function getActiveConfigInstance()
\Magento\Framework\App\Config\MutableScopeConfigInterface::class
);
}
+
+ /**
+ * teardown
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Eav/Action/FullTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Eav/Action/FullTest.php
index 070141063b33..d0a4f2ead4d6 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Eav/Action/FullTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Eav/Action/FullTest.php
@@ -5,16 +5,31 @@
*/
namespace Magento\Catalog\Model\Indexer\Product\Eav\Action;
+use Magento\TestFramework\Helper\Bootstrap;
+
/**
* Full reindex Test
*/
-class FullTest extends \PHPUnit\Framework\TestCase
+class FullTest extends \Magento\TestFramework\Indexer\TestCase
{
/**
* @var \Magento\Catalog\Model\Indexer\Product\Eav\Processor
*/
protected $_processor;
+ public static function setUpBeforeClass()
+ {
+ $db = Bootstrap::getInstance()->getBootstrap()
+ ->getApplication()
+ ->getDbInstance();
+ if (!$db->isDbDumpExists()) {
+ throw new \LogicException('DB dump does not exist.');
+ }
+ $db->restoreFromDbDump();
+
+ parent::setUpBeforeClass();
+ }
+
protected function setUp()
{
$this->_processor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
@@ -23,6 +38,7 @@ protected function setUp()
}
/**
+ * @magentoAppArea adminhtml
* @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
@@ -36,6 +52,11 @@ public function testReindexAll()
$this->assertTrue($attr->isIndexable());
+ $priceIndexerProcessor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Catalog\Model\Indexer\Product\Price\Processor::class
+ );
+ $priceIndexerProcessor->reindexAll();
+
$this->_processor->reindexAll();
$categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
@@ -61,4 +82,12 @@ public function testReindexAll()
$this->assertEquals(1, $product->getWeight());
}
}
+
+ /**
+ * teardown
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php
index bfdc9b85a30b..eb9e5664e0d9 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php
@@ -31,7 +31,7 @@ protected function setUp()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
index ff3458ec3f22..2b7c416f6be1 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php
@@ -44,7 +44,7 @@ protected function setUp()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoDataFixture Magento/Catalog/_files/row_fixture.php
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
* @magentoAppArea frontend
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
index 35d593bea345..baf0a0c1a9c4 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php
@@ -31,7 +31,7 @@ protected function setUp()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
index c6a5c50577ae..bbaf45393870 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
@@ -85,7 +85,7 @@ public function testDeleteAttribute()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceTest.php
index 19dd1c0234b6..d8e49d1e3436 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceTest.php
@@ -38,7 +38,7 @@ protected function setUp()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoDataFixture Magento/Catalog/_files/category_product.php
*/
public function testTierPrice()
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php
index d978d65ab1c6..5721982ab8dc 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php
@@ -10,7 +10,7 @@
*
* @magentoDataFixture Magento/Catalog/_files/categories.php
* @magentoAppIsolation enabled
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CategoryTest extends \PHPUnit\Framework\TestCase
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/AttributeTest.php
index 697f956c9e53..e1b20a63fa4f 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/AttributeTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/AttributeTest.php
@@ -8,6 +8,8 @@
/**
* Test class for \Magento\Catalog\Model\Layer\Filter\Attribute.
*
+ * @magentoDbIsolation disabled
+ *
* @magentoDataFixture Magento/Catalog/Model/Layer/Filter/_files/attribute_with_option.php
*/
class AttributeTest extends \PHPUnit\Framework\TestCase
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php
index aacb5f31f8d1..0090ff38c2a4 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php
@@ -95,6 +95,11 @@ public function testGetName()
$this->assertEquals('Category', $this->_model->getName());
}
+ /**
+ * @magentoDataFixture Magento/Catalog/_files/categories.php
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
+ */
public function testGetItems()
{
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php
index f1a04c4d197f..a6d1aa5be3e3 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php
@@ -9,9 +9,7 @@
/**
* Test class for \Magento\Catalog\Model\Layer\Filter\DataProvider\Price.
*
- * @magentoDataFixture Magento/Catalog/_files/categories.php
* @magentoAppIsolation enabled
- * @magentoDbIsolation enabled
*/
class PriceTest extends \PHPUnit\Framework\TestCase
{
@@ -34,6 +32,9 @@ protected function setUp()
}
/**
+ * @magentoDataFixture Magento/Catalog/_files/categories.php
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation auto
*/
public function testGetPriceRangeAuto()
@@ -42,6 +43,9 @@ public function testGetPriceRangeAuto()
}
/**
+ * @magentoDataFixture Magento/Catalog/_files/categories.php
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual
* @magentoConfigFixture current_store catalog/layered_navigation/price_range_step 1.5
*/
@@ -51,6 +55,11 @@ public function testGetPriceRangeManual()
$this->assertEquals(1.5, $this->_model->getPriceRange());
}
+ /**
+ * @magentoDataFixture Magento/Catalog/_files/categories.php
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
+ */
public function testGetMaxPriceInt()
{
$this->assertEquals(45.00, $this->_model->getMaxPrice());
@@ -70,6 +79,8 @@ public function getRangeItemCountsDataProvider()
}
/**
+ * @magentoDataFixture Magento/Catalog/_files/categories.php
+ * @magentoDbIsolation disabled
* @dataProvider getRangeItemCountsDataProvider
*/
public function testGetRangeItemCounts($inputRange, $expectedItemCounts)
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php
index e0819b1803c3..1964b465a914 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmAdvancedTest.php
@@ -10,13 +10,12 @@
/**
* Test class for \Magento\Catalog\Model\Layer\Filter\Price.
- *
- * @magentoDataFixture Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced.php
*/
class AlgorithmAdvancedTest extends \PHPUnit\Framework\TestCase
{
/**
- * @magentoDbIsolation enabled
+ * @magentoDataFixture Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced.php
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoConfigFixture default/catalog/search/engine mysql
* @covers \Magento\Framework\Search\Dynamic\Algorithm::calculateSeparators
@@ -88,7 +87,8 @@ protected function _prepareFilter($layer, $priceResource, $request = null)
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDataFixture Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced.php
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoConfigFixture default/catalog/search/engine mysql
* @covers \Magento\Framework\Search\Dynamic\Algorithm::calculateSeparators
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmBaseTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmBaseTest.php
index e74ccbb210a9..4b69bcd4615d 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmBaseTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/AlgorithmBaseTest.php
@@ -11,6 +11,7 @@
* Test class for \Magento\Catalog\Model\Layer\Filter\Price.
*
* @magentoDataFixture Magento/Catalog/Model/Layer/Filter/Price/_files/products_base.php
+ * @magentoDbIsolation disabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AlgorithmBaseTest extends \PHPUnit\Framework\TestCase
@@ -35,7 +36,7 @@ class AlgorithmBaseTest extends \PHPUnit\Framework\TestCase
protected $priceResource;
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoConfigFixture default/catalog/search/engine mysql
* @dataProvider pricesSegmentationDataProvider
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced_rollback.php
index 63d5efc34695..8b6b2ff94d4b 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_advanced_rollback.php
@@ -12,6 +12,11 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);
+/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
+$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Catalog\Api\ProductRepositoryInterface::class
+);
+
/** @var $product \Magento\Catalog\Model\Product */
$lastProductId = 0;
foreach ($prices as $price) {
@@ -20,10 +25,11 @@
\Magento\Catalog\Model\Product::class
);
$productId = $lastProductId + 1;
- $product->load($productId);
-
- if ($product->getId()) {
- $product->delete();
+ try {
+ $product = $productRepository->get('simple-' . $productId, false, null, true);
+ $productRepository->delete($product);
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
}
$lastProductId++;
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base_rollback.php
index 13795b27e220..67bdb3d5c5e5 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/Price/_files/products_base_rollback.php
@@ -54,15 +54,22 @@
$category->delete();
}
+ /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ \Magento\Catalog\Api\ProductRepositoryInterface::class
+ );
+
foreach ($testCase[0] as $price) {
/** @var \Magento\Catalog\Model\Product $product */
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Catalog\Model\Product::class
);
$productId = $lastProductId + 1;
- $product->load($productId);
- if ($product->getId()) {
- $product->delete();
+ try {
+ $product = $productRepository->get('simple-' . $productId, false, null, true);
+ $productRepository->delete($product);
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
}
++$lastProductId;
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ActionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ActionTest.php
index 39905aeae10f..19f5e78b2537 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ActionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ActionTest.php
@@ -42,7 +42,7 @@ protected function setUp()
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php
* @magentoAppArea adminhtml
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testUpdateWebsites()
@@ -90,6 +90,7 @@ public function testUpdateWebsites()
* @param string $status
* @param string $productsCount
* @dataProvider updateAttributesDataProvider
+ * @magentoDbIsolation disabled
*/
public function testUpdateAttributes($status, $productsCount)
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php
index abcfd795e137..297414202f58 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php
@@ -12,7 +12,6 @@
/**
* Test class for \Magento\Catalog\Model\Product\Attribute\Backend\Price.
*
- * @magentoDbIsolation enabled
* @magentoAppArea adminhtml
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
@@ -60,6 +59,9 @@ protected function setUp()
);
}
+ /**
+ * @magentoDbIsolation disabled
+ */
public function testSetScopeDefault()
{
/* validate result of setAttribute */
@@ -75,7 +77,7 @@ public function testSetScopeDefault()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoConfigFixture current_store catalog/price/scope 1
*/
public function testSetScope()
@@ -88,7 +90,7 @@ public function testSetScope()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoConfigFixture current_store catalog/price/scope 1
* @magentoConfigFixture current_store currency/options/base GBP
@@ -110,7 +112,7 @@ public function testAfterSave()
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
* @magentoConfigFixture current_store catalog/price/scope 1
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppArea adminhtml
*/
public function testAfterSaveWithDifferentStores()
@@ -148,7 +150,7 @@ public function testAfterSaveWithDifferentStores()
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
* @magentoConfigFixture current_store catalog/price/scope 1
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppArea adminhtml
*/
public function testAfterSaveWithSameCurrency()
@@ -184,7 +186,7 @@ public function testAfterSaveWithSameCurrency()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
@@ -236,7 +238,7 @@ public function testAfterSaveWithUseDefault()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/WebsiteAttributesSynchronizerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/WebsiteAttributesSynchronizerTest.php
index 2899066574f8..4857bb0dcc86 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/WebsiteAttributesSynchronizerTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Attribute/WebsiteAttributesSynchronizerTest.php
@@ -52,6 +52,7 @@ public function setUp()
/**
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync_flag.php
+ * @magentoDbIsolation disabled
*/
public function testScheduleSynchronization()
{
@@ -63,6 +64,7 @@ public function testScheduleSynchronization()
/**
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync.php
+ * @magentoDbIsolation disabled
*/
public function testSynchronizeSuccess()
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php
index 560168c645ed..e58d445a2565 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php
@@ -44,6 +44,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/Catalog/_files/products.php
* @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
*/
public function testAddPriceDataOnSchedule()
{
@@ -88,6 +89,7 @@ public function testAddPriceDataOnSchedule()
/**
* @magentoDataFixture Magento/Catalog/_files/products.php
* @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
*/
public function testAddPriceDataOnSave()
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php
index 14ae85006283..77d6b4474994 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/SourceTest.php
@@ -53,6 +53,7 @@ protected function setUp()
* Test reindex for configurable product with both disabled and enabled variations.
*
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testReindexEntitiesForConfigurableProduct()
{
@@ -100,6 +101,7 @@ public function testReindexEntitiesForConfigurableProduct()
/**
* @magentoDataFixture Magento/Catalog/_files/products_with_multiselect_attribute.php
+ * @magentoDbIsolation disabled
*/
public function testReindexMultiselectAttribute()
{
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/product_simple_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/product_simple_rollback.php
new file mode 100644
index 000000000000..556a0b57ca18
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/product_simple_rollback.php
@@ -0,0 +1,27 @@
+getInstance()->reinitialize();
+
+/** @var \Magento\Framework\Registry $registry */
+$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
+$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+try {
+ $product = $productRepository->get('simple products', false, null, true);
+ $productRepository->delete($product);
+} catch (NoSuchEntityException $e) {
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync_rollback.php
index 307dbede649e..053450960bf8 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync_rollback.php
@@ -45,8 +45,14 @@
$storeGroupId = $store->getStoreGroupId();
$websiteId = $store->getWebsiteId();
-$product = $productRepository->getById($productId);
-$productRepository->delete($product);
+try {
+ $product = $productRepository->getById($productId);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+}
/**
* Remove stores by code
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/enable_catalog_product_reindex_schedule.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/enable_catalog_product_reindex_schedule.php
new file mode 100644
index 000000000000..3e81373deea9
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/enable_catalog_product_reindex_schedule.php
@@ -0,0 +1,17 @@
+get(
+ \Magento\Framework\Indexer\IndexerRegistry::class
+)->get('catalog_category_product');
+$model->setScheduled(true);
+
+$model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Framework\Indexer\IndexerRegistry::class
+)->get('catalog_product_category');
+$model->setScheduled(true);
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/enable_catalog_product_reindex_schedule_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/enable_catalog_product_reindex_schedule_rollback.php
new file mode 100644
index 000000000000..429f89abb6ae
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/enable_catalog_product_reindex_schedule_rollback.php
@@ -0,0 +1,12 @@
+get(Processor::class);
+$indexerProcessor->getIndexer()->setScheduled(false);
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_url_key_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_url_key_rollback.php
new file mode 100644
index 000000000000..778fa7b15df3
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_url_key_rollback.php
@@ -0,0 +1,29 @@
+getInstance()->reinitialize();
+
+/** @var \Magento\Framework\Registry $registry */
+$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
+$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+try {
+ $product = $productRepository->get('simple1', false, null, true);
+ $productRepository->delete($product);
+ $product = $productRepository->get('simple2', false, null, true);
+ $productRepository->delete($product);
+} catch (NoSuchEntityException $e) {
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_xss_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_xss_rollback.php
new file mode 100644
index 000000000000..f9475f4c3500
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_xss_rollback.php
@@ -0,0 +1,29 @@
+get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get('product-with-xss', true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+}
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_in_stock_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_in_stock_rollback.php
index eb664c708373..719debe21198 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_in_stock_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_in_stock_rollback.php
@@ -10,11 +10,13 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);
-/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
-$product->load(21);
-if ($product->getId()) {
- $product->delete();
+/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
+$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+try {
+ $product = $productRepository->get('virtual-product', false, null, true);
+ $productRepository->delete($product);
+} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
}
$registry->unregister('isSecureArea');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_related_multiple_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_related_multiple_rollback.php
index f458e1bd9a56..f755735861dc 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_related_multiple_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_related_multiple_rollback.php
@@ -10,27 +10,18 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);
-/** @var $relatedProduct \Magento\Catalog\Model\Product */
-$relatedProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
- \Magento\Catalog\Model\Product::class
-);
-$relatedProduct->load(1);
-if ($relatedProduct->getId()) {
- $relatedProduct->delete();
-}
-
-/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
-$product->load(2);
-if ($product->getId()) {
- $product->delete();
-}
-
-/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
-$product->load(3);
-if ($product->getId()) {
- $product->delete();
+$productSkuList = ['simple', 'simple_with_cross_two', 'simple_with_cross'];
+foreach ($productSkuList as $sku) {
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+ }
}
$registry->unregister('isSecureArea');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_upsell_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_upsell_rollback.php
index b30ebb8380ba..a9c25dec5854 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_upsell_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_upsell_rollback.php
@@ -9,20 +9,18 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);
-/** @var $upSellProduct \Magento\Catalog\Model\Product */
-$upSellProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
- \Magento\Catalog\Model\Product::class
-);
-$upSellProduct->load(1);
-if ($upSellProduct->getId()) {
- $upSellProduct->delete();
-}
-
-/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
-$product->load(2);
-if ($product->getId()) {
- $product->delete();
+$productSkuList = ['simple', 'simple_with_upsell'];
+foreach ($productSkuList as $sku) {
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+ }
}
$registry->unregister('isSecureArea');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture_rollback.php
index eb01eccd0b85..23a5c8043900 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/row_fixture_rollback.php
@@ -10,18 +10,19 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);
-/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
-$product->loadByAttribute('sku', 'simple');
-if ($product->getId()) {
- $product->delete();
-}
-/** @var $product \Magento\Catalog\Model\Product */
-$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
-$product->loadByAttribute('sku', '12345');
-if ($product->getId()) {
- $product->delete();
+$productSkuList = ['simple', '12345'];
+foreach ($productSkuList as $sku) {
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+ }
}
/** @var $category \Magento\Catalog\Model\Category */
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products_rollback.php
index 92c782f4122b..ea44ccc29e0f 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products_rollback.php
@@ -15,11 +15,15 @@
$productSkuList = ['simple_product_1', 'simple_product_2'];
foreach ($productSkuList as $sku) {
- /** @var $product \Magento\Catalog\Model\Product */
- $product = $objectManager->create(\Magento\Catalog\Model\Product::class);
- $product->loadByAttribute('sku', $sku);
- if ($product->getId()) {
- $product->delete();
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
}
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php
index befb3ce50473..07d27955ca84 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/AbstractProductExportImportTestCase.php
@@ -71,7 +71,7 @@ protected function tearDown()
/**
* @magentoAppArea adminhtml
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*
* @param array $fixtures
@@ -156,7 +156,7 @@ private function assertEqualsOtherThanSkippedAttributes($expected, $actual, $ski
/**
* @magentoAppArea adminhtml
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*
* @param array $fixtures
@@ -237,7 +237,7 @@ protected function assertEqualsSpecificAttributes($expectedProduct, $actualProdu
/**
* @magentoAppArea adminhtml
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*
* @param array $fixtures
@@ -256,7 +256,7 @@ public function testImportReplace($fixtures, $skus, $skippedAttributes = [])
/**
* @magentoAppArea adminhtml
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*
* @param array $fixtures
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
index 37d3a037c64c..51d177b052be 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php
@@ -31,6 +31,7 @@
* @magentoAppIsolation enabled
* @magentoDbIsolation enabled
* @magentoDataFixtureBeforeTransaction Magento/Catalog/_files/enable_reindex_schedule.php
+ * @magentoDataFixtureBeforeTransaction Magento/Catalog/_files/enable_catalog_product_reindex_schedule.php
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
@@ -880,7 +881,7 @@ public function testValidateInvalidMultiselectValues()
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
* @magentoDataFixture Magento/Catalog/Model/Layer/Filter/_files/attribute_with_option.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testProductsWithMultipleStores()
@@ -1072,7 +1073,7 @@ public function testProductCategories($fixture, $separator)
/**
* @magentoAppArea adminhtml
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Catalog/_files/multiple_products.php
* @magentoDataFixture Magento/Catalog/_files/category.php
@@ -1147,7 +1148,7 @@ public function categoryTestDataProvider()
/**
* @magentoAppArea adminhtml
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Catalog/_files/category_duplicates.php
*/
@@ -1289,6 +1290,7 @@ public function validateUrlKeysDataProvider()
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/product_simple.php
* @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
*/
public function testValidateUrlKeysMultipleStores()
{
@@ -1384,6 +1386,7 @@ public function testProductWithLinks()
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple_with_url_key.php
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testExistingProductWithUrlKeys()
@@ -1423,6 +1426,7 @@ public function testExistingProductWithUrlKeys()
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple_with_url_key.php
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testImportWithoutUrlKeys()
@@ -1500,7 +1504,7 @@ public function testProductWithUseConfigSettings()
/**
* @magentoDataFixture Magento/Store/_files/website.php
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testProductWithMultipleStoresInDifferentBunches()
@@ -1549,10 +1553,36 @@ function (ProductInterface $item) {
},
$productCollection->getItems()
);
+ sort($products);
+ $result = array_values($actualProductSkus);
+ sort($result);
$this->assertEquals(
$products,
- array_values($actualProductSkus)
+ $result
);
+
+ /** @var \Magento\Framework\Registry $registry */
+ $registry = $this->objectManager->get(\Magento\Framework\Registry::class);
+
+ $registry->unregister('isSecureArea');
+ $registry->register('isSecureArea', true);
+
+ $productSkuList = ['simple1', 'simple2', 'simple3'];
+ foreach ($productSkuList as $sku) {
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+ }
+ }
+
+ $registry->unregister('isSecureArea');
+ $registry->register('isSecureArea', false);
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_rollback.php
index 2ad3cd3c96cc..168073bc6ab7 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_rollback.php
@@ -8,3 +8,7 @@
require dirname(dirname(__DIR__)) . '/Catalog/_files/products_with_multiselect_attribute_rollback.php';
/** Delete text attribute */
require dirname(dirname(__DIR__)) . '/Catalog/_files/text_attribute_rollback.php';
+
+require dirname(dirname(__DIR__)) . '/Store/_files/second_store_rollback.php';
+
+require dirname(dirname(__DIR__)) . '/Catalog/_files/category_rollback.php';
diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars_rollback.php
index 2ad3cd3c96cc..168073bc6ab7 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars_rollback.php
@@ -8,3 +8,7 @@
require dirname(dirname(__DIR__)) . '/Catalog/_files/products_with_multiselect_attribute_rollback.php';
/** Delete text attribute */
require dirname(dirname(__DIR__)) . '/Catalog/_files/text_attribute_rollback.php';
+
+require dirname(dirname(__DIR__)) . '/Store/_files/second_store_rollback.php';
+
+require dirname(dirname(__DIR__)) . '/Catalog/_files/category_rollback.php';
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Api/StockItemSaveTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Api/StockItemSaveTest.php
index 355999e6a904..72973c33b462 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Api/StockItemSaveTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Api/StockItemSaveTest.php
@@ -13,6 +13,7 @@ class StockItemSaveTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSave()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStockTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStockTest.php
index ae6004d47769..5d790b6cfd00 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStockTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStockTest.php
@@ -36,6 +36,8 @@ protected function setUp()
* @magentoDataFixture Magento/Store/_files/website.php
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
*
+ * @magentoDbIsolation disabled
+ *
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function testReindexEntity()
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/ByStockItemRepositoryTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/ByStockItemRepositoryTest.php
index ae67d3fa1edd..d2c964db90e6 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/ByStockItemRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/ByStockItemRepositoryTest.php
@@ -56,6 +56,7 @@ public function setUp()
* Test stock item saving via stock item repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSave()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByQuantityAndStockStatusTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByQuantityAndStockStatusTest.php
index 6864b9a34560..bdf3f1d793e2 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByQuantityAndStockStatusTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByQuantityAndStockStatusTest.php
@@ -41,8 +41,8 @@ class ByQuantityAndStockStatusTest extends \PHPUnit\Framework\TestCase
private $productData = [
ProductInterface::TYPE_ID => Type::TYPE_SIMPLE,
'website_ids' => [1],
- ProductInterface::NAME => 'Simple',
- ProductInterface::SKU => 'simple',
+ ProductInterface::NAME => 'simpleForByQuantityAndStockStatusTest',
+ ProductInterface::SKU => 'simpleForByQuantityAndStockStatusTest',
ProductInterface::PRICE => 100,
ProductInterface::EXTENSION_ATTRIBUTES_KEY => [],
];
@@ -81,7 +81,7 @@ public function testSaveBySetQuantityAndStockStatus()
$product->setQuantityAndStockStatus($this->stockItemData);
$product->save();
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByQuantityAndStockStatusTest', $this->stockItemData);
}
/**
@@ -96,6 +96,6 @@ public function testSaveBySetData()
$product->setData('quantity_and_stock_status', $this->stockItemData);
$product->save();
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByQuantityAndStockStatusTest', $this->stockItemData);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockDataTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockDataTest.php
index eae20bda1a94..a9186f3583ac 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockDataTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockDataTest.php
@@ -41,8 +41,8 @@ class ByStockDataTest extends \PHPUnit\Framework\TestCase
private $productData = [
ProductInterface::TYPE_ID => Type::TYPE_SIMPLE,
'website_ids' => [1],
- ProductInterface::NAME => 'Simple',
- ProductInterface::SKU => 'simple',
+ ProductInterface::NAME => 'simpleForByStockDataTest',
+ ProductInterface::SKU => 'simpleForByStockDataTest',
ProductInterface::PRICE => 100,
ProductInterface::EXTENSION_ATTRIBUTES_KEY => [],
];
@@ -80,7 +80,7 @@ public function testSaveBySetStockData()
$product->setStockData($this->stockItemData);
$product->save();
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByStockDataTest', $this->stockItemData);
}
/**
@@ -95,6 +95,6 @@ public function testSaveBySetData()
$product->setData('stock_data', $this->stockItemData);
$product->save();
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByStockDataTest', $this->stockItemData);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockItemTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockItemTest.php
index 25b9817bcf57..1209c1697105 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockItemTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductModel/ByStockItemTest.php
@@ -47,8 +47,8 @@ class ByStockItemTest extends \PHPUnit\Framework\TestCase
private $productData = [
ProductInterface::TYPE_ID => Type::TYPE_SIMPLE,
'website_ids' => [1],
- ProductInterface::NAME => 'Simple',
- ProductInterface::SKU => 'simple',
+ ProductInterface::NAME => 'simpleByStockItemTest',
+ ProductInterface::SKU => 'simpleByStockItemTest',
ProductInterface::PRICE => 100,
ProductInterface::EXTENSION_ATTRIBUTES_KEY => [],
];
@@ -88,7 +88,7 @@ public function testSave()
$this->dataObjectHelper->populateWithArray($product, $productData, ProductInterface::class);
$product->save();
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleByStockItemTest', $this->stockItemData);
}
/**
@@ -107,6 +107,6 @@ public function testSaveManuallyCreatedStockItem()
$product->getExtensionAttributes()->setStockItem($stockItem);
$product->save();
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleByStockItemTest', $this->stockItemData);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByQuantityAndStockStatusTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByQuantityAndStockStatusTest.php
index 6269d7a20f4f..59f3526b7677 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByQuantityAndStockStatusTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByQuantityAndStockStatusTest.php
@@ -47,8 +47,8 @@ class ByQuantityAndStockStatusTest extends \PHPUnit\Framework\TestCase
private $productData = [
ProductInterface::TYPE_ID => Type::TYPE_SIMPLE,
'website_ids' => [1],
- ProductInterface::NAME => 'Simple',
- ProductInterface::SKU => 'simple',
+ ProductInterface::NAME => 'simpleForQuantityAndStockStatus',
+ ProductInterface::SKU => 'simpleForQuantityAndStockStatus',
ProductInterface::PRICE => 100,
ProductInterface::EXTENSION_ATTRIBUTES_KEY => [],
];
@@ -90,7 +90,7 @@ public function testSaveBySetQuantityAndStockStatus()
$product->setQuantityAndStockStatus($this->stockItemData);
$this->productRepository->save($product);
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForQuantityAndStockStatus', $this->stockItemData);
}
/**
@@ -105,6 +105,6 @@ public function testSaveBySetData()
$product->setData('quantity_and_stock_status', $this->stockItemData);
$this->productRepository->save($product);
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForQuantityAndStockStatus', $this->stockItemData);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockDataTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockDataTest.php
index fa7cc39f7584..b8202e413cae 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockDataTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockDataTest.php
@@ -47,8 +47,8 @@ class ByStockDataTest extends \PHPUnit\Framework\TestCase
private $productData = [
ProductInterface::TYPE_ID => Type::TYPE_SIMPLE,
'website_ids' => [1],
- ProductInterface::NAME => 'Simple',
- ProductInterface::SKU => 'simple',
+ ProductInterface::NAME => 'simpleForByStockDataTest',
+ ProductInterface::SKU => 'simpleForByStockDataTest',
ProductInterface::PRICE => 100,
ProductInterface::EXTENSION_ATTRIBUTES_KEY => [],
];
@@ -89,7 +89,7 @@ public function testSaveBySetStockData()
$product->setStockData($this->stockItemData);
$this->productRepository->save($product);
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByStockDataTest', $this->stockItemData);
}
/**
@@ -104,6 +104,6 @@ public function testSaveBySetData()
$product->setData('stock_data', $this->stockItemData);
$this->productRepository->save($product);
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByStockDataTest', $this->stockItemData);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockItemTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockItemTest.php
index 857457325c75..3d227a8622c2 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockItemTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductCreate/ByProductRepository/ByStockItemTest.php
@@ -58,8 +58,8 @@ class ByStockItemTest extends \PHPUnit\Framework\TestCase
private $productData = [
ProductInterface::TYPE_ID => Type::TYPE_SIMPLE,
'website_ids' => [1],
- ProductInterface::NAME => 'Simple',
- ProductInterface::SKU => 'simple',
+ ProductInterface::NAME => 'simpleForByStockItemTest',
+ ProductInterface::SKU => 'simpleForByStockItemTest',
ProductInterface::PRICE => 100,
ProductInterface::EXTENSION_ATTRIBUTES_KEY => [],
];
@@ -103,7 +103,7 @@ public function testSave()
$this->dataObjectHelper->populateWithArray($product, $productData, ProductInterface::class);
$this->productRepository->save($product);
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByStockItemTest', $this->stockItemData);
}
/**
@@ -122,7 +122,7 @@ public function testSaveManuallyCreatedStockItem()
$product->getExtensionAttributes()->setStockItem($stockItem);
$this->productRepository->save($product);
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByStockItemTest', $this->stockItemData);
}
/**
@@ -139,6 +139,6 @@ public function testAutomaticallyStockItemCreating()
$this->dataObjectHelper->populateWithArray($stockItem, $this->stockItemData, StockItemInterface::class);
$this->stockItemRepository->save($stockItem);
- $this->stockItemDataChecker->checkStockItemData('simple', $this->stockItemData);
+ $this->stockItemDataChecker->checkStockItemData('simpleForByStockItemTest', $this->stockItemData);
}
}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByQuantityAndStockStatusTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByQuantityAndStockStatusTest.php
index ce5d981e5caf..3fb3fc17a741 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByQuantityAndStockStatusTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByQuantityAndStockStatusTest.php
@@ -44,6 +44,7 @@ public function setUp()
* model (deprecated)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetQuantityAndStockStatus()
{
@@ -60,6 +61,7 @@ public function testSaveBySetQuantityAndStockStatus()
* via product model (deprecated)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetData()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockDataTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockDataTest.php
index 0b7e76492b37..9373805e2c41 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockDataTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockDataTest.php
@@ -44,6 +44,7 @@ public function setUp()
* model (deprecated)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetStockData()
{
@@ -60,6 +61,7 @@ public function testSaveBySetStockData()
* via product model (deprecated)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetData()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockItemTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockItemTest.php
index 2a4b7937f716..922d47ec1524 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockItemTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductModel/ByStockItemTest.php
@@ -58,6 +58,7 @@ public function setUp()
* Test saving of stock item by product data via product model (deprecated)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSave()
{
@@ -75,6 +76,7 @@ public function testSave()
* product model (deprecated)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveManuallyCreatedStockItem()
{
@@ -95,6 +97,7 @@ public function testSaveManuallyCreatedStockItem()
* product repository (deprecated)
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveManuallyUpdatedStockItem()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByQuantityAndStockStatusTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByQuantityAndStockStatusTest.php
index 4e04afd5d8b8..d4954370bbb7 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByQuantityAndStockStatusTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByQuantityAndStockStatusTest.php
@@ -44,6 +44,7 @@ public function setUp()
* repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetQuantityAndStockStatus()
{
@@ -60,6 +61,7 @@ public function testSaveBySetQuantityAndStockStatus()
* via product repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetData()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockDataTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockDataTest.php
index 4969324ec84b..e35d3afeea7d 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockDataTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockDataTest.php
@@ -43,6 +43,7 @@ public function setUp()
* Test saving of stock item on product save by 'setStockData' method (deprecated) via product repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetStockData()
{
@@ -59,6 +60,7 @@ public function testSaveBySetStockData()
* via product repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveBySetData()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockItemTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockItemTest.php
index 81871d3398c1..fcd41efaae9b 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockItemTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Model/StockItemSave/OnProductUpdate/ByProductRepository/ByStockItemTest.php
@@ -65,6 +65,7 @@ public function setUp()
* Test saving of stock item by product data via product repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSave()
{
@@ -82,6 +83,7 @@ public function testSave()
* product repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveManuallyCreatedStockItem()
{
@@ -102,6 +104,7 @@ public function testSaveManuallyCreatedStockItem()
* product repository
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
+ * @magentoDbIsolation disabled
*/
public function testSaveManuallyUpdatedStockItem()
{
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/BatchIndexTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/BatchIndexTest.php
index c06a1e9f6881..b71b466714e8 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/BatchIndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/BatchIndexTest.php
@@ -60,7 +60,7 @@ protected function tearDown()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @dataProvider dataProvider
* @magentoAppIsolation enabled
* @magentoAppArea adminhtml
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php
index 0a8eb0e72d8c..13f6e5ae0e8e 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php
@@ -65,7 +65,7 @@ protected function tearDown()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/CatalogRule/_files/attribute.php
* @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
@@ -83,7 +83,7 @@ public function testReindexById()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/CatalogRule/_files/attribute.php
* @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
@@ -110,7 +110,7 @@ public function testReindexByIds()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/attribute.php
* @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/rule_by_attribute.php
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php
index 4fb9b5463e86..c8c0726de7eb 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php
@@ -32,6 +32,7 @@ protected function setUp()
}
/**
+ * @magentoDbIsolation disabled
* @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/attribute.php
* @magentoDataFixtureBeforeTransaction Magento/CatalogRule/_files/rule_by_attribute.php
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Rule/CollectionTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Rule/CollectionTest.php
index 675c1cae4e21..c42b13ac0112 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Rule/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Rule/CollectionTest.php
@@ -13,7 +13,6 @@
use Magento\Catalog\Setup\CategorySetup;
/**
- * @magentoDbIsolation enabled
* @magentoAppIsolation enabled
*/
class CollectionTest extends \PHPUnit\Framework\TestCase
@@ -48,7 +47,7 @@ protected function setUp()
/**
* @magentoAppArea adminhtml
- *
+ * @magentoDbIsolation disabled
* @magentoDataFixture Magento/CatalogRule/_files/attribute.php
* @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
* @magentoDataFixture Magento/CatalogRule/_files/two_rules.php
diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/CategoryTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/CategoryTest.php
index 51a98c3e4ff1..a01797902815 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/CategoryTest.php
@@ -101,6 +101,9 @@ public function testGetName()
$this->assertEquals('Category', $this->_model->getName());
}
+ /**
+ * @magentoDbIsolation disabled
+ */
public function testGetItems()
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGeneratorTest.php
index 78f371d89fd7..1203ca191b45 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGeneratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGeneratorTest.php
@@ -30,7 +30,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_with_category.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testGenerateWithSpecificCategoryUrlKey()
diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_product_ids_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_product_ids_rollback.php
new file mode 100644
index 000000000000..667138d3088a
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_product_ids_rollback.php
@@ -0,0 +1,35 @@
+get(\Magento\Framework\Registry::class);
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/** @var $productCollection \Magento\Catalog\Model\ResourceModel\Product\Collection */
+$productCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(\Magento\Catalog\Model\ResourceModel\Product\Collection::class);
+
+$productCollection->load()->delete();
+
+$productSkuList = ['simple', '12345'];
+foreach ($productSkuList as $sku) {
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+ }
+}
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
+
+require __DIR__ . '/categories_rollback.php';
diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php
index 7dd6ba630f3d..ab252e9469a2 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products_rollback.php
@@ -14,6 +14,20 @@
$productCollection->load()->delete();
+$productSkuList = ['simple', '12345'];
+foreach ($productSkuList as $sku) {
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+ }
+}
+
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_simple_rollback.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_simple_rollback.php
new file mode 100644
index 000000000000..86f0ce34af00
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_simple_rollback.php
@@ -0,0 +1,29 @@
+getInstance()->reinitialize();
+
+/** @var \Magento\Framework\Registry $registry */
+$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
+$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+try {
+ $product = $productRepository->get('simple', true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+} catch (NoSuchEntityException $e) {
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php
index 3a64a134d5f9..a8572df0361d 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php
@@ -38,6 +38,7 @@ protected function setUp()
* 4. Set at least 2 options of multiselect attribute to match products for the product list widget
* 5. Load collection for product list widget and make sure that number of loaded products is correct
*
+ * @magentoDbIsolation disabled
* @magentoDataFixture Magento/Catalog/_files/products_with_multiselect_attribute.php
*/
public function testCreateCollection()
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Api/PaymentInformationManagementTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Api/PaymentInformationManagementTest.php
new file mode 100644
index 000000000000..f6338c1ee166
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/Api/PaymentInformationManagementTest.php
@@ -0,0 +1,162 @@
+objectManager = Bootstrap::getObjectManager();
+
+ $this->client = $this->getMockBuilder(TransactionSale::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->objectManager->addSharedInstance($this->client, TransactionSale::class);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function tearDown()
+ {
+ $this->objectManager->removeSharedInstance(TransactionSale::class);
+ parent::tearDown();
+ }
+
+ /**
+ * Checks a case when payment method triggers an error during place order flow and
+ * error messages from payment gateway should be mapped.
+ * Error messages might be specific for different areas.
+ *
+ * @magentoAppIsolation enabled
+ * @magentoDataFixture Magento/Checkout/_files/quote_with_shipping_method.php
+ * @magentoConfigFixture current_store payment/braintree/active 1
+ * @dataProvider getErrorPerAreaDataProvider
+ * @expectedException \Magento\Framework\Exception\CouldNotSaveException
+ * @param string $area
+ * @param array $testErrorCodes
+ * @param string $expectedOutput
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ public function testSavePaymentInformationAndPlaceOrderWithErrors(
+ string $area,
+ array $testErrorCodes,
+ string $expectedOutput
+ ) {
+ /** @var State $state */
+ $state = $this->objectManager->get(State::class);
+ $state->setAreaCode($area);
+
+ $quote = $this->getQuote('test_order_1');
+
+ /** @var PaymentInterface $payment */
+ $payment = $this->objectManager->create(PaymentInterface::class);
+ $payment->setMethod(ConfigProvider::CODE);
+
+ $errors = ['errors' => []];
+
+ foreach ($testErrorCodes as $testErrorCode) {
+ array_push($errors['errors'], ['code' => $testErrorCode]);
+ }
+
+ $response = new Error(['errors' => $errors]);
+
+ $this->client->method('placeRequest')
+ ->willReturn(['object' => $response]);
+
+ $this->expectExceptionMessage($expectedOutput);
+
+ /** @var PaymentInformationManagementInterface $paymentInformationManagement */
+ $paymentInformationManagement = $this->objectManager->get(PaymentInformationManagementInterface::class);
+ $paymentInformationManagement->savePaymentInformationAndPlaceOrder(
+ $quote->getId(),
+ $payment
+ );
+ }
+
+ /**
+ * Gets list of areas with specific error messages.
+ *
+ * @return array
+ */
+ public function getErrorPerAreaDataProvider()
+ {
+ $testErrorGlobal = ['code' => 81802, 'message' => 'Company is too long.'];
+ $testErrorAdmin = ['code' => 91511, 'message' => 'Customer does not have any credit cards.'];
+ $testErrorFake = ['code' => 'fake_code', 'message' => 'Error message should not be mapped.'];
+
+ return [
+ [
+ Area::AREA_FRONTEND,
+ [$testErrorAdmin['code'], $testErrorFake['code']],
+ 'Transaction has been declined. Please try again later.'
+ ], [
+ Area::AREA_FRONTEND,
+ [$testErrorGlobal['code'], $testErrorAdmin['code'], $testErrorFake['code']],
+ $testErrorGlobal['message']
+ ], [
+ Area::AREA_ADMINHTML,
+ [$testErrorGlobal['code'], $testErrorAdmin['code'], $testErrorFake['code']],
+ $testErrorGlobal['message'] . PHP_EOL . $testErrorAdmin['message']
+ ],
+ ];
+ }
+
+ /**
+ * Retrieves quote by provided order ID.
+ *
+ * @param string $reservedOrderId
+ * @return CartInterface
+ */
+ private function getQuote(string $reservedOrderId): CartInterface
+ {
+ /** @var SearchCriteriaBuilder $searchCriteriaBuilder */
+ $searchCriteriaBuilder = $this->objectManager->get(SearchCriteriaBuilder::class);
+ $searchCriteria = $searchCriteriaBuilder->addFilter('reserved_order_id', $reservedOrderId)
+ ->create();
+
+ /** @var CartRepositoryInterface $quoteRepository */
+ $quoteRepository = $this->objectManager->get(CartRepositoryInterface::class);
+ $items = $quoteRepository->getList($searchCriteria)
+ ->getItems();
+
+ return array_pop($items);
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_shipping_method_and_items_categories_rollback.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_shipping_method_and_items_categories_rollback.php
new file mode 100644
index 000000000000..0efe941ac637
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_shipping_method_and_items_categories_rollback.php
@@ -0,0 +1,47 @@
+get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+$productSkuList = ['simple_cat_3', 'simple_cat_4'];
+foreach ($productSkuList as $sku) {
+ try {
+ $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+ $product = $productRepository->get($sku, true);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
+ } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+ }
+}
+
+//Remove categories
+/** @var Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
+$collection = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Category\Collection::class);
+$collection
+ ->addAttributeToFilter('level', 2)
+ ->load()
+ ->delete();
+
+$quote = $objectManager->create(\Magento\Quote\Model\Quote::class);
+$quote->load('test_order_1', 'reserved_order_id')->delete();
+
+/** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */
+$quoteIdMask = $objectManager->create(\Magento\Quote\Model\QuoteIdMask::class);
+$quoteIdMask->delete($quote->getId());
+
+require __DIR__ . '/../../Checkout/_files/quote_with_address_rollback.php';
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/BlockTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/BlockTest.php
index c9544d87bc01..16331ccde245 100644
--- a/dev/tests/integration/testsuite/Magento/Cms/Model/BlockTest.php
+++ b/dev/tests/integration/testsuite/Magento/Cms/Model/BlockTest.php
@@ -9,6 +9,7 @@
use Magento\Cms\Model\BlockFactory;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\Stdlib\DateTime\DateTime;
+use Magento\Framework\Stdlib\DateTime\Timezone;
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;
@@ -81,18 +82,26 @@ public function testGetByIdentifier(array $blockData)
*/
public function testUpdateTime(array $blockData)
{
+
# Prepare and save the temporary block
- $tempBlock = $this->blockFactory->create();
+ $beforeTimestamp = $this->objectManager->get(DateTime::class)->timestamp();
+ $tempBlock = $this->blockFactory->create();
$tempBlock->setData($blockData);
$this->blockResource->save($tempBlock);
# Load previously created block and compare identifiers
- $storeId = reset($blockData['stores']);
- $block = $this->blockIdentifier->execute($blockData['identifier'], $storeId);
- $date = $this->objectManager->get(DateTime::class)->date();
- $this->markTestIncomplete('MAGETWO-87353: \Magento\Cms\Model\BlockTest::testUpdateTime randomly fails on CI. '
- . 'Invalid assertion. Application node timestamp may significantly differ from DB node.');
- $this->assertEquals($date, $block->getUpdateTime());
+ $storeId = reset($blockData['stores']);
+ $block = $this->blockIdentifier->execute($blockData['identifier'], $storeId);
+ $afterTimestamp = $this->objectManager->get(DateTime::class)->timestamp();
+ $blockTimestamp = strtotime($block->getUpdateTime());
+
+ /*
+ * This test used to fail due to a race condition @see MAGETWO-87353
+ * The DB time would be one second older than the check time. The new check allows the DB time
+ * to be between the test start time and right before the assertion.
+ */
+ $this->assertGreaterThanOrEqual($beforeTimestamp, $blockTimestamp);
+ $this->assertLessThanOrEqual($afterTimestamp, $blockTimestamp);
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Category/ProductIndexerTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Category/ProductIndexerTest.php
index def8cbdbc0bb..203a3fb45bea 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Category/ProductIndexerTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Category/ProductIndexerTest.php
@@ -11,7 +11,7 @@
* @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
* @magentoAppIsolation enabled
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
*/
class ProductIndexerTest extends \PHPUnit\Framework\TestCase
{
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/OptionRepositoryTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/OptionRepositoryTest.php
index e539f7ad9a32..00d6e51c736b 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/OptionRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/OptionRepositoryTest.php
@@ -9,6 +9,7 @@ class OptionRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetListWithExtensionAttributes()
{
@@ -24,9 +25,10 @@ public function testGetListWithExtensionAttributes()
$joinedEntity = $objectManager->create(\Magento\Eav\Model\Entity\Attribute::class);
$joinedEntity->load($options[0]->getId());
$joinedExtensionAttributeValue = $joinedEntity->getAttributeCode();
+ $result = $options[0]->getExtensionAttributes()->__toArray();
$this->assertEquals(
$joinedExtensionAttributeValue,
- $options[0]->getExtensionAttributes()->getTestDummyAttribute(),
+ $result['test_dummy_attribute'],
"Extension attributes were not loaded correctly"
);
}
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php
index c39a2cea4b53..e530029e9755 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/Configurable/PriceTest.php
@@ -10,6 +10,7 @@
/**
* Class PriceTest
+ * @magentoDbIsolation disabled
*/
class PriceTest extends \PHPUnit\Framework\TestCase
{
@@ -30,6 +31,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetFinalPrice()
{
@@ -40,6 +42,7 @@ public function testGetFinalPrice()
* @magentoConfigFixture current_store tax/display/type 1
* @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetFinalPriceExcludingTax()
{
@@ -50,6 +53,7 @@ public function testGetFinalPriceExcludingTax()
* @magentoConfigFixture current_store tax/display/type 2
* @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetFinalPriceIncludingTax()
{
@@ -61,6 +65,7 @@ public function testGetFinalPriceIncludingTax()
* @magentoConfigFixture current_store tax/display/type 3
* @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetFinalPriceIncludingExcludingTax()
{
@@ -71,6 +76,7 @@ public function testGetFinalPriceIncludingExcludingTax()
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetFinalPriceWithSelectedSimpleProduct()
{
@@ -83,6 +89,7 @@ public function testGetFinalPriceWithSelectedSimpleProduct()
* @magentoConfigFixture current_store tax/display/type 1
* @magentoDataFixture Magento/ConfigurableProduct/_files/tax_rule.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetFinalPriceWithCustomOption()
{
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php
index 9d6ef7dfb1ae..66091c108f0b 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php
@@ -36,6 +36,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetProductFinalPriceIfOneOfChildIsDisabled()
{
@@ -70,6 +71,7 @@ public function testGetProductFinalPriceIfOneOfChildIsDisabled()
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testGetProductFinalPriceIfOneOfChildIsDisabledPerStore()
{
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionProviderTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionProviderTest.php
index c24baa36461c..8add544881c7 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionProviderTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionProviderTest.php
@@ -11,6 +11,9 @@
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
+/**
+ * @magentoDbIsolation disabled
+ */
class LowestPriceOptionProviderTest extends \PHPUnit\Framework\TestCase
{
/**
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceIndexerTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceIndexerTest.php
index 581411cb8b8e..dc5c07ad8dc2 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceIndexerTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceIndexerTest.php
@@ -43,6 +43,7 @@ protected function setUp()
*
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
* @magentoDataFixture Magento/Catalog/_files/enable_price_index_schedule.php
+ * @magentoDbIsolation disabled
*/
public function testFullReindexIfChildHasSpecialPrice()
{
@@ -79,6 +80,7 @@ public function testFullReindexIfChildHasSpecialPrice()
* Use collection to check data in index
*
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testOnSaveIndexationIfChildHasSpecialPrice()
{
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceTest.php
index a944a5b6104c..7edcf55f572f 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Price/SpecialPriceTest.php
@@ -34,6 +34,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoDbIsolation disabled
*/
public function testPriceInfoIfChildHasSpecialPrice()
{
@@ -56,6 +57,7 @@ public function testPriceInfoIfChildHasSpecialPrice()
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_simple_77.php
+ * @magentoDbIsolation disabled
*/
public function testSortingOfProductsIfChildHasNotSpecialPrice()
{
@@ -82,6 +84,7 @@ public function testSortingOfProductsIfChildHasNotSpecialPrice()
/**
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_simple_77.php
+ * @magentoDbIsolation disabled
*/
public function testSortingOfProductsIfChildHasSpecialPrice()
{
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Render/FinalPriceBox/RenderingBasedOnIsProductListFlagTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Render/FinalPriceBox/RenderingBasedOnIsProductListFlagTest.php
index 076ed3426271..0e191f4a9014 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Render/FinalPriceBox/RenderingBasedOnIsProductListFlagTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Pricing/Render/FinalPriceBox/RenderingBasedOnIsProductListFlagTest.php
@@ -75,6 +75,7 @@ protected function setUp()
*
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
* @magentoAppArea frontend
+ * @magentoDbIsolation disabled
*/
public function testRenderingByDefault()
{
@@ -109,6 +110,7 @@ public function testRenderingByDefault()
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
* @magentoAppArea frontend
* @dataProvider isProductListDataProvider
+ * @magentoDbIsolation disabled
*/
public function testRenderingAccordingToIsProductListFlag($flag, $count)
{
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_products_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_products_rollback.php
index 4d5165b0f318..42045c4439fe 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_products_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_products_rollback.php
@@ -17,7 +17,7 @@
foreach (['simple_10', 'simple_20', 'configurable', 'simple_30', 'simple_40', 'configurable_12345'] as $sku) {
try {
- $product = $productRepository->get($sku, false, null, true);
+ $product = $productRepository->get($sku, true);
$stockStatus = $objectManager->create(\Magento\CatalogInventory\Model\Stock\Status::class);
$stockStatus->load($product->getEntityId(), 'product_id');
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php
index 80ad8e76d7b9..171ddef1eca8 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php
@@ -18,13 +18,15 @@
foreach (['simple_10', 'simple_20', 'configurable'] as $sku) {
try {
- $product = $productRepository->get($sku, false, null, true);
+ $product = $productRepository->get($sku, true);
$stockStatus = $objectManager->create(\Magento\CatalogInventory\Model\Stock\Status::class);
$stockStatus->load($product->getEntityId(), 'product_id');
$stockStatus->delete();
- $productRepository->delete($product);
+ if ($product->getId()) {
+ $productRepository->delete($product);
+ }
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
//Product already removed
}
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_simple_77_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_simple_77_rollback.php
new file mode 100644
index 000000000000..1f4c5fe4d072
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_simple_77_rollback.php
@@ -0,0 +1,27 @@
+get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/**
+ * @var Magento\Catalog\Api\ProductRepositoryInterface $productRepository
+ */
+$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
+try {
+ $product = $productRepository->get('simple_77', false, null, true);
+ $productRepository->delete($product);
+} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
+ //Product already removed
+}
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/tax_rule_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/tax_rule_rollback.php
new file mode 100644
index 000000000000..a1dbae821299
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/tax_rule_rollback.php
@@ -0,0 +1,26 @@
+get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+/** @var $objectManager \Magento\TestFramework\ObjectManager */
+$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+/** @var Magento\Framework\Registry $registry */
+$registry = $objectManager->get(\Magento\Framework\Registry::class);
+
+$registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rule');
+$objectManager->create(\Magento\Tax\Model\Calculation\Rule::class)->load('Test Rule', 'code')->delete();
+
+$registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rate');
+$objectManager->create(\Magento\Tax\Model\Calculation\Rate::class)->loadByCode('*')->delete();
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
index 93a53e2b333d..b942365d64a7 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
@@ -395,13 +395,17 @@ public function testSaveActionExistingCustomerChangeEmail()
$transportBuilderMock = $this->prepareEmailMock(
2,
'change_email_template',
- 'support',
+ [
+ 'name' => 'CustomerSupport',
+ 'email' => 'support@example.com',
+ ],
$customerId,
$newEmail
);
$this->addEmailMockToClass($transportBuilderMock, EmailNotification::class);
$post = [
- 'customer' => ['entity_id' => $customerId,
+ 'customer' => [
+ 'entity_id' => $customerId,
'middlename' => 'test middlename',
'group_id' => 1,
'website_id' => 1,
@@ -441,7 +445,10 @@ public function testInlineEditChangeEmail()
$transportBuilderMock = $this->prepareEmailMock(
2,
'change_email_template',
- 'support',
+ [
+ 'name' => 'CustomerSupport',
+ 'email' => 'support@example.com',
+ ],
$customerId,
$newEmail
);
@@ -754,18 +761,23 @@ public function testResetPasswordActionSuccess()
}
/**
- * Prepare email mock to test emails
+ * Prepare email mock to test emails.
*
* @param int $occurrenceNumber
* @param string $templateId
- * @param string $sender
+ * @param array $sender
* @param int $customerId
* @param string|null $newEmail
* @return \PHPUnit_Framework_MockObject_MockObject
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
- protected function prepareEmailMock($occurrenceNumber, $templateId, $sender, $customerId, $newEmail = null)
- {
+ protected function prepareEmailMock(
+ int $occurrenceNumber,
+ string $templateId,
+ array $sender,
+ int $customerId,
+ $newEmail = null
+ ) : \PHPUnit_Framework_MockObject_MockObject {
$area = \Magento\Framework\App\Area::AREA_FRONTEND;
$customer = $this->customerRepository->getById($customerId);
$storeId = $customer->getStoreId();
@@ -785,7 +797,7 @@ protected function prepareEmailMock($occurrenceNumber, $templateId, $sender, $cu
'setTemplateIdentifier',
'setTemplateVars',
'setTemplateOptions',
- 'getTransport'
+ 'getTransport',
]
)
->getMock();
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php
index d23113ee3bd0..016efd60ce78 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Grid/CollectionTest.php
@@ -8,7 +8,6 @@
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\CustomerInterface;
-use Magento\Framework\Indexer\IndexerRegistry;
use Magento\TestFramework\Helper\Bootstrap;
/**
@@ -16,25 +15,17 @@
*/
class CollectionTest extends \Magento\TestFramework\Indexer\TestCase
{
- /** @var \Magento\Framework\ObjectManagerInterface */
- private $objectManager;
-
- /** @var IndexerRegistry */
- private $indexerRegistry;
-
- /** @var \Magento\Customer\Model\ResourceModel\Grid\Collection */
- private $targetObject;
-
- /** @var CustomerRepositoryInterface */
- private $customerRepository;
-
- protected function setUp()
+ public static function setUpBeforeClass()
{
- $this->objectManager = Bootstrap::getObjectManager();
- $this->indexerRegistry = $this->objectManager->create(IndexerRegistry::class);
- $this->targetObject = $this->objectManager
- ->create(\Magento\Customer\Model\ResourceModel\Grid\Collection::class);
- $this->customerRepository = $this->objectManager->create(CustomerRepositoryInterface::class);
+ $db = Bootstrap::getInstance()->getBootstrap()
+ ->getApplication()
+ ->getDbInstance();
+ if (!$db->isDbDumpExists()) {
+ throw new \LogicException('DB dump does not exist.');
+ }
+ $db->restoreFromDbDump();
+
+ parent::setUpBeforeClass();
}
/**
@@ -46,23 +37,41 @@ protected function setUp()
*
* @magentoDataFixture Magento/Customer/_files/customer_grid_indexer_enabled_update_on_schedule.php
* @magentoDataFixture Magento/Customer/_files/customer_sample.php
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
*/
public function testGetItemByIdForUpdateOnSchedule()
{
+ $targetObject = Bootstrap::getObjectManager()->create(
+ \Magento\Customer\Model\ResourceModel\Grid\Collection::class
+ );
+ $customerRepository = Bootstrap::getObjectManager()->create(
+ CustomerRepositoryInterface::class
+ );
/** Verify after first save */
+
/** @var CustomerInterface $newCustomer */
- $newCustomer = $this->customerRepository->get('customer@example.com');
+ $newCustomer = $customerRepository->get('customer@example.com');
/** @var CustomerInterface $item */
- $item = $this->targetObject->getItemById($newCustomer->getId());
+ $item = $targetObject->getItemById($newCustomer->getId());
$this->assertNotEmpty($item);
$this->assertSame($newCustomer->getEmail(), $item->getEmail());
$this->assertSame('test street test city Armed Forces Middle East 01001', $item->getBillingFull());
/** Verify after update */
+
$newCustomer->setEmail('customer_updated@example.com');
- $this->customerRepository->save($newCustomer);
- $this->targetObject->clear();
- $item = $this->targetObject->getItemById($newCustomer->getId());
+ $customerRepository->save($newCustomer);
+ $targetObject->clear();
+ $item = $targetObject->getItemById($newCustomer->getId());
$this->assertSame($newCustomer->getEmail(), $item->getEmail());
}
+
+ /**
+ * teardown
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
index f11cc62928af..0915506f0611 100644
--- a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
@@ -10,6 +10,10 @@
namespace Magento\CustomerImportExport\Model\Import;
use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\Filesystem;
+use Magento\ImportExport\Model\Import as ImportModel;
+use Magento\ImportExport\Model\Import\Adapter as ImportAdapter;
+use Magento\TestFramework\Helper\Bootstrap;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -86,10 +90,10 @@ class AddressTest extends \PHPUnit\Framework\TestCase
protected function setUp()
{
/** @var \Magento\Catalog\Model\ResourceModel\Product $productResource */
- $this->customerResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ $this->customerResource = Bootstrap::getObjectManager()->get(
\Magento\Customer\Model\ResourceModel\Customer::class
);
- $this->_entityAdapter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $this->_entityAdapter = Bootstrap::getObjectManager()->create(
$this->_testClassName
);
}
@@ -158,7 +162,7 @@ public function testConstruct()
public function testInitAddresses()
{
/** @var $objectManager \Magento\TestFramework\ObjectManager */
- $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ $objectManager = Bootstrap::getObjectManager();
// get addressed from fixture
$customers = $objectManager->get(\Magento\Framework\Registry::class)->registry($this->_fixtureKey);
@@ -217,7 +221,7 @@ public function testSaveAddressEntities()
list($customerId, $addressId) = $this->_addTestAddress($this->_entityAdapter);
// check DB
- $testAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $testAddress = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\Address::class
);
$testAddress->load($addressId);
@@ -234,7 +238,7 @@ public function testSaveAddressEntities()
protected function _addTestAddress(Address $entityAdapter)
{
/** @var $objectManager \Magento\TestFramework\ObjectManager */
- $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ $objectManager = Bootstrap::getObjectManager();
$customers = $objectManager->get(\Magento\Framework\Registry::class)->registry($this->_fixtureKey);
/** @var $customer \Magento\Customer\Model\Customer */
@@ -242,7 +246,7 @@ protected function _addTestAddress(Address $entityAdapter)
$customerId = $customer->getId();
/** @var $addressModel \Magento\Customer\Model\Address */
- $addressModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $addressModel = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\Address::class
);
$tableName = $addressModel->getResource()->getEntityTable();
@@ -301,7 +305,7 @@ public function testSaveAddressAttributes()
// check DB
/** @var $testAddress \Magento\Customer\Model\Address */
- $testAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $testAddress = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\Address::class
);
$testAddress->load($addressId);
@@ -317,7 +321,7 @@ public function testSaveAddressAttributes()
public function testSaveCustomerDefaults()
{
/** @var $objectManager \Magento\TestFramework\ObjectManager */
- $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ $objectManager = Bootstrap::getObjectManager();
// get not default address
$customers = $objectManager->get(\Magento\Framework\Registry::class)->registry($this->_fixtureKey);
@@ -359,7 +363,7 @@ public function testSaveCustomerDefaults()
// check DB
/** @var $testCustomer \Magento\Customer\Model\Customer */
- $testCustomer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $testCustomer = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\Customer::class
);
$testCustomer->load($customerId);
@@ -387,20 +391,20 @@ public function testImportDataAddUpdate()
{
// set behaviour
$this->_entityAdapter->setParameters(
- ['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE]
+ ['behavior' => ImportModel::BEHAVIOR_ADD_UPDATE]
);
// set fixture CSV file
$sourceFile = __DIR__ . '/_files/address_import_update.csv';
/** @var $objectManager \Magento\TestFramework\ObjectManager */
- $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $filesystem = $objectManager->create(\Magento\Framework\Filesystem::class);
+ $objectManager = Bootstrap::getObjectManager();
+ $filesystem = $objectManager->create(Filesystem::class);
$directoryWrite = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
$result = $this->_entityAdapter->setSource(
- \Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile, $directoryWrite)
+ ImportAdapter::findAdapterFor($sourceFile, $directoryWrite)
)
->validateData()
->hasToBeTerminated();
@@ -419,7 +423,7 @@ public function testImportDataAddUpdate()
}
// get addresses
- $addressCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $addressCollection = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\ResourceModel\Address\Collection::class
);
$addressCollection->addAttributeToSelect($requiredAttributes);
@@ -460,7 +464,7 @@ public function testImportDataAddUpdate()
// are default billing/shipping addresses have new value
/** @var $customer \Magento\Customer\Model\Customer */
- $customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $customer = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\Customer::class
);
$customer->setWebsiteId(0);
@@ -486,17 +490,17 @@ public function testImportDataAddUpdate()
public function testImportDataDelete()
{
// set behaviour
- $this->_entityAdapter->setParameters(['behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE]);
+ $this->_entityAdapter->setParameters(['behavior' => ImportModel::BEHAVIOR_DELETE]);
// set fixture CSV file
$sourceFile = __DIR__ . '/_files/address_import_delete.csv';
/** @var $objectManager \Magento\TestFramework\ObjectManager */
- $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $filesystem = $objectManager->create(\Magento\Framework\Filesystem::class);
+ $objectManager = Bootstrap::getObjectManager();
+ $filesystem = $objectManager->create(Filesystem::class);
$directoryWrite = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
$result = $this->_entityAdapter->setSource(
- \Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile, $directoryWrite)
+ ImportAdapter::findAdapterFor($sourceFile, $directoryWrite)
)->validateData()->hasToBeTerminated();
$this->assertTrue(!$result, 'Validation result must be true.');
@@ -508,7 +512,7 @@ public function testImportDataDelete()
// get addresses
/** @var $addressCollection \Magento\Customer\Model\ResourceModel\Address\Collection */
- $addressCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+ $addressCollection = Bootstrap::getObjectManager()->create(
\Magento\Customer\Model\ResourceModel\Address\Collection::class
);
$addressCollection->addAttributeToSelect($keyAttribute);
@@ -522,4 +526,37 @@ public function testImportDataDelete()
$this->assertArrayNotHasKey($this->_deleteData['delete'], $addresses, 'Address must not exist.');
$this->assertArrayHasKey($this->_deleteData['not_delete'], $addresses, 'Address must exist.');
}
+
+ /**
+ * Case when attribute settings for two websites are different.
+ *
+ * @magentoAppArea adminhtml
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
+ * @magentoDataFixture Magento/CustomerImportExport/_files/two_addresses.php
+ * @return void
+ */
+ public function testDifferentOptions(): void
+ {
+ /** @var $objectManager \Magento\TestFramework\ObjectManager */
+ $objectManager = Bootstrap::getObjectManager();
+ /** @var Filesystem $filesystem */
+ $filesystem = $objectManager->create(Filesystem::class);
+
+ //Only add/update behaviour will have validation in place required to
+ //test this case
+ $this->_entityAdapter->setParameters(
+ ['behavior' => ImportModel::BEHAVIOR_ADD_UPDATE]
+ );
+ //Load from
+ $sourceFile = __DIR__ . '/_files/two_addresses_import_update.csv';
+ $directoryWrite = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
+ //Validate
+ $adapter = ImportAdapter::findAdapterFor($sourceFile, $directoryWrite);
+ $errors = $this->_entityAdapter->setSource($adapter)->validateData();
+ $this->assertEmpty($errors->getErrorsCount(), 'CSV must be valid');
+ //Import
+ $imported = $this->_entityAdapter->importData();
+ $this->assertTrue($imported, 'Must be successfully imported');
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/_files/two_addresses_import_update.csv b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/_files/two_addresses_import_update.csv
new file mode 100644
index 000000000000..59261807986b
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Import/_files/two_addresses_import_update.csv
@@ -0,0 +1,3 @@
+"_website","_email","_entity_id","city","company","country_id","fax","firstname","lastname","middlename","postcode","prefix","region","region_id","street","suffix","telephone","vat_id","vat_is_valid","vat_request_date","vat_request_id","vat_request_success","_address_default_billing_","_address_default_shipping_"
+"base","customer@example.com",1,"Montgivray",,"FR",,"John","Smith",,36400,,"Paris",257,"1 Avenue du Lion d'Argent",,"33254060414",,,,,,1,1
+"test","customer2@example.com",2,"Madrid",,"ES",,"First","Last",,28045,,"Madrid",161,"Calle de Méndez Álvaro, 72",,"34912759224",,,,,,1,1
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/_files/two_addresses.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/_files/two_addresses.php
new file mode 100644
index 000000000000..996b0c510c01
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/_files/two_addresses.php
@@ -0,0 +1,112 @@
+create(Customer::class);
+/** @var Customer $customer */
+$customer->setId(1)
+ ->setPassword('password')
+ ->setIsActive(1)
+ ->setPrefix('Mr.')
+ ->setFirstname('John')
+ ->setMiddlename('A')
+ ->setLastname('Smith')
+ ->setSuffix('Esq.')
+ ->setDefaultBilling(1)
+ ->setDefaultShipping(1)
+ ->setTaxvat('12')
+ ->setGender(0)
+ ->setWebsiteId(1)
+ ->setGroupId(1)
+ ->setEmail('customer@example.com')
+ ->setStoreId(1);
+
+$customer->isObjectNew(true);
+$customer->save();
+//Second for second website
+/** @var Website $secondWebsite */
+$secondWebsite = $objectManager->create(Website::class);
+$secondWebsite->load('test', 'code');
+/** @var Store $secondStore */
+$secondStore = $objectManager->create(Store::class);
+$secondStore->load('fixture_second_store', 'code');
+$customer = $objectManager->create(Customer::class);
+/** @var Customer $customer */
+$customer->setId(2)
+ ->setPassword('password')
+ ->setIsActive(1)
+ ->setPrefix('Mr.')
+ ->setFirstname('Second')
+ ->setMiddlename(null)
+ ->setLastname('Customer')
+ ->setSuffix('Esq.')
+ ->setDefaultBilling(1)
+ ->setDefaultShipping(1)
+ ->setTaxvat('12')
+ ->setGender(0)
+ ->setWebsiteId($secondWebsite->getId())
+ ->setGroupId(1)
+ ->setEmail('customer2@example.com')
+ ->setStoreId($secondStore->getId());
+
+$customer->isObjectNew(true);
+$customer->save();
+
+//Creating address for the 1st customer.
+/** @var Address $customerAddress */
+$customerAddress = $objectManager->create(Address::class);
+$customerAddress->isObjectNew(true);
+$customerAddress->setData(
+ [
+ 'entity_id' => 2,
+ 'attribute_set_id' => 2,
+ 'telephone' => '+33254060414',
+ 'postcode' => 36400,
+ 'country_id' => 'FR',
+ 'city' => 'Montgivray',
+ 'street' => ['1 Avenue du Lion d\'Argent'],
+ 'lastname' => 'Smith',
+ 'firstname' => 'John',
+ 'parent_id' => 1,
+ 'region_id' => 1,
+ ]
+)->setCustomerId(1)
+ ->setStoreId(1)
+ ->setWebsiteId(1);
+$customerAddress->save();
+//Address for the 2nd customer
+/** @var Address $customerAddress */
+$customerAddress = $objectManager->create(Address::class);
+$customerAddress->isObjectNew(true);
+$customerAddress->setData(
+ [
+ 'entity_id' => 3,
+ 'attribute_set_id' => 2,
+ 'telephone' => '+34912759224',
+ 'postcode' => 28045,
+ 'country_id' => 'ES',
+ 'city' => 'Madrid',
+ 'street' => ['Calle de Méndez Álvaro, 72'],
+ 'lastname' => 'Last',
+ 'firstname' => 'First',
+ 'parent_id' => 1,
+ 'region_id' => 1,
+ ]
+)->setCustomerId(2)
+ ->setStoreId($secondStore->getId())
+ ->setWebsiteId($secondWebsite->getId());
+$customerAddress->save();
diff --git a/dev/tests/integration/testsuite/Magento/CustomerImportExport/_files/two_addresses_rollback.php b/dev/tests/integration/testsuite/Magento/CustomerImportExport/_files/two_addresses_rollback.php
new file mode 100644
index 000000000000..510ad2e360b4
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CustomerImportExport/_files/two_addresses_rollback.php
@@ -0,0 +1,76 @@
+get(Registry::class);
+
+//Removing addresses
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+/** @var Address $customerAddress */
+$customerAddress = Bootstrap::getObjectManager()->create(Address::class);
+$customerAddress->load(1);
+if ($customerAddress->getId()) {
+ $customerAddress->delete();
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
+//Second address
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+/** @var Address $customerAddress */
+$customerAddress = Bootstrap::getObjectManager()->create(Address::class);
+$customerAddress->load(2);
+if ($customerAddress->getId()) {
+ $customerAddress->delete();
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
+
+//Removing customers.
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+/** @var $customer \Magento\Customer\Model\Customer*/
+$customer = Bootstrap::getObjectManager()->create(Customer::class);
+$customer->load(1);
+if ($customer->getId()) {
+ $customer->delete();
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
+/* Unlock account if it was locked for tokens retrieval */
+/** @var RequestThrottler $throttler */
+$throttler = Bootstrap::getObjectManager()->create(RequestThrottler::class);
+$throttler->resetAuthenticationFailuresCount(
+ 'customer@example.com',
+ RequestThrottler::USER_TYPE_CUSTOMER
+);
+//Second customer.
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+/** @var $customer \Magento\Customer\Model\Customer*/
+$customer = Bootstrap::getObjectManager()->create(Customer::class);
+$customer->load(2);
+if ($customer->getId()) {
+ $customer->delete();
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
+/* Unlock account if it was locked for tokens retrieval */
+$throttler->resetAuthenticationFailuresCount(
+ 'customer2@example.com',
+ RequestThrottler::USER_TYPE_CUSTOMER
+);
diff --git a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php
index cb40b110f5fc..c4551ac49d15 100644
--- a/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php
@@ -176,7 +176,7 @@ public function testExecute()
->with(['system' => $comment]);
$outputMock->expects($this->at(1))
->method('writeln')
- ->with('Done.');
+ ->with($this->matchesRegularExpression('/Done. Config types dumped: [a-z0-9,\s]+<\/info>/'));
/** @var ApplicationDumpCommand command */
$command = $this->objectManager->create(ApplicationDumpCommand::class);
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php
index 978b6e1964b0..196fd4b3bfb7 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Model/Observer/SetLinkStatusObserverTest.php
@@ -31,6 +31,7 @@ protected function setUp()
*
* @magentoDataFixture Magento/Downloadable/_files/product_downloadable.php
* @magentoDataFixture Magento/Downloadable/_files/order_with_downloadable_product.php
+ * @magentoDbIsolation disabled
*/
public function testCheckStatusOnOrderCancel()
{
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php
index f9e63c0418f3..b070ef81a14b 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/Model/ResourceModel/Indexer/PriceTest.php
@@ -40,7 +40,7 @@ protected function setUp()
* 2. Run reindexing.
* 3. Load the product again and check all the prices.
*
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Downloadable/_files/product_downloadable_with_files.php
*/
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/_files/order_with_downloadable_product.php b/dev/tests/integration/testsuite/Magento/Downloadable/_files/order_with_downloadable_product.php
index d457c0037d25..b7427a23b180 100644
--- a/dev/tests/integration/testsuite/Magento/Downloadable/_files/order_with_downloadable_product.php
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/_files/order_with_downloadable_product.php
@@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
$billingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Sales\Model\Order\Address::class,
diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/_files/order_with_downloadable_product_rollback.php b/dev/tests/integration/testsuite/Magento/Downloadable/_files/order_with_downloadable_product_rollback.php
new file mode 100644
index 000000000000..96e3adb65a7d
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Downloadable/_files/order_with_downloadable_product_rollback.php
@@ -0,0 +1,8 @@
+getBootstrap()
+ ->getApplication()
+ ->getDbInstance();
+ if (!$db->isDbDumpExists()) {
+ throw new \LogicException('DB dump does not exist.');
+ }
+ $db->restoreFromDbDump();
+
+ parent::setUpBeforeClass();
+ }
+
/**
* Test db backup includes triggers.
*
* @magentoDataFixture Magento/Framework/Backup/_files/trigger.php
+ * @magentoDbIsolation disabled
*/
public function testBackupIncludesCustomTriggers()
{
@@ -48,4 +62,12 @@ public function testBackupIncludesCustomTriggers()
//Clean up.
$write->delete('/backups/' . $time . '_db_testbackup.sql');
}
+
+ /**
+ * teardown
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php
index ec8407dd46ce..c4023d7e36a9 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/DB/TransactionTest.php
@@ -46,4 +46,31 @@ public function testSaveDelete()
$test->load($first->getId());
$this->assertEmpty($test->getId());
}
+
+ /**
+ * @magentoDbIsolation disabled
+ */
+ public function testTransactionLevelDbIsolationDisable()
+ {
+ $resourceConnection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Framework\App\ResourceConnection::class);
+ $this->assertEquals(0, $resourceConnection->getConnection('default')->getTransactionLevel());
+ }
+
+ /**
+ * @magentoDbIsolation enabled
+ */
+ public function testTransactionLevelDbIsolationEnabled()
+ {
+ $resourceConnection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Framework\App\ResourceConnection::class);
+ $this->assertEquals(1, $resourceConnection->getConnection('default')->getTransactionLevel());
+ }
+
+ public function testTransactionLevelDbIsolationDefault()
+ {
+ $resourceConnection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(\Magento\Framework\App\ResourceConnection::class);
+ $this->assertEquals(0, $resourceConnection->getConnection('default')->getTransactionLevel());
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php b/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php
index fa81bb637b9c..16a15cfcd2e2 100644
--- a/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php
@@ -12,14 +12,17 @@
use Magento\Framework\App\Request\Http;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Serialize\SerializerInterface;
+use Magento\TestFramework\Helper\Bootstrap;
/**
* Tests the dispatch method in the GraphQl Controller class using a simple product query
*
* @magentoAppArea graphql
* @magentoDataFixture Magento/Catalog/_files/product_simple_with_url_key.php
+ * @magentoDbIsolation disabled
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class GraphQlControllerTest extends \PHPUnit\Framework\TestCase
+class GraphQlControllerTest extends \Magento\TestFramework\Indexer\TestCase
{
const CONTENT_TYPE = 'application/json';
@@ -35,6 +38,19 @@ class GraphQlControllerTest extends \PHPUnit\Framework\TestCase
/** @var MetadataPool */
private $metadataPool;
+ public static function setUpBeforeClass()
+ {
+ $db = Bootstrap::getInstance()->getBootstrap()
+ ->getApplication()
+ ->getDbInstance();
+ if (!$db->isDbDumpExists()) {
+ throw new \LogicException('DB dump does not exist.');
+ }
+ $db->restoreFromDbDump();
+
+ parent::setUpBeforeClass();
+ }
+
protected function setUp() : void
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
@@ -153,4 +169,12 @@ public function testError() : void
}
}
}
+
+ /**
+ * teardown
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php
index 48ecd4688aad..45af6db444e1 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/ResourceModel/Product/Indexer/Price/GroupedTest.php
@@ -50,6 +50,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped.php
* @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
*/
public function testReindex()
{
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_rollback.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_rollback.php
index 31c3cbaf2e54..008f65e62600 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_rollback.php
@@ -24,13 +24,12 @@
//already deleted
}
-/** @var $virtualProduct \Magento\Catalog\Model\Product */
-$virtualProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
- \Magento\Catalog\Model\Product::class
-);
-$virtualProduct->load(21);
-if ($virtualProduct->getId()) {
+try {
+ /** @var $virtualProduct \Magento\Catalog\Model\Product */
+ $virtualProduct = $productRepository->get('virtual-product', false, null, true);
$virtualProduct->delete();
+} catch (NoSuchEntityException $e) {
+ //already deleted
}
try {
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php
index 8ea4f854d45c..1b3d6aef39aa 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Api/PayflowNvpTest.php
@@ -81,6 +81,7 @@ protected function setUp()
* Checks a case when items and discount are present in the request.
*
* @magentoDataFixture Magento/Paypal/_files/quote_payflowpro.php
+ * @magentoDbIsolation disabled
*/
public function testRequestLineItems()
{
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
index 4f1953a802c0..0552b9b937ad 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreementTest.php
@@ -6,12 +6,26 @@
namespace Magento\Paypal\Model\Payment\Method\Billing;
use Magento\Quote\Api\Data\PaymentInterface;
+use Magento\TestFramework\Helper\Bootstrap;
-class AbstractAgreementTest extends \PHPUnit\Framework\TestCase
+class AbstractAgreementTest extends \Magento\TestFramework\Indexer\TestCase
{
/** @var \Magento\Paypal\Model\Method\Agreement */
protected $_model;
+ public static function setUpBeforeClass()
+ {
+ $db = Bootstrap::getInstance()->getBootstrap()
+ ->getApplication()
+ ->getDbInstance();
+ if (!$db->isDbDumpExists()) {
+ throw new \LogicException('DB dump does not exist.');
+ }
+ $db->restoreFromDbDump();
+
+ parent::setUpBeforeClass();
+ }
+
protected function setUp()
{
$config = $this->getMockBuilder(\Magento\Paypal\Model\Config::class)->disableOriginalConstructor()->getMock();
@@ -72,4 +86,12 @@ public function testAssignData()
$info->getAdditionalInformation(AbstractAgreement::PAYMENT_INFO_REFERENCE_ID)
);
}
+
+ /**
+ * teardown
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php
index 507dfc029d6b..52ef9bfee68b 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/RepositoryTest.php
@@ -34,9 +34,18 @@ public function testGetList()
$actualQuoteItem = array_pop($quoteItems);
$this->assertInstanceOf(\Magento\Quote\Api\Data\CartItemInterface::class, $actualQuoteItem);
/** @var \Magento\User\Api\Data\UserInterface $testAttribute */
- $testAttribute = $actualQuoteItem->getExtensionAttributes()->getQuoteItemTestAttribute();
- $this->assertEquals($expectedExtensionAttributes['firstname'], $testAttribute->getFirstName());
- $this->assertEquals($expectedExtensionAttributes['lastname'], $testAttribute->getLastName());
- $this->assertEquals($expectedExtensionAttributes['email'], $testAttribute->getEmail());
+ $testAttribute = $actualQuoteItem->getExtensionAttributes()->__toArray();
+ $this->assertEquals(
+ $expectedExtensionAttributes['firstname'],
+ $testAttribute['quoteItemTestAttribute']['firstname']
+ );
+ $this->assertEquals(
+ $expectedExtensionAttributes['lastname'],
+ $testAttribute['quoteItemTestAttribute']['lastname']
+ );
+ $this->assertEquals(
+ $expectedExtensionAttributes['email'],
+ $testAttribute['quoteItemTestAttribute']['email']
+ );
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php
index f73ee555eb52..e2c25e76ceaa 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php
@@ -13,6 +13,21 @@
*/
class ShippingMethodManagementTest extends \PHPUnit\Framework\TestCase
{
+ /**
+ * @magentoDataFixture Magento/SalesRule/_files/cart_rule_100_percent_off.php
+ * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php
+ * @return void
+ */
+ public function testRateAppliedToShipping(): void
+ {
+ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+
+ /** @var \Magento\Quote\Api\CartRepositoryInterface $quoteRepository */
+ $quoteRepository = $objectManager->create(\Magento\Quote\Api\CartRepositoryInterface::class);
+ $customerQuote = $quoteRepository->getForCustomer(1);
+ $this->assertEquals(0, $customerQuote->getBaseGrandTotal());
+ }
+
/**
* @magentoConfigFixture current_store carriers/tablerate/active 1
* @magentoConfigFixture current_store carriers/tablerate/condition_name package_qty
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 408cc8d192e3..c54c80bb6f6c 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -52,6 +52,7 @@ protected function setUp()
/**
* @magentoDataFixture Magento/Downloadable/_files/product_downloadable.php
* @magentoDataFixture Magento/Downloadable/_files/order_with_downloadable_product.php
+ * @magentoDbIsolation disabled
*/
public function testInitFromOrderShippingAddressSameAsBillingWhenEmpty()
{
@@ -70,7 +71,7 @@ public function testInitFromOrderShippingAddressSameAsBillingWhenEmpty()
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Downloadable/_files/product_downloadable.php
* @magentoDataFixture Magento/Downloadable/_files/order_with_downloadable_product_with_additional_options.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testInitFromOrderAndCreateOrderFromQuoteWithAdditionalOptions()
@@ -132,6 +133,7 @@ public function testInitFromOrderAndCreateOrderFromQuoteWithAdditionalOptions()
* @magentoDataFixture Magento/Downloadable/_files/product_downloadable.php
* @magentoDataFixture Magento/Downloadable/_files/order_with_downloadable_product.php
* @magentoDataFixture Magento/Sales/_files/order_shipping_address_same_as_billing.php
+ * @magentoDbIsolation disabled
*/
public function testInitFromOrderShippingAddressSameAsBillingWhenSame()
{
@@ -163,6 +165,7 @@ public function testInitFromOrderShippingAddressSameAsBillingWhenSame()
* @magentoDataFixture Magento/Downloadable/_files/product_downloadable.php
* @magentoDataFixture Magento/Downloadable/_files/order_with_downloadable_product.php
* @magentoDataFixture Magento/Sales/_files/order_shipping_address_different_to_billing.php
+ * @magentoDbIsolation disabled
*/
public function testInitFromOrderShippingAddressSameAsBillingWhenDifferent()
{
@@ -180,6 +183,7 @@ public function testInitFromOrderShippingAddressSameAsBillingWhenDifferent()
/**
* @magentoDataFixture Magento/Sales/_files/order_paid_with_payflowpro.php
+ * @magentoDbIsolation disabled
*/
public function testInitFromOrderCcInformationDeleted()
{
@@ -204,6 +208,7 @@ public function testInitFromOrderCcInformationDeleted()
/**
* @magentoDataFixture Magento/Sales/_files/order.php
+ * @magentoDbIsolation disabled
*/
public function testInitFromOrderWithEmptyPaymentDetails()
{
@@ -244,7 +249,6 @@ public function testGetCustomerWishlistNoCustomerId()
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoAppIsolation enabled
- * @magentoDbIsolation enabled
*/
public function testGetCustomerWishlist()
{
@@ -322,8 +326,7 @@ public function testSetBillingAddress()
/**
* @magentoDataFixture Magento/Customer/_files/customer.php
- * @magentoAppIsolation enabled
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
*/
public function testSetBillingAddressValidationErrors()
{
@@ -361,7 +364,6 @@ public function testSetBillingAddressValidationErrors()
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
- * @magentoDbIsolation enabled
* @magentoAppIsolation enabled
*/
public function testCreateOrderNewCustomerDifferentAddresses()
@@ -409,7 +411,7 @@ public function testCreateOrderNewCustomerDifferentAddresses()
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple_with_decimal_qty.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testCreateOrderNewCustomer()
@@ -450,7 +452,7 @@ public function testCreateOrderNewCustomer()
* Tests order creation with new customer after failed first place order action.
*
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @dataProvider createOrderNewCustomerWithFailedFirstPlaceOrderActionDataProvider
* @param string $customerEmailFirstAttempt
@@ -537,7 +539,7 @@ public function createOrderNewCustomerWithFailedFirstPlaceOrderActionDataProvide
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Customer/_files/customer.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testCreateOrderExistingCustomerDifferentAddresses()
@@ -590,7 +592,7 @@ public function testCreateOrderExistingCustomerDifferentAddresses()
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDataFixture Magento/Customer/_files/customer.php
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
*/
public function testCreateOrderExistingCustomer()
@@ -628,6 +630,7 @@ public function testCreateOrderExistingCustomer()
* @magentoDataFixture Magento/Sales/_files/quote.php
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
*/
public function testGetCustomerCartExistingCart()
{
@@ -655,6 +658,7 @@ public function testGetCustomerCartExistingCart()
* @magentoDataFixture Magento/Sales/_files/quote.php
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoAppIsolation enabled
+ * @magentoDbIsolation disabled
*/
public function testMoveQuoteItemToCart()
{
@@ -679,7 +683,7 @@ public function testMoveQuoteItemToCart()
/**
* @magentoAppIsolation enabled
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
public function testGetCustomerCartNewCart()
diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php
index d2557ddd3297..c99e7de47f3e 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php
@@ -54,7 +54,10 @@
$quote->getPayment()->setMethod('checkmo');
$quote->setIsMultiShipping('1');
$quote->collectTotals();
-$quote->save();
+
+$quoteRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->create(\Magento\Quote\Api\CartRepositoryInterface::class);
+$quoteRepository->save($quote);
/** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */
$quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php
index 12d7615943fb..f619193d4921 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php
@@ -17,6 +17,7 @@ class CollectionTest extends \PHPUnit\Framework\TestCase
* @dataProvider setValidationFilterDataProvider()
* @param string $couponCode
* @param array $expectedItems
+ * @magentoDbIsolation disabled
*/
public function testSetValidationFilter($couponCode, $expectedItems)
{
@@ -63,7 +64,7 @@ public function setValidationFilterDataProvider()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Checkout/_files/quote_with_shipping_method_and_items_categories.php
* @magentoDataFixture Magento/SalesRule/_files/rules_group_any_categories.php
@@ -100,7 +101,7 @@ public function testSetValidationFilterWithGroup()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Checkout/_files/quote_with_shipping_method_and_items_categories.php
* @magentoDataFixture Magento/SalesRule/_files/rules_group_any_categories.php
@@ -136,7 +137,7 @@ public function testSetValidationFilterAnyCategory()
}
/**
- * @magentoDbIsolation enabled
+ * @magentoDbIsolation disabled
* @magentoAppIsolation enabled
* @magentoDataFixture Magento/Checkout/_files/quote_with_shipping_method_and_items_categories.php
* @magentoDataFixture Magento/SalesRule/_files/rules_group_not_categories_sku_attr.php
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php
index 158cc3da2d0c..02a4ba4c282a 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php
@@ -29,6 +29,7 @@ protected function setUp()
* @param int $categoryId
* @param bool $expectedResult
* @dataProvider validateProductConditionDataProvider
+ * @magentoDbIsolation disabled
*/
public function testValidateCategorySalesRuleIncludesChildren($categoryId, $expectedResult)
{
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_100_percent_off.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_100_percent_off.php
new file mode 100644
index 000000000000..1c2b725d1986
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_100_percent_off.php
@@ -0,0 +1,37 @@
+get(\Magento\Framework\Registry::class);
+
+/** @var \Magento\SalesRule\Model\Rule $salesRule */
+$salesRule = $objectManager->create(\Magento\SalesRule\Model\Rule::class);
+$salesRule->setData(
+ [
+ 'name' => '100% Off for all orders',
+ 'is_active' => 1,
+ 'customer_group_ids' => [\Magento\Customer\Model\GroupManagement::NOT_LOGGED_IN_ID],
+ 'coupon_type' => \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON,
+ 'conditions' => [],
+ 'simple_action' => 'by_percent',
+ 'discount_amount' => 100,
+ 'discount_step' => 0,
+ 'stop_rules_processing' => 1,
+ 'website_ids' => [
+ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+ )->getWebsite()->getId(),
+ ],
+ 'discount_qty' => 0,
+ 'apply_to_shipping' => 1,
+ 'simple_free_shipping' => 1,
+ ]
+);
+$salesRule->save();
+$registry->unregister('Magento/SalesRule/_files/cart_rule_100_percent_off');
+$registry->register('Magento/SalesRule/_files/cart_rule_100_percent_off', $salesRule->getRuleId());
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_100_percent_off_rollback.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_100_percent_off_rollback.php
new file mode 100644
index 000000000000..c7d95455c78d
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_100_percent_off_rollback.php
@@ -0,0 +1,15 @@
+get(\Magento\Framework\Registry::class);
+
+/** @var Magento\SalesRule\Model\Rule $rule */
+$rule = $registry->registry('cart_rule_100_percent_off');
+if ($rule) {
+ $rule->delete();
+}
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_40_percent_off_rollback.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_40_percent_off_rollback.php
new file mode 100644
index 000000000000..c6e145842f29
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_40_percent_off_rollback.php
@@ -0,0 +1,15 @@
+get(\Magento\Framework\Registry::class);
+
+/** @var Magento\SalesRule\Model\Rule $rule */
+$rule = $registry->registry('cart_rule_40_percent_off');
+if ($rule) {
+ $rule->delete();
+}
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_rollback.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_rollback.php
new file mode 100644
index 000000000000..d694e9972ec7
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off_rollback.php
@@ -0,0 +1,15 @@
+get(\Magento\Framework\Registry::class);
+
+/** @var Magento\SalesRule\Model\Rule $rule */
+$rule = $registry->registry('cart_rule_50_percent_off');
+if ($rule) {
+ $rule->delete();
+}
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_group_any_categories_rollback.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_group_any_categories_rollback.php
new file mode 100644
index 000000000000..f35c531af16f
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_group_any_categories_rollback.php
@@ -0,0 +1,16 @@
+get(\Magento\SalesRule\Model\ResourceModel\Rule\Collection::class);
+
+/** @var Rule $rule */
+foreach ($collection as $rule) {
+ $rule->delete();
+}
diff --git a/dev/tests/integration/testsuite/Magento/SampleData/_files/Modules/FirstModule/composer.json b/dev/tests/integration/testsuite/Magento/SampleData/_files/Modules/FirstModule/composer.json
index f6c95593116d..dae16d56b31a 100644
--- a/dev/tests/integration/testsuite/Magento/SampleData/_files/Modules/FirstModule/composer.json
+++ b/dev/tests/integration/testsuite/Magento/SampleData/_files/Modules/FirstModule/composer.json
@@ -2,7 +2,7 @@
"name": "magento/module-first",
"description": "N/A",
"suggest": {
- "magento/module-first-sample-data": "Sample Data version:777.7.*"
+ "magento/module-first-sample-data": "Sample Data version: 777.7.*"
},
"type": "magento2-module",
"config": {
diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php b/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php
index 52316c408616..c2724fe8c61d 100644
--- a/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Setup/Model/FixtureGenerator/ProductGeneratorTest.php
@@ -69,6 +69,9 @@ protected function tearDown()
}
}
+ /**
+ * @magentoDbIsolation disabled
+ */
public function testProductGeneration()
{
$name = 'Simple Product Name';
diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php
index 3a9378c77bc4..b8ae7751a15e 100644
--- a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ResourceModel/Catalog/ProductTest.php
@@ -17,7 +17,7 @@ class ProductTest extends \PHPUnit\Framework\TestCase
/**
* Base product image path
*/
- const BASE_IMAGE_PATH = 'http://localhost/pub/media/catalog/product/cache/c9e0b0ef589f3508e5ba515cde53c5ff';
+ const BASE_IMAGE_PATH = 'http://localhost/pub/media/catalog/product/cache/8d4d2075b1a30681853bef5bdc41b164';
/**
* Test getCollection None images
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore_rollback.php
new file mode 100644
index 000000000000..1799845aced4
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore_rollback.php
@@ -0,0 +1,42 @@
+get(\Magento\Framework\Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+$website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Website::class);
+/** @var $website \Magento\Store\Model\Website */
+$websiteId = $website->load('secondwebsite', 'code')->getId();
+if ($websiteId) {
+ $website->delete();
+}
+$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class);
+if ($store->load('secondstore', 'code')->getId()) {
+ $store->delete();
+}
+
+/** @var $website \Magento\Store\Model\Website */
+$websiteId = $website->load('thirdwebsite', 'code')->getId();
+if ($websiteId) {
+ $website->delete();
+}
+
+$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class);
+if ($store->load('thirdstore', 'code')->getId()) {
+ $store->delete();
+}
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
+
+/* Refresh stores memory cache */
+\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+)->reinitStores();
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/fixture_store_with_catalogsearch_index_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/fixture_store_with_catalogsearch_index_rollback.php
index 251635dcff09..8a69f83882ad 100644
--- a/dev/tests/integration/testsuite/Magento/Store/_files/fixture_store_with_catalogsearch_index_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/fixture_store_with_catalogsearch_index_rollback.php
@@ -20,3 +20,8 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
+
+/* Refresh stores memory cache */
+\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+)->reinitStores();
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php
index 56ba31fad4ed..4fc5d3b65b27 100644
--- a/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php
@@ -20,3 +20,8 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
+
+/* Refresh stores memory cache */
+\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+)->reinitStores();
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/second_website_with_two_stores_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/second_website_with_two_stores_rollback.php
index eef8cf960944..b97dc4dd40bd 100644
--- a/dev/tests/integration/testsuite/Magento/Store/_files/second_website_with_two_stores_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/second_website_with_two_stores_rollback.php
@@ -27,3 +27,8 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
+
+/* Refresh stores memory cache */
+\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+)->reinitStores();
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/store.php b/dev/tests/integration/testsuite/Magento/Store/_files/store.php
index 2f11196c99b1..e49d16e2ede6 100644
--- a/dev/tests/integration/testsuite/Magento/Store/_files/store.php
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/store.php
@@ -20,6 +20,22 @@
]
);
$store->save();
+} else {
+ if ($store->getId()) {
+ $store->delete();
+ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class);
+ $store->setData(
+ [
+ 'code' => 'test',
+ 'website_id' => '1',
+ 'group_id' => '1',
+ 'name' => 'Test Store',
+ 'sort_order' => '0',
+ 'is_active' => '1',
+ ]
+ );
+ $store->save();
+ }
}
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/* Refresh stores memory cache */
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/store_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/store_rollback.php
index 3c0acfef2472..3b437f08c8c3 100644
--- a/dev/tests/integration/testsuite/Magento/Store/_files/store_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/store_rollback.php
@@ -22,5 +22,17 @@
$store->delete();
}
+/** @var Store $store */
+$store = $objectManager->get(Store::class);
+$store->load('test', 'code');
+if ($store->getId()) {
+ $store->delete();
+}
+
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
+
+/* Refresh stores memory cache */
+\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+)->reinitStores();
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/website_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/website_rollback.php
index 9c33f4c9ca67..2a5385f99738 100644
--- a/dev/tests/integration/testsuite/Magento/Store/_files/website_rollback.php
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/website_rollback.php
@@ -20,3 +20,8 @@
$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
+
+/* Refresh stores memory cache */
+\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Store\Model\StoreManagerInterface::class
+)->reinitStores();
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/websites_different_countries.php b/dev/tests/integration/testsuite/Magento/Store/_files/websites_different_countries.php
new file mode 100644
index 000000000000..7a20eee64058
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/websites_different_countries.php
@@ -0,0 +1,72 @@
+create(Website::class);
+$website->load('test', 'code');
+
+if (!$website->getId()) {
+ $website->setData([
+ 'code' => 'test',
+ 'name' => 'Test Website',
+ 'default_group_id' => '1',
+ 'is_default' => '0',
+ ]);
+ $website->save();
+}
+
+$websiteId = $website->getId();
+$store = $objectManager->create(Store::class);
+$store->load('fixture_second_store', 'code');
+
+if (!$store->getId()) {
+ $groupId = $website->getDefaultGroupId();
+ $store->setData([
+ 'code' => 'fixture_second_store',
+ 'website_id' => $websiteId,
+ 'group_id' => $groupId,
+ 'name' => 'Fixture Second Store',
+ 'sort_order' => 10,
+ 'is_active' => 1,
+ ]);
+ $store->save();
+}
+
+/* Refresh stores memory cache */
+$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
+
+//Setting up allowed countries
+$configResource = $objectManager->get(\Magento\Config\Model\ResourceModel\Config::class);
+//Allowed countries for default website.
+$configResource->saveConfig(
+ 'general/country/allow',
+ 'FR',
+ \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES,
+ 1
+);
+//Allowed countries for second website
+$configResource->saveConfig(
+ 'general/country/allow',
+ 'ES',
+ \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES,
+ $websiteId
+);
+
+/* Refresh CatalogSearch index */
+/** @var \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry */
+$indexerRegistry = $objectManager->create(\Magento\Framework\Indexer\IndexerRegistry::class);
+$indexerRegistry->get(FulltextIndex::INDEXER_ID)->reindexAll();
+//Clear config cache.
+$objectManager->get(ReinitableConfigInterface::class)->reinit();
diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/websites_different_countries_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/websites_different_countries_rollback.php
new file mode 100644
index 000000000000..0e4de1595bbc
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Store/_files/websites_different_countries_rollback.php
@@ -0,0 +1,58 @@
+create(Store::class);
+if ($store->load('fixture_second_store', 'code')->getId()) {
+ $store->delete();
+}
+
+//Deleting the second website.
+/** @var Registry $registry */
+$registry = $objectManager->get(Registry::class);
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+$configResource = $objectManager->get(\Magento\Config\Model\ResourceModel\Config::class);
+//Restoring allowed countries.
+$configResource->deleteConfig(
+ 'general/country/allow',
+ \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES,
+ 1
+);
+/** @var Website $website */
+$website = $objectManager->create(Website::class);
+$website->load('test');
+if ($website->getId()) {
+ $configResource->deleteConfig(
+ 'general/country/allow',
+ \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES,
+ $website->getId()
+ );
+ $website->delete();
+}
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
+
+/* Refresh stores memory cache */
+/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
+$storeManager = $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class);
+$storeManager->reinitStores();
+/* Refresh CatalogSearch index */
+/** @var \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry */
+$indexerRegistry = $objectManager->create(\Magento\Framework\Indexer\IndexerRegistry::class);
+$indexerRegistry->get(FulltextIndex::INDEXER_ID)->reindexAll();
+//Clear config cache.
+$objectManager->get(ReinitableConfigInterface::class)->reinit();
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php
index 47a153dc99eb..f2857e2d9d0d 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/SourceTest.php
@@ -9,8 +9,24 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Tax\Model\Rate\Provider;
-class SourceTest extends \PHPUnit\Framework\TestCase
+class SourceTest extends \Magento\TestFramework\Indexer\TestCase
{
+ public static function setUpBeforeClass()
+ {
+ $db = Bootstrap::getInstance()->getBootstrap()
+ ->getApplication()
+ ->getDbInstance();
+ if (!$db->isDbDumpExists()) {
+ throw new \LogicException('DB dump does not exist.');
+ }
+ $db->restoreFromDbDump();
+
+ parent::setUpBeforeClass();
+ }
+
+ /**
+ * @magentoDbIsolation disabled
+ */
public function testToOptionArray()
{
/** @var \Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection $collection */
@@ -39,4 +55,12 @@ public function testToOptionArray()
'Tax rate options are invalid.'
);
}
+
+ /**
+ * teardown
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php
index 2dd0a916f20d..5559d6c43feb 100644
--- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/RouteConfigFilesTest.php
@@ -61,7 +61,7 @@ public function testRouteConfigsValidation()
$files = array_merge($files, glob($mask));
}
$mergedConfig = new \Magento\Framework\Config\Dom(
- '',
+ '',
$this->validationStateMock,
$this->_idAttributes
);
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js
index 03ee43835f96..916733fd2b0a 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js
@@ -235,29 +235,77 @@ define([
describe('onFileUploaded handler', function () {
it('calls addFile method if upload was successful', function () {
+ spyOn(component, 'aggregateError');
spyOn(component, 'addFile');
component.onFileUploaded({}, {
+ files: [{
+ name: 'hello.jpg'
+ }],
result: {
error: false
}
});
+ expect(component.aggregateError).not.toHaveBeenCalled();
expect(component.addFile).toHaveBeenCalled();
});
- it('calls notifyError method if upload resulted in error', function () {
- spyOn(component, 'notifyError');
- spyOn(component, 'addFile');
-
- component.onFileUploaded({}, {
- result: {
- error: true
- }
+ it('should call uploaderConfig.stop when number of errors is equal to number of files', function () {
+ var fakeEvent = {
+ target: document.createElement('input')
+ },
+ file = {
+ name: 'hello.jpg'
+ },
+ data = {
+ files: [file],
+ originalFiles: [file]
+ };
+
+ spyOn(component, 'isFileAllowed').and.callFake(function (fileArg) {
+ expect(fileArg).toBe(file);
+
+ return {
+ passed: false,
+ message: 'Not awesome enough'
+ };
+ });
+ component.initUploader();
+ spyOn(component.uploaderConfig, 'done');
+ spyOn(component.uploaderConfig, 'stop');
+ component.onBeforeFileUpload(fakeEvent, data);
+ expect(component.uploaderConfig.stop).toHaveBeenCalled();
+ });
+ it('should not call uploaderConfig.stop when number of errors is unequal to number of files', function () {
+ var fakeEvent = {
+ target: document.createElement('input')
+ },
+ file = {
+ name: 'hello.jpg'
+ },
+ otherFileInQueue = {
+ name: 'world.png'
+ },
+ data = {
+ files: [file],
+ originalFiles: [file, otherFileInQueue]
+ };
+
+ component.initUploader();
+ spyOn(component.uploaderConfig, 'done');
+ spyOn(component.uploaderConfig, 'stop');
+ spyOn(component, 'isFileAllowed').and.callFake(function (fileArg) {
+ expect(fileArg).toBe(file);
+
+ return {
+ passed: false,
+ message: 'Not awesome enough'
+ };
});
- expect(component.notifyError).toHaveBeenCalled();
- expect(component.addFile).not.toHaveBeenCalled();
+ component.onBeforeFileUpload(fakeEvent, data);
+ expect(component.uploaderConfig.stop).not.toHaveBeenCalled();
});
});
@@ -272,5 +320,18 @@ define([
expect(component.initUploader).toHaveBeenCalledWith(input);
});
});
+
+ describe('aggregateError method', function () {
+ it('should append onto aggregatedErrors array when called', function () {
+ spyOn(component.aggregatedErrors, 'push');
+
+ component.aggregateError('blah.jpg', 'File is too awesome');
+
+ expect(component.aggregatedErrors.push).toHaveBeenCalledWith({
+ filename: 'blah.jpg',
+ message: 'File is too awesome'
+ });
+ });
+ });
});
});
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema.xml
index 3eeb141c2e60..c57581d7f162 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema.xml
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema_whitelist.json b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema_whitelist.json
index 890fea33106b..14b4887b662e 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema_whitelist.json
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/etc/db_schema_whitelist.json
@@ -52,5 +52,28 @@
"some_unique_key": true,
"some_foreign_key": true
}
+ },
+ "store": {
+ "column": {
+ "store_owner_id": true,
+ "store_owner": true
+ },
+ "constraint": {
+ "STORE_OWNER_ID_REFERENCE": true
+ }
+ },
+ "store_owner": {
+ "column": {
+ "owner_id": true,
+ "label": true
+ },
+ "constraint": {
+ "": true
+ }
+ },
+ "some_table": {
+ "column": {
+ "some_column": true
+ }
}
}
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php
new file mode 100644
index 000000000000..aa80af695cc9
--- /dev/null
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php
@@ -0,0 +1,27 @@
+ [
+ 'store' => 'CREATE TABLE `store` (
+ `store_owner_id` smallint(5) DEFAULT NULL COMMENT \'Store Owner Reference\',
+ KEY `STORE_OWNER_ID_REFERENCE` (`store_owner_id`),
+ CONSTRAINT `STORE_OWNER_ID_REFERENCE` FOREIGN KEY (`store_owner_id`) REFERENCES `store_owner` (`owner_id`) ON DELETE SET NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8',
+ 'store_owner' => 'CREATE TABLE `store_owner` (
+ `owner_id` smallint(5) NOT NULL AUTO_INCREMENT,
+ `store_owner_name` varchar(255) DEFAULT NULL COMMENT \'Store Owner Name\',
+ PRIMARY KEY (`owner_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'Store owner information\''
+ ],
+ 'after' => [
+ 'store' => 'CREATE TABLE `store` (
+ `store_owner` varchar(255) DEFAULT NULL COMMENT \'Store Owner Name\'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8'
+ ]
+];
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_rename.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_rename.php
new file mode 100644
index 000000000000..0f2a05e14255
--- /dev/null
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_rename.php
@@ -0,0 +1,15 @@
+ 'CREATE TABLE `some_table` (
+ `some_column` varchar(255) DEFAULT NULL COMMENT \'Some Column Name\'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8',
+ 'after' => 'CREATE TABLE `some_table_renamed` (
+ `some_column` varchar(255) DEFAULT NULL COMMENT \'Some Column Name\'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8',
+];
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.php
index 0ad786b67b82..43680b4218f6 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.php
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.php
@@ -17,13 +17,13 @@
`bigint_default_nullable` bigint(2) UNSIGNED NULL DEFAULT 1 ,
`bigint_not_default_not_nullable` bigint(2) UNSIGNED NOT NULL ,
CONSTRAINT PRIMARY KEY (`tinyint_ref`)
-) ENGINE=innodb
+) ENGINE=innodb DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_general_ci
CREATE TABLE `auto_increment_test` (
`int_auto_increment_with_nullable` int(12) UNSIGNED NOT NULL AUTO_INCREMENT ,
`int_disabled_auto_increment` smallint(12) UNSIGNED NULL DEFAULT 0 ,
CONSTRAINT `unique_null_key` UNIQUE KEY (`int_auto_increment_with_nullable`)
-) ENGINE=innodb
+) ENGINE=innodb DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_general_ci
CREATE TABLE `test_table` (
`smallint` smallint(3) NOT NULL AUTO_INCREMENT ,
@@ -44,12 +44,12 @@
CONSTRAINT `some_unique_key` UNIQUE KEY (`smallint`,`bigint`),
CONSTRAINT `some_foreign_key` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE NO ACTION,
INDEX `speedup_index` (`tinyint`,`bigint`)
-) ENGINE=innodb
+) ENGINE=innodb DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_general_ci
CREATE TABLE `patch_list` (
`patch_id` int(11) NOT NULL AUTO_INCREMENT COMMENT "Patch Auto Increment",
`patch_name` varchar(1024) NOT NULL COMMENT "Patch Class Name",
CONSTRAINT PRIMARY KEY (`patch_id`)
-) ENGINE=innodb COMMENT="List of data/schema patches"
+) ENGINE=innodb DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_general_ci COMMENT="List of data/schema patches"
'];
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/foreign_key_interpreter_result.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/foreign_key_interpreter_result.php
index 005c40b104ed..e912d9fb96f4 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/foreign_key_interpreter_result.php
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/foreign_key_interpreter_result.php
@@ -17,7 +17,7 @@
],
],
'name' => 'reference_table',
- 'resource' => 'sales',
+ 'resource' => 'default',
],
'test_table' => [
'column' => [
@@ -41,7 +41,7 @@
],
],
'name' => 'test_table',
- 'resource' => 'sales',
+ 'resource' => 'default',
],
],
];
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/valid_xml_revision_1.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/valid_xml_revision_1.php
index 51be7db7a257..7aaf37ba156f 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/valid_xml_revision_1.php
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/valid_xml_revision_1.php
@@ -97,7 +97,7 @@
],
],
'name' => 'reference_table',
- 'resource' => 'sales',
+ 'resource' => 'default',
],
'auto_increment_test' => [
'column' => [
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/after_rollback/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/after_rollback/db_schema.xml
new file mode 100644
index 000000000000..467a9f9b5eca
--- /dev/null
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/after_rollback/db_schema.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/before_rollback/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/before_rollback/db_schema.xml
new file mode 100644
index 000000000000..242b555a1494
--- /dev/null
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/before_rollback/db_schema.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/column_modifications/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/column_modifications/db_schema.xml
index 0929fe8db8cd..a748af135c20 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/column_modifications/db_schema.xml
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/column_modifications/db_schema.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_column_declaration/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_column_declaration/db_schema.xml
index b79f9d5beb5c..8759b9f87ae8 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_column_declaration/db_schema.xml
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_column_declaration/db_schema.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_unique_key_declaration/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_unique_key_declaration/db_schema.xml
index 787d6d9ce5a3..9733f3b1bbc4 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_unique_key_declaration/db_schema.xml
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/fail_on_unique_key_declaration/db_schema.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/foreign_key_interpreter/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/foreign_key_interpreter/db_schema.xml
index a2895ee56d61..2b8b162bf2a9 100644
--- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/foreign_key_interpreter/db_schema.xml
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/foreign_key_interpreter/db_schema.xml
@@ -7,10 +7,10 @@
-->
-
+
-
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/table_rename/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/table_rename/db_schema.xml
new file mode 100644
index 000000000000..558f15446fbe
--- /dev/null
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/table_rename/db_schema.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/table_rename_after/db_schema.xml b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/table_rename_after/db_schema.xml
new file mode 100644
index 000000000000..c478cd15a0b5
--- /dev/null
+++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/revisions/table_rename_after/db_schema.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/ReinstallInstance.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/ReinstallInstance.php
index e97ba3f3bcb8..6f7949861928 100644
--- a/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/ReinstallInstance.php
+++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/ReinstallInstance.php
@@ -6,7 +6,10 @@
namespace Magento\TestFramework\Annotation;
+use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Module\ModuleResource;
+use Magento\TestFramework\Helper\Bootstrap;
+use Magento\TestFramework\ObjectManager;
/**
* Handler for applying reinstallMagento annotation.
@@ -31,6 +34,11 @@ public function __construct(\Magento\TestFramework\Application $application)
public function startTest()
{
$this->application->reinitialize();
+ /** @var ObjectManager $objectManager */
+ $objectManager = Bootstrap::getObjectManager();
+ $resourceConnection = $objectManager->create(ResourceConnection::class);
+ $objectManager->removeSharedInstance(ResourceConnection::class);
+ $objectManager->addSharedInstance($resourceConnection, ResourceConnection::class);
}
/**
diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Bootstrap/SetupDocBlock.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Bootstrap/SetupDocBlock.php
index 8e212289eb12..6732a8de4eb1 100644
--- a/dev/tests/setup-integration/framework/Magento/TestFramework/Bootstrap/SetupDocBlock.php
+++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Bootstrap/SetupDocBlock.php
@@ -5,8 +5,6 @@
*/
namespace Magento\TestFramework\Bootstrap;
-use Magento\TestFramework\Annotation\AppIsolation;
-
/**
* Bootstrap of the custom DocBlock annotations.
*
diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php
index a659c82d871d..10a839df83a5 100644
--- a/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php
+++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Deploy/CliCommand.php
@@ -5,6 +5,7 @@
*/
namespace Magento\TestFramework\Deploy;
+use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\Shell;
use Magento\Framework\Shell\CommandRenderer;
use Magento\Setup\Console\Command\InstallCommand;
@@ -29,10 +30,16 @@ class CliCommand
*/
private $parametersHolder;
+ /**
+ * @var DeploymentConfig
+ */
+ private $deploymentConfig;
+
/**
* ShellCommand constructor.
*
* @param TestModuleManager $testEnv
+ * @param DeploymentConfig $deploymentConfig
* @internal param Shell $shell
*/
public function __construct(
@@ -96,7 +103,7 @@ public function disableModule($moduleName)
{
$initParams = $this->parametersHolder->getInitParams();
$disableModuleCommand = 'php -f ' . BP . '/bin/magento module:disable '. $moduleName
- . ' -vvv --magento-init-params=' . $initParams['magento-init-params'];
+ . ' -vvv --magento-init-params="' . $initParams['magento-init-params'] . '"';
return $this->shell->execute($disableModuleCommand);
}
@@ -113,8 +120,8 @@ public function splitQuote()
);
$command = 'php -f ' . BP . '/bin/magento setup:db-schema:split-quote ' .
implode(" ", array_keys($installParams)) .
- ' -vvv --magento-init-params=' .
- $initParams['magento-init-params'];
+ ' -vvv --magento-init-params="' .
+ $initParams['magento-init-params'] . '"';
$this->shell->execute($command, array_values($installParams));
}
@@ -132,8 +139,8 @@ public function splitSales()
);
$command = 'php -f ' . BP . '/bin/magento setup:db-schema:split-sales ' .
implode(" ", array_keys($installParams)) .
- ' -vvv --magento-init-params=' .
- $initParams['magento-init-params'];
+ ' -vvv --magento-init-params="' .
+ $initParams['magento-init-params'] . '"';
$this->shell->execute($command, array_values($installParams));
}
@@ -212,9 +219,25 @@ public function install(array $modules, array $installParams = [])
)
);
// run install script
- return $this->shell->execute(
+ $exitCode = $this->shell->execute(
PHP_BINARY . ' -f %s setup:install -vvv ' . implode(' ', array_keys($installParams)),
array_merge([BP . '/bin/magento'], array_values($installParams))
);
+ $this->afterInstall();
+ return $exitCode;
+ }
+
+ /**
+ * You can decorate this function in order to add your own events here
+ *
+ * @return void
+ */
+ public function afterInstall()
+ {
+ //Take current deployment config in order to flush it cache after installation
+ //Before installation usually we do not have any connections - so we need to add them
+ $this->deploymentConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+ ->get(DeploymentConfig::class);
+ $this->deploymentConfig->resetData();
}
}
diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php
index f0b74670cee2..2bdf85bc9521 100644
--- a/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php
+++ b/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php
@@ -225,4 +225,75 @@ public function testInstallationWithDroppingTables()
$shardData = $this->describeTable->describeShard(Sharding::DEFAULT_CONNECTION);
self::assertEquals($this->getData(), $shardData);
}
+
+ /**
+ * @moduleName Magento_TestSetupDeclarationModule1
+ * @dataProviderFromFile Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php
+ */
+ public function testInstallWithCodeBaseRollback()
+ {
+ //Move db_schema.xml file and tried to install
+ $this->moduleManager->updateRevision(
+ 'Magento_TestSetupDeclarationModule1',
+ 'before_rollback',
+ 'db_schema.xml',
+ 'etc'
+ );
+ $this->cliCommad->install(
+ ['Magento_TestSetupDeclarationModule1']
+ );
+ $beforeRollback = $this->describeTable->describeShard('default');
+ self::assertEquals($this->getData()['before'], $beforeRollback);
+ //Move db_schema.xml file and tried to install
+ $this->moduleManager->updateRevision(
+ 'Magento_TestSetupDeclarationModule1',
+ 'after_rollback',
+ 'db_schema.xml',
+ 'etc'
+ );
+
+ $this->cliCommad->upgrade();
+ $afterRollback = $this->describeTable->describeShard('default');
+ self::assertEquals($this->getData()['after'], $afterRollback);
+ }
+
+ /**
+ * @moduleName Magento_TestSetupDeclarationModule1
+ * @dataProviderFromFile Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_rename.php
+ */
+ public function testTableRename()
+ {
+ $dataToMigrate = ['some_column' => 'Some Value'];
+ //Move db_schema.xml file and tried to install
+ $this->moduleManager->updateRevision(
+ 'Magento_TestSetupDeclarationModule1',
+ 'table_rename',
+ 'db_schema.xml',
+ 'etc'
+ );
+ $this->cliCommad->install(
+ ['Magento_TestSetupDeclarationModule1']
+ );
+ $before = $this->describeTable->describeShard('default');
+ $adapter = $this->resourceConnection->getConnection('default');
+ $adapter->insert(
+ $this->resourceConnection->getTableName('some_table'),
+ $dataToMigrate
+ );
+ self::assertEquals($this->getData()['before'], $before['some_table']);
+ //Move db_schema.xml file and tried to install
+ $this->moduleManager->updateRevision(
+ 'Magento_TestSetupDeclarationModule1',
+ 'table_rename_after',
+ 'db_schema.xml',
+ 'etc'
+ );
+
+ $this->cliCommad->upgrade();
+ $after = $this->describeTable->describeShard('default');
+ self::assertEquals($this->getData()['after'], $after['some_table_renamed']);
+ $select = $adapter->select()
+ ->from($this->resourceConnection->getTableName('some_table_renamed'));
+ self::assertEquals([$dataToMigrate], $adapter->fetchAll($select));
+ }
}
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php
index 241f2e64955b..37ae345d8a6d 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/RestrictedCodeTest.php
@@ -60,7 +60,7 @@ protected static function _loadData(array &$data, $filePattern)
$relativePath = str_replace(
'\\',
'/',
- str_replace(BP, '', $file)
+ str_replace(BP . DIRECTORY_SEPARATOR, '', $file)
);
array_push(self::$_fixtureFiles, $relativePath);
$data = array_merge_recursive($data, self::_readList($file));
@@ -88,8 +88,8 @@ public function testPhpFiles()
$invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
$testFiles = \Magento\TestFramework\Utility\ChangedFiles::getPhpFiles(__DIR__ . '/../_files/changed_files*');
foreach (self::$_fixtureFiles as $fixtureFile) {
- if (array_key_exists(BP . $fixtureFile, $testFiles)) {
- unset($testFiles[BP . $fixtureFile]);
+ if (array_key_exists($fixtureFile, $testFiles)) {
+ unset($testFiles[$fixtureFile]);
}
}
$invoker(
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/restricted_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/restricted_classes.php
index a8127cb3f967..745176433af8 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/restricted_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/restricted_classes.php
@@ -178,6 +178,11 @@
'name' => 'Magento_CatalogSearch',
'path' => 'Test/Unit/Model/Indexer/FulltextTest.php'
],
+ [
+ 'type' => 'module',
+ 'name' => 'Magento_Catalog',
+ 'path' => 'Test/Unit/Model/ProductTest.php'
+ ],
[
'type' => 'module',
'name' => 'Magento_CatalogSearch',
diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
index d9c94607c9df..e02c48222ebd 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
@@ -429,6 +429,22 @@ protected function _connect()
}
}
+ /**
+ * Create new database connection
+ *
+ * @return \PDO
+ */
+ private function createConnection()
+ {
+ $connection = new \PDO(
+ $this->_dsn(),
+ $this->_config['username'],
+ $this->_config['password'],
+ $this->_config['driver_options']
+ );
+ return $connection;
+ }
+
/**
* Run RAW Query
*
@@ -2107,7 +2123,12 @@ public function createTable(Table $table)
implode(",\n", $sqlFragment),
implode(" ", $tableOptions)
);
- $result = $this->query($sql);
+
+ if ($this->getTransactionLevel() > 0) {
+ $result = $this->createConnection()->query($sql);
+ } else {
+ $result = $this->query($sql);
+ }
$this->resetDdlCache($table->getName(), $table->getSchema());
return $result;
@@ -2532,7 +2553,11 @@ public function dropTable($tableName, $schemaName = null)
{
$table = $this->quoteIdentifier($this->_getTableName($tableName, $schemaName));
$query = 'DROP TABLE IF EXISTS ' . $table;
- $this->query($query);
+ if ($this->getTransactionLevel() > 0) {
+ $this->createConnection()->query($query);
+ } else {
+ $this->query($query);
+ }
$this->resetDdlCache($tableName, $schemaName);
$this->getSchemaListener()->dropTable($tableName);
return true;
@@ -2609,8 +2634,12 @@ public function renameTable($oldTableName, $newTableName, $schemaName = null)
$newTable = $this->_getTableName($newTableName, $schemaName);
$query = sprintf('ALTER TABLE %s RENAME TO %s', $oldTable, $newTable);
- $this->query($query);
+ if ($this->getTransactionLevel() > 0) {
+ $this->createConnection()->query($query);
+ } else {
+ $this->query($query);
+ }
$this->resetDdlCache($oldTableName, $schemaName);
return true;
diff --git a/lib/internal/Magento/Framework/Image/AdapterFactory.php b/lib/internal/Magento/Framework/Image/AdapterFactory.php
index ddb1f743d506..8cb7b65ae73c 100644
--- a/lib/internal/Magento/Framework/Image/AdapterFactory.php
+++ b/lib/internal/Magento/Framework/Image/AdapterFactory.php
@@ -34,7 +34,7 @@ public function __construct(
) {
$this->objectManager = $objectManager;
$this->config = $config;
- $this->adapterMap = array_merge($config->getAdapters(), $adapterMap);
+ $this->adapterMap = $adapterMap;
}
/**
@@ -46,6 +46,7 @@ public function __construct(
*/
public function create($adapterAlias = null)
{
+ $this->adapterMap = array_merge($this->config->getAdapters(), $this->adapterMap);
$adapterAlias = !empty($adapterAlias) ? $adapterAlias : $this->config->getAdapterAlias();
if (empty($adapterAlias)) {
throw new \InvalidArgumentException('Image adapter is not selected.');
diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt
index 86e3a95f48a6..71ea5b0475cf 100644
--- a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt
+++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt
@@ -12,6 +12,32 @@ class Interceptor extends \Magento\Framework\Interception\Code\Generator\TSample
$this->___init();
}
+ /**
+ * {@inheritdoc}
+ */
+ public function returnVoid() : void
+ {
+ $pluginInfo = $this->pluginList->getNext($this->subjectType, 'returnVoid');
+ if (!$pluginInfo) {
+ parent::returnVoid();
+ } else {
+ $this->___callPlugins('returnVoid', func_get_args(), $pluginInfo);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getNullableValue() : ?string
+ {
+ $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getNullableValue');
+ if (!$pluginInfo) {
+ return parent::getNullableValue();
+ } else {
+ return $this->___callPlugins('getNullableValue', func_get_args(), $pluginInfo);
+ }
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php
index df8e8570fdfb..b4cc37700f1d 100644
--- a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php
+++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php
@@ -10,6 +10,16 @@ class TSample
private $value;
private $variadicValue;
+ public function returnVoid() : void
+ {
+ // Nothing to do here
+ }
+
+ public function getNullableValue() : ?string
+ {
+ return null;
+ }
+
public function getValue() : string
{
return $this->value;
diff --git a/lib/internal/Magento/Framework/Module/DbVersionInfo.php b/lib/internal/Magento/Framework/Module/DbVersionInfo.php
index fdc74e412ab9..8333c7bb595b 100644
--- a/lib/internal/Magento/Framework/Module/DbVersionInfo.php
+++ b/lib/internal/Magento/Framework/Module/DbVersionInfo.php
@@ -30,6 +30,11 @@ class DbVersionInfo
*/
private $moduleResource;
+ /**
+ * @var array
+ */
+ private $dbVersionErrorsCache = null;
+
/**
* @param ModuleListInterface $moduleList
* @param ResourceInterface $moduleResource
@@ -92,16 +97,19 @@ private function getSchemaInfo($moduleName)
*/
public function getDbVersionErrors()
{
- $errors = [];
- foreach ($this->moduleList->getNames() as $moduleName) {
- if (!$this->isSchemaUpToDate($moduleName)) {
- $errors[] = $this->getSchemaInfo($moduleName);
- }
- if (!$this->isDataUpToDate($moduleName)) {
- $errors[] = $this->getDataInfo($moduleName);
+ if ($this->dbVersionErrorsCache === null) {
+ $this->dbVersionErrorsCache = [];
+ foreach ($this->moduleList->getNames() as $moduleName) {
+ if (!$this->isSchemaUpToDate($moduleName)) {
+ $this->dbVersionErrorsCache[] = $this->getSchemaInfo($moduleName);
+ }
+ if (!$this->isDataUpToDate($moduleName)) {
+ $this->dbVersionErrorsCache[] = $this->getDataInfo($moduleName);
+ }
}
}
- return $errors;
+
+ return $this->dbVersionErrorsCache;
}
/**
diff --git a/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php b/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php
index fe8fcbb6f430..8c49385f7e60 100644
--- a/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php
+++ b/lib/internal/Magento/Framework/Pricing/Price/AbstractPrice.php
@@ -30,7 +30,7 @@ abstract class AbstractPrice implements PriceInterface
protected $amount;
/**
- * @var \Magento\Framework\Pricing\Adjustment\Calculator
+ * @var \Magento\Framework\Pricing\Adjustment\CalculatorInterface
*/
protected $calculator;
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/DataSavior/SelectGenerator.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/DataSavior/SelectGenerator.php
index 9e560acf1f62..08da74fb6a2b 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/DataSavior/SelectGenerator.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/DataSavior/SelectGenerator.php
@@ -17,7 +17,7 @@ class SelectGenerator
/**
* @var int
*/
- private $batchSize = 12000;
+ private $batchSize = 30000;
/**
* @var int
@@ -36,7 +36,7 @@ class SelectGenerator
*/
public function __construct(
ResourceConnection $resourceConnection,
- $baseBatchSize = 15000
+ $baseBatchSize = 30000
) {
$this->baseBatchSize = $baseBatchSize;
$this->resourceConnection = $resourceConnection;
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DDLTriggerInterface.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DDLTriggerInterface.php
index fa074d4ba16d..8d5e03000316 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DDLTriggerInterface.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DDLTriggerInterface.php
@@ -4,9 +4,11 @@
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Framework\Setup\Declaration\Schema\Db;
-use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface;
+use Magento\Framework\Setup\Declaration\Schema\ElementHistory;
/**
* DDL triggers is events that can be fired:
@@ -16,6 +18,13 @@
*
* Trigger is used to make changes in data not in schema, e.g migrate data from column of one table to
* column of another table.
+ *
+ * Please note: triggers are used to serve needs of some operations, that can`t be described with declarative schema,
+ * for example: renaming. Renaming implemented with removal column with old name and creating with new one.
+ * Question with data is solved with help of triggers, that allows to migrate data.
+ * This approach is correct from prospective of declaration but is not so fast as ALTER TABLE is.
+ * So if you need to perform some renaming operations quickly, please use raw SQL dump instead, that can be taken with
+ * help of --dry-run mode
*/
interface DDLTriggerInterface
{
@@ -25,13 +34,13 @@ interface DDLTriggerInterface
* @param string $statement
* @return bool
*/
- public function isApplicable($statement);
+ public function isApplicable(string $statement) : bool ;
/**
* Setup callback to current statement, can generate new statements.
*
- * @param ElementInterface $element
+ * @param ElementHistory $elementHistory
* @return callable
*/
- public function getCallback(ElementInterface $element);
+ public function getCallback(ElementHistory $elementHistory) : Callable;
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataBetweenShards.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataBetweenShards.php
new file mode 100644
index 000000000000..ad69ff92c8a5
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataBetweenShards.php
@@ -0,0 +1,86 @@
+resourceConnection = $resourceConnection;
+ $this->selectGenerator = $selectGenerator;
+ }
+
+ /**
+ * If skip migration flag is enabled, we should skip data migration
+ *
+ * @inheritdoc
+ */
+ public function isApplicable(string $statement) : bool
+ {
+ return $statement !== self::SKIP_MIGRATION_DATA_FLAG;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCallback(ElementHistory $elementHistory) : Callable
+ {
+ /** @var Table $newTable */
+ $newTable = $elementHistory->getNew();
+ /** @var Table $oldTable */
+ $oldTable = $elementHistory->getOld();
+ $that = $this;
+
+ return function () use ($newTable, $oldTable, $that) {
+ $firstConnection = $that->resourceConnection->getConnection($oldTable->getResource());
+ $secondConnection = $that->resourceConnection->getConnection($newTable->getResource());
+ $select = $firstConnection->select()->from($oldTable->getName());
+
+ foreach ($this->selectGenerator->generator($select, $oldTable->getResource()) as $data) {
+ if (count($data)) {
+ $columns = array_keys($data[0]);
+ $secondConnection->insertArray($newTable->getName(), $columns, $data);
+ }
+ }
+ };
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataFrom.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataFrom.php
index b2cc0f4d9137..5ad5c2cd6a20 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataFrom.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataFrom.php
@@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
namespace Magento\Framework\Setup\Declaration\Schema\Db\MySQL\DDL\Triggers;
@@ -10,7 +11,7 @@
use Magento\Framework\DB\Sql\Expression;
use Magento\Framework\Setup\Declaration\Schema\Db\DDLTriggerInterface;
use Magento\Framework\Setup\Declaration\Schema\Dto\Column;
-use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface;
+use Magento\Framework\Setup\Declaration\Schema\ElementHistory;
/**
* Used to migrate data from one column to another in scope of one table.
@@ -41,17 +42,18 @@ public function __construct(ResourceConnection $resourceConnection)
/**
* @inheritdoc
*/
- public function isApplicable($statement)
+ public function isApplicable(string $statement) : bool
{
- return preg_match(self::MATCH_PATTERN, $statement);
+ return (bool) preg_match(self::MATCH_PATTERN, $statement);
}
/**
- * @param Column $column
* @inheritdoc
*/
- public function getCallback(ElementInterface $column)
+ public function getCallback(ElementHistory $columnHistory) : Callable
{
+ /** @var Column $column */
+ $column = $columnHistory->getNew();
preg_match(self::MATCH_PATTERN, $column->getOnCreate(), $matches);
return function () use ($column, $matches) {
$tableName = $column->getTable()->getName();
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataFromAnotherTable.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataFromAnotherTable.php
new file mode 100644
index 000000000000..6c426723ab37
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DDL/Triggers/MigrateDataFromAnotherTable.php
@@ -0,0 +1,65 @@
+resourceConnection = $resourceConnection;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isApplicable(string $statement) : bool
+ {
+ return (bool) preg_match(self::MATCH_PATTERN, $statement);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCallback(ElementHistory $tableHistory) : Callable
+ {
+ /** @var Table $table */
+ $table = $tableHistory->getNew();
+ preg_match(self::MATCH_PATTERN, $table->getOnCreate(), $matches);
+ return function () use ($table, $matches) {
+ $tableName = $table->getName();
+ $oldTableName = $this->resourceConnection->getTableName($matches[1]);
+ $adapter = $this->resourceConnection->getConnection($table->getResource());
+ $select = $adapter->select()->from($oldTableName);
+ $adapter->query($adapter->insertFromSelect($select, $tableName));
+ };
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php
index fed4aa32d9e5..1a57911d8ace 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php
@@ -17,6 +17,11 @@
*/
class DbSchemaReader implements DbSchemaReaderInterface
{
+ /**
+ * Table type in information_schema.TABLES which allows to identify only tables and ignore views
+ */
+ const MYSQL_TABLE_TYPE = 'BASE TABLE';
+
/**
* @var ResourceConnection
*/
@@ -46,9 +51,28 @@ public function __construct(
*/
public function getTableOptions($tableName, $resource)
{
- $sql = sprintf('SHOW TABLE STATUS WHERE `Name` = "%s"', $tableName);
$adapter = $this->resourceConnection->getConnection($resource);
- return $adapter->fetchRow($sql);
+ $dbName = $this->resourceConnection->getSchemaName($resource);
+ $stmt = $adapter->select()
+ ->from(
+ ['i_tables' => 'information_schema.TABLES'],
+ [
+ 'engine' => 'ENGINE',
+ 'comment' => 'TABLE_COMMENT',
+ 'collation' => 'TABLE_COLLATION'
+ ]
+ )
+ ->joinInner(
+ ['charset_applicability' => 'information_schema.COLLATION_CHARACTER_SET_APPLICABILITY'],
+ 'i_tables.table_collation = charset_applicability.collation_name',
+ [
+ 'charset' => 'charset_applicability.CHARACTER_SET_NAME'
+ ]
+ )
+ ->where('TABLE_SCHEMA = ?', $dbName)
+ ->where('TABLE_NAME = ?', $tableName);
+
+ return $adapter->fetchRow($stmt);
}
/**
@@ -190,8 +214,15 @@ public function readConstraints($tableName, $resource)
*/
public function readTables($resource)
{
- return $this->resourceConnection
- ->getConnection($resource)
- ->getTables();
+ $adapter = $this->resourceConnection->getConnection($resource);
+ $dbName = $this->resourceConnection->getSchemaName($resource);
+ $stmt = $adapter->select()
+ ->from(
+ ['information_schema.TABLES'],
+ ['TABLE_NAME']
+ )
+ ->where('TABLE_SCHEMA = ?', $dbName)
+ ->where('TABLE_TYPE = ?', self::MYSQL_TABLE_TYPE);
+ return $adapter->fetchCol($stmt);
}
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php
index ab3d0c7fb0be..65998e754111 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php
@@ -32,6 +32,18 @@ class DbSchemaWriter implements DbSchemaWriterInterface
self::DROP_TYPE => 'DROP TABLE %s'
];
+ /**
+ * Table options mapping
+ *
+ * @var array
+ */
+ private $tableOptions = [
+ 'charset' => 'DEFAULT CHARSET',
+ 'collation' => 'DEFAULT COLLATE',
+ 'engine' => 'ENGINE',
+ 'comment' => 'COMMENT'
+ ];
+
/**
* @var ResourceConnection
*/
@@ -48,20 +60,21 @@ class DbSchemaWriter implements DbSchemaWriterInterface
private $dryRunLogger;
/**
- * Constructor.
- *
* @param ResourceConnection $resourceConnection
* @param StatementFactory $statementFactory
* @param DryRunLogger $dryRunLogger
+ * @param array $tableOptions
*/
public function __construct(
ResourceConnection $resourceConnection,
StatementFactory $statementFactory,
- DryRunLogger $dryRunLogger
+ DryRunLogger $dryRunLogger,
+ array $tableOptions = []
) {
$this->resourceConnection = $resourceConnection;
$this->statementFactory = $statementFactory;
$this->dryRunLogger = $dryRunLogger;
+ $this->tableOptions = array_replace($this->tableOptions, $tableOptions);
}
/**
@@ -70,9 +83,11 @@ public function __construct(
public function createTable($tableName, $resource, array $definition, array $options)
{
$sql = sprintf(
- "(\n%s\n) ENGINE=%s %s",
+ "(\n%s\n) ENGINE=%s DEFAULT CHARSET=%s DEFAULT COLLATE=%s %s",
implode(", \n", $definition),
$options['engine'],
+ $options['charset'],
+ $options['collation'],
isset($options['comment']) ? sprintf('COMMENT="%s"', $options['comment']) : ''
);
@@ -157,7 +172,7 @@ public function modifyTableOption($tableName, $resource, $optionName, $optionVal
$tableName,
$tableName,
self::ALTER_TYPE,
- sprintf("%s='%s'", strtoupper($optionName), $optionValue),
+ sprintf("%s='%s'", $this->tableOptions[$optionName], $optionValue),
$resource
);
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Constraints/ForeignKey.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Constraints/ForeignKey.php
index b2c520de4e78..1a9b42355f5e 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Constraints/ForeignKey.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Constraints/ForeignKey.php
@@ -7,6 +7,7 @@
namespace Magento\Framework\Setup\Declaration\Schema\Db\MySQL\Definition\Constraints;
use Magento\Framework\App\ResourceConnection;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Setup\Declaration\Schema\Db\DbDefinitionProcessorInterface;
use Magento\Framework\Setup\Declaration\Schema\Dto\Constraints\Reference;
use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface;
@@ -72,6 +73,12 @@ public function toDefinition(ElementInterface $foreignKey)
*/
public function fromDefinition(array $data)
{
+ if (!isset($data['Create Table'])) {
+ throw new LocalizedException(
+ new \Magento\Framework\Phrase('Can`t read foreign keys from current database')
+ );
+ }
+
$createMySQL = $data['Create Table'];
$ddl = [];
$regExp = '#,\s*CONSTRAINT\s*`([^`]*)`\s*FOREIGN KEY\s*?\(`([^`]*)`\)\s*'
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php
index 2b9e593975d6..f7a2a0d91396 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php
@@ -42,6 +42,11 @@ class SchemaBuilder
*/
private $sharding;
+ /**
+ * @var array
+ */
+ private $tables;
+
/**
* Constructor.
*
@@ -64,8 +69,6 @@ public function __construct(
*/
public function build(Schema $schema)
{
- $tables = [];
-
foreach ($this->sharding->getResources() as $resource) {
foreach ($this->dbSchemaReader->readTables($resource) as $tableName) {
$columns = [];
@@ -85,8 +88,10 @@ public function build(Schema $schema)
[
'name' => $tableName,
'resource' => $resource,
- 'engine' => strtolower($tableOptions['Engine']),
- 'comment' => $tableOptions['Comment'] === '' ? null : $tableOptions['Comment']
+ 'engine' => strtolower($tableOptions['engine']),
+ 'comment' => $tableOptions['comment'] === '' ? null : $tableOptions['comment'],
+ 'charset' => $tableOptions['charset'],
+ 'collation' => $tableOptions['collation']
]
);
@@ -115,12 +120,11 @@ public function build(Schema $schema)
$table->addIndexes($indexes);
$table->addConstraints($constraints);
- $tables[$table->getName()] = $table;
- $schema->addTable($table);
+ $this->tables[$table->getName()] = $table;
}
}
- $this->processReferenceKeys($tables);
+ $this->processReferenceKeys($this->tables, $schema);
return $schema;
}
@@ -128,31 +132,39 @@ public function build(Schema $schema)
* Process references for all tables. Schema validation required.
*
* @param Table[] $tables
- * @return Table[]
+ * @param Schema $schema
*/
- private function processReferenceKeys(array $tables)
+ private function processReferenceKeys(array $tables, Schema $schema)
{
foreach ($tables as $table) {
$tableName = $table->getName();
+ if ($schema->getTableByName($tableName) instanceof Table) {
+ continue;
+ }
$referencesData = $this->dbSchemaReader->readReferences($tableName, $table->getResource());
$references = [];
foreach ($referencesData as $referenceData) {
//Prepare reference data
- $referenceData['table'] = $tables[$tableName];
- $referenceData['column'] = $tables[$tableName]->getColumnByName($referenceData['column']);
- $referenceData['referenceTable'] = $tables[$referenceData['referenceTable']];
+ $referenceData['table'] = $table;
+ $referenceTableName = $referenceData['referenceTable'];
+ $referenceData['column'] = $table->getColumnByName($referenceData['column']);
+ $referenceData['referenceTable'] = $this->tables[$referenceTableName];
$referenceData['referenceColumn'] = $referenceData['referenceTable']->getColumnByName(
$referenceData['referenceColumn']
);
$references[$referenceData['name']] = $this->elementFactory->create('foreign', $referenceData);
+ //We need to instantiate tables in order of references tree
+ if (isset($tables[$referenceTableName]) && $referenceTableName !== $tableName) {
+ $this->processReferenceKeys([$referenceTableName => $tables[$referenceTableName]], $schema);
+ unset($tables[$referenceTableName]);
+ }
}
- $tables[$tableName]->addConstraints($references);
+ $table->addConstraints($references);
+ $schema->addTable($table);
}
-
- return $tables;
}
/**
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php
index 63d42e182e7e..7f73e742e0a6 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php
@@ -223,14 +223,10 @@ private function processTable(Schema $schema, array $tableData)
{
if (!$schema->getTableByName($tableData['name'])) {
$resource = $this->getStructuralElementResource($tableData);
- $tableParams = [
- 'name' => $tableData['name'],
- 'resource' => $resource,
- 'engine' => $tableData['engine'] ?? null,
- 'comment' => $tableData['comment'] ?? null
- ];
+ $tableData['resource'] = $resource;
+ $tableData['comment'] = $tableData['comment'] ?? null;
/** @var Table $table */
- $table = $this->elementFactory->create('table', $tableParams);
+ $table = $this->elementFactory->create('table', $tableData);
$columns = $this->processColumns($tableData, $resource, $table);
$table->addColumns($columns);
//Add indexes to table
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/Diff.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/Diff.php
index 70711d4900af..cb222d8b0c3d 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/Diff.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/Diff.php
@@ -7,17 +7,20 @@
namespace Magento\Framework\Setup\Declaration\Schema\Diff;
use Magento\Framework\Component\ComponentRegistrar;
+use Magento\Framework\Setup\Declaration\Schema\Dto\Constraints\Reference;
use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface;
use Magento\Framework\Setup\Declaration\Schema\Dto\Table;
use Magento\Framework\Setup\Declaration\Schema\Dto\TableElementInterface;
use Magento\Framework\Setup\Declaration\Schema\ElementHistory;
use Magento\Framework\Setup\Declaration\Schema\ElementHistoryFactory;
+use Magento\Framework\Setup\Declaration\Schema\Operations\DropReference;
/**
* Holds information about all changes between 2 schemas: db and declaration XML.
* Holds 2 items:
* - new (Should be changed to)
* - old ()
+ * @api
*/
class Diff implements DiffInterface
{
@@ -147,13 +150,15 @@ private function getWhiteListTables()
* Check whether element can be registered.
*
* For example, if element is not in db_schema_whitelist.json it cant
- * be registered due to backward incompatibility.
+ * be registered due to backward incompatibility
+ * Extensibility point: if you want to add some dynamic rules of applying or ignoring any schema elements
+ * you can do this by pluginizing this method
*
* @param ElementInterface | Table $object
* @param string $operation
* @return bool
*/
- private function canBeRegistered(ElementInterface $object, $operation)
+ public function canBeRegistered(ElementInterface $object, $operation)
{
if (!isset($this->destructiveOperations[$operation])) {
return true;
@@ -178,8 +183,7 @@ private function canBeRegistered(ElementInterface $object, $operation)
public function register(
ElementInterface $dtoObject,
$operation,
- ElementInterface $oldDtoObject = null,
- $tableKey = null
+ ElementInterface $oldDtoObject = null
) {
if (!$this->canBeRegistered($dtoObject, $operation)) {
return $this;
@@ -187,13 +191,28 @@ public function register(
$historyData = ['new' => $dtoObject, 'old' => $oldDtoObject];
$history = $this->elementHistoryFactory->create($historyData);
- $dtoObjectName = $dtoObject instanceof TableElementInterface ?
- $dtoObject->getTable()->getName() : $dtoObject->getName();
- //We use not real tables but table indexes in order to be sure that order of table is correct
- $tableKey = $tableKey === null ? $this->tableIndexes[$dtoObjectName] : $this->tableIndexes[$tableKey];
//dtoObjects can have 4 types: column, constraint, index, table
- $this->changes[$tableKey][$operation][] = $history;
+ $this->changes[$this->findTableIndex($dtoObject, $operation)][$operation][] = $history;
$this->debugChanges[$operation][] = $history;
return $this;
}
+
+ /**
+ * As tables can references to each other, we need to take into account
+ * that they should goes in specific structure: parent table -> child table
+ * Also we should take into account, that first of all in any case we need to remove all foreign keys
+ * from tables and only then modify that tables
+ *
+ * @param ElementInterface $element
+ * @param string $operation
+ * @return int
+ */
+ private function findTableIndex(ElementInterface $element, string $operation) : int
+ {
+ $elementName = $element instanceof TableElementInterface ?
+ $element->getTable()->getName() : $element->getName();
+ //We use not real tables but table indexes in order to be sure that order of table is correct
+ $tableIndex = $this->tableIndexes[$elementName] ?? INF;
+ return $operation === DropReference::OPERATION_NAME ? 0 : (int) $tableIndex;
+ }
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/DiffManager.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/DiffManager.php
index 9a268d0eaa9d..af1a35542603 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/DiffManager.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/DiffManager.php
@@ -104,12 +104,12 @@ public function registerRemoval(
) {
foreach ($generatedElements as $generatedElement) {
if ($generatedElement instanceof Reference) {
- $this->registerReferenceDrop($generatedElement, $diff);
- continue;
+ $diff->register($generatedElement, DropReference::OPERATION_NAME, $generatedElement);
+ } elseif ($generatedElement instanceof Table) {
+ $diff->register($generatedElement, DropTable::OPERATION_NAME, $generatedElement);
+ } else {
+ $diff->register($generatedElement, DropElement::OPERATION_NAME, $generatedElement);
}
-
- $operation = $generatedElement instanceof Table ? DropTable::OPERATION_NAME : DropElement::OPERATION_NAME;
- $diff->register($generatedElement, $operation, $generatedElement);
}
return $diff;
@@ -138,52 +138,40 @@ public function registerCreation(DiffInterface $diff, ElementInterface $element)
}
/**
- * We need to register drop of foreign key in scope of reference table.
+ * Depends on what should be changed we can re-create table or modify it.
*
- * This done because reference table is goes first and starting from this table
- * there should be no foreign key on modified column.
+ * For example, we can modify table if we need to change comment or engine.
+ * Or we can re-create table, when we need to change it shard.
*
- * @param Reference $reference
+ * @param Table $declaredTable
+ * @param Table $generatedTable
* @param Diff $diff
- * @return Diff
+ * @return void
*/
- public function registerReferenceDrop(Reference $reference, Diff $diff)
+ public function registerTableModification(Table $declaredTable, Table $generatedTable, Diff $diff)
{
$diff->register(
- $reference,
- DropReference::OPERATION_NAME,
- $reference,
- $reference->getReferenceTable()->getName()
+ $declaredTable,
+ ModifyTable::OPERATION_NAME,
+ $generatedTable
);
- return $diff;
}
/**
- * Depends on what should be changed we can re-create table or modify it.
- *
- * For example, we can modify table if we need to change comment or engine.
- * Or we can re-create table, when we need to change it shard.
+ * Register recreation of table, in case for example, when we need to move table from one shard to another
*
* @param Table $declaredTable
* @param Table $generatedTable
* @param Diff $diff
* @return void
*/
- public function registerTableModification(Table $declaredTable, Table $generatedTable, Diff $diff)
+ public function registerRecreation(Table $declaredTable, Table $generatedTable, Diff $diff)
{
- if ($declaredTable->getResource() !== $generatedTable->getResource()) {
- $diff->register(
- $declaredTable,
- ReCreateTable::OPERATION_NAME,
- $generatedTable
- );
- } else {
- $diff->register(
- $declaredTable,
- ModifyTable::OPERATION_NAME,
- $generatedTable
- );
- }
+ $diff->register(
+ $declaredTable,
+ ReCreateTable::OPERATION_NAME,
+ $generatedTable
+ );
}
/**
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/TableDiff.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/TableDiff.php
index 73a1d86f262a..2030b192935e 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/TableDiff.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Diff/TableDiff.php
@@ -126,6 +126,11 @@ public function diff(
ElementInterface $generatedTable,
Diff $diff
) {
+ if ($declaredTable->getResource() !== $generatedTable->getResource()) {
+ $this->diffManager->registerRecreation($declaredTable, $generatedTable, $diff);
+ return $diff;
+ }
+
if ($this->diffManager->shouldBeModified($declaredTable, $generatedTable)) {
$this->diffManager->registerTableModification($declaredTable, $generatedTable, $diff);
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/ElementInterface.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/ElementInterface.php
index 1471dba2dfb8..43c4c5d9d516 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/ElementInterface.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/ElementInterface.php
@@ -10,6 +10,7 @@
*
* Is parent interface for all various schema structural elements:
* table, column, constraint, index.
+ * @api
*/
interface ElementInterface
{
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Table.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Table.php
index 807b5b83db12..7c552acda515 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Table.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Table.php
@@ -20,6 +20,16 @@ class Table implements FactoryInterface
*/
const DEFAULT_ENGINE = 'innodb';
+ /**
+ * Default charset for SQL
+ */
+ const DEFAULT_CHARSET = 'utf8';
+
+ /**
+ * Default collation
+ */
+ const DEFAULT_COLLATION = 'utf8_general_ci';
+
/**
* @var ObjectManagerInterface
*/
@@ -57,9 +67,22 @@ public function __construct(
*/
public function create(array $data)
{
- if ($data['engine'] === null) {
+ if (!isset($data['engine'])) {
$data['engine'] = self::DEFAULT_ENGINE;
}
+ //Prepare charset
+ if (!isset($data['charset'])) {
+ $data['charset'] = self::DEFAULT_CHARSET;
+ }
+ //Prepare collation
+ if (!isset($data['collation'])) {
+ $data['collation'] = self::DEFAULT_COLLATION;
+ }
+ //Prepare triggers
+ if (!isset($data['onCreate'])) {
+ $data['onCreate'] = '';
+ }
+
$tablePrefix = $this->resourceConnection->getTablePrefix();
$nameWithoutPrefix = $data['name'];
if (!empty($tablePrefix) && strpos($nameWithoutPrefix, $tablePrefix) === 0) {
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php
index 76b87ea8fc88..4f020b1a0320 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php
@@ -64,17 +64,35 @@ class Table extends GenericElement implements
*/
private $comment;
+ /**
+ * @var string
+ */
+ private $onCreate;
+
+ /**
+ * @var string
+ */
+ private $charset;
+
+ /**
+ * @var string
+ */
+ private $collation;
+
/**
* @param string $name
- * @param string $nameWithoutPrefix
* @param string $type
+ * @param string $nameWithoutPrefix
* @param string $resource
* @param string $engine
+ * @param string $charset
+ * @param string $collation
* @param string|null $comment
* @param array $columns
* @param array $indexes
* @param array $constraints
- * @internal param string $nameWithPrefix
+ * @param string $onCreate
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
string $name,
@@ -82,6 +100,9 @@ public function __construct(
string $nameWithoutPrefix,
string $resource,
string $engine,
+ string $charset,
+ string $collation,
+ string $onCreate,
string $comment = null,
array $columns = [],
array $indexes = [],
@@ -95,6 +116,9 @@ public function __construct(
$this->engine = $engine;
$this->nameWithoutPrefix = $nameWithoutPrefix;
$this->comment = $comment;
+ $this->onCreate = $onCreate;
+ $this->charset = $charset;
+ $this->collation = $collation;
}
/**
@@ -149,6 +173,23 @@ public function getPrimaryConstraint()
false;
}
+ /**
+ * Retrieve internal constraints
+ *
+ * @return array
+ */
+ public function getInternalConstraints() : array
+ {
+ $constraints = [];
+ foreach ($this->getConstraints() as $constraint) {
+ if ($constraint instanceof Internal) {
+ $constraints[] = $constraint;
+ }
+ }
+
+ return $constraints;
+ }
+
/**
* @param string $name
* @return Index | bool
@@ -212,6 +253,16 @@ public function addColumns(array $columns)
$this->columns = array_replace($this->columns, $columns);
}
+ /**
+ * Retrieve information about trigger
+ *
+ * @return string
+ */
+ public function getOnCreate()
+ {
+ return $this->onCreate;
+ }
+
/**
* If column exists - retrieve column
*
@@ -278,10 +329,32 @@ public function getDiffSensitiveParams()
return [
'resource' => $this->getResource(),
'engine' => $this->getEngine(),
- 'comment' => $this->getComment()
+ 'comment' => $this->getComment(),
+ 'charset' => $this->getCharset(),
+ 'collation' => $this->getCollation()
];
}
+ /**
+ * Return charset of table
+ *
+ * @return string
+ */
+ public function getCharset() : string
+ {
+ return $this->charset;
+ }
+
+ /**
+ * Return charset of table
+ *
+ * @return string
+ */
+ public function getCollation() : string
+ {
+ return $this->collation;
+ }
+
/**
* @return string
*/
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/OperationInterface.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/OperationInterface.php
index 00490a96047d..5b7c97a4ef8c 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/OperationInterface.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/OperationInterface.php
@@ -6,6 +6,8 @@
namespace Magento\Framework\Setup\Declaration\Schema;
+use Magento\Framework\Setup\Declaration\Schema\Db\Statement;
+
/**
* Schema operation interface.
*/
@@ -34,7 +36,7 @@ public function isOperationDestructive();
* Apply change of any type.
*
* @param ElementHistory $elementHistory
- * @return array
+ * @return Statement[]
*/
public function doOperation(ElementHistory $elementHistory);
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/AddColumn.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/AddColumn.php
index 5810c78a2093..9cda6aa4a884 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/AddColumn.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/AddColumn.php
@@ -148,15 +148,17 @@ private function columnIsAutoIncrement(Column $column)
* Setup triggers if column have onCreate syntax.
*
* @param Statement $statement
- * @param Column $column
+ * @param ElementHistory $elementHistory
* @return array
*/
- private function setupTriggersIfExists(Statement $statement, Column $column)
+ private function setupTriggersIfExists(Statement $statement, ElementHistory $elementHistory)
{
+ /** @var Column $column */
+ $column = $elementHistory->getNew();
//Add triggers to column
foreach ($this->triggers as $ddlTrigger) {
- if ($ddlTrigger->isApplicable($column->getOnCreate())) {
- $statement->addTrigger($ddlTrigger->getCallback($column));
+ if ($ddlTrigger->isApplicable((string) $column->getOnCreate())) {
+ $statement->addTrigger($ddlTrigger->getCallback($elementHistory));
}
}
$statements = [$statement];
@@ -201,7 +203,7 @@ public function doOperation(ElementHistory $elementHistory)
$definition,
Column::TYPE
);
- $statements = $this->setupTriggersIfExists($statement, $element);
+ $statements = $this->setupTriggersIfExists($statement, $elementHistory);
if ($this->columnIsAutoIncrement($element)) {
/** We need to reset auto_increment as new field should goes from 1 */
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/CreateTable.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/CreateTable.php
index 18726001c19f..1550bc09866c 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/CreateTable.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/CreateTable.php
@@ -9,12 +9,14 @@
use Magento\Framework\Setup\Declaration\Schema\Db\DbSchemaWriterInterface;
use Magento\Framework\Setup\Declaration\Schema\Db\DDLTriggerInterface;
use Magento\Framework\Setup\Declaration\Schema\Db\DefinitionAggregator;
+use Magento\Framework\Setup\Declaration\Schema\Db\Statement;
use Magento\Framework\Setup\Declaration\Schema\Dto\Column;
use Magento\Framework\Setup\Declaration\Schema\Dto\Constraint;
use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface;
use Magento\Framework\Setup\Declaration\Schema\Dto\Index;
use Magento\Framework\Setup\Declaration\Schema\Dto\Table;
use Magento\Framework\Setup\Declaration\Schema\ElementHistory;
+use Magento\Framework\Setup\Declaration\Schema\ElementHistoryFactory;
use Magento\Framework\Setup\Declaration\Schema\OperationInterface;
/**
@@ -37,26 +39,40 @@ class CreateTable implements OperationInterface
*/
private $definitionAggregator;
+ /**
+ * @var DDLTriggerInterface[]
+ */
+ private $columnTriggers;
+
/**
* @var DDLTriggerInterface[]
*/
private $triggers;
/**
- * Constructor.
- *
+ * @var ElementHistoryFactory
+ */
+ private $elementHistoryFactory;
+
+ /**
* @param DbSchemaWriterInterface $dbSchemaWriter
* @param DefinitionAggregator $definitionAggregator
+ * @param ElementHistoryFactory $elementHistoryFactory
+ * @param array $columnTriggers
* @param array $triggers
*/
public function __construct(
DbSchemaWriterInterface $dbSchemaWriter,
DefinitionAggregator $definitionAggregator,
+ ElementHistoryFactory $elementHistoryFactory,
+ array $columnTriggers = [],
array $triggers = []
) {
$this->dbSchemaWriter = $dbSchemaWriter;
$this->definitionAggregator = $definitionAggregator;
+ $this->columnTriggers = $columnTriggers;
$this->triggers = $triggers;
+ $this->elementHistoryFactory = $elementHistoryFactory;
}
/**
@@ -75,6 +91,52 @@ public function isOperationDestructive()
return false;
}
+ /**
+ * Setup callbacks for newely created columns
+ *
+ * @param array $columns
+ * @param Statement $createTableStatement
+ * @return void
+ */
+ private function setupColumnTriggers(array $columns, Statement $createTableStatement)
+ {
+ foreach ($columns as $column) {
+ foreach ($this->columnTriggers as $trigger) {
+ if ($trigger->isApplicable((string) $column->getOnCreate())) {
+ $elementHistory = $this->elementHistoryFactory->create([
+ 'new' => $column,
+ 'old' => $column
+ ]);
+ $createTableStatement->addTrigger(
+ $trigger->getCallback($elementHistory)
+ );
+ }
+ }
+ }
+ }
+
+ /**
+ * Setup triggers for entire table
+ *
+ * @param Table $table
+ * @param Statement $createTableStatement
+ * @return void
+ */
+ private function setupTableTriggers(Table $table, Statement $createTableStatement)
+ {
+ foreach ($this->triggers as $trigger) {
+ if ($trigger->isApplicable((string) $table->getOnCreate())) {
+ $elementHistory = $this->elementHistoryFactory->create([
+ 'new' => $table,
+ 'old' => $table
+ ]);
+ $createTableStatement->addTrigger(
+ $trigger->getCallback($elementHistory)
+ );
+ }
+ }
+ }
+
/**
* {@inheritdoc}
*/
@@ -102,21 +164,13 @@ public function doOperation(ElementHistory $elementHistory)
$createTableStatement = $this->dbSchemaWriter
->createTable(
$table->getName(),
- $table->getResource(),
+ $elementHistory->getNew()->getResource(),
$definition,
- ['engine' => $table->getEngine(), 'comment' => $table->getComment()]
+ $table->getDiffSensitiveParams()
);
- //Setup triggers for all column for table.
- foreach ($table->getColumns() as $column) {
- foreach ($this->triggers as $trigger) {
- if ($trigger->isApplicable($column->getOnCreate())) {
- $createTableStatement->addTrigger(
- $trigger->getCallback($column)
- );
- }
- }
- }
+ $this->setupTableTriggers($table, $createTableStatement);
+ $this->setupColumnTriggers($table->getColumns(), $createTableStatement);
return [$createTableStatement];
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ModifyTable.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ModifyTable.php
index d30b3271106f..9b352592f8f9 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ModifyTable.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ModifyTable.php
@@ -31,13 +31,10 @@ class ModifyTable implements OperationInterface
private $dbSchemaWriter;
/**
- * Constructor.
- *
* @param DbSchemaWriterInterface $dbSchemaWriter
*/
- public function __construct(
- DbSchemaWriterInterface $dbSchemaWriter
- ) {
+ public function __construct(DbSchemaWriterInterface $dbSchemaWriter)
+ {
$this->dbSchemaWriter = $dbSchemaWriter;
}
@@ -64,13 +61,22 @@ public function doOperation(ElementHistory $elementHistory)
{
/** @var Table $table */
$table = $elementHistory->getNew();
- return [
- $this->dbSchemaWriter->modifyTableOption(
- $table->getName(),
- $table->getResource(),
- 'comment',
- $table->getComment()
- )
- ];
+ /** @var Table $oldTable */
+ $oldTable = $elementHistory->getOld();
+ $oldOptions = $oldTable->getDiffSensitiveParams();
+ $statements = [];
+
+ foreach ($table->getDiffSensitiveParams() as $optionName => $optionValue) {
+ if ($oldOptions[$optionName] !== $optionValue) {
+ $statements[] = $this->dbSchemaWriter->modifyTableOption(
+ $table->getName(),
+ $table->getResource(),
+ $optionName,
+ $optionValue
+ );
+ }
+ }
+
+ return $statements;
}
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ReCreateTable.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ReCreateTable.php
index a06c7c10325f..d7386c18d125 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ReCreateTable.php
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Operations/ReCreateTable.php
@@ -6,7 +6,12 @@
namespace Magento\Framework\Setup\Declaration\Schema\Operations;
+use Magento\Framework\Setup\Declaration\Schema\Db\MySQL\DDL\Triggers\MigrateDataBetweenShards;
+use Magento\Framework\Setup\Declaration\Schema\Db\Statement;
+use Magento\Framework\Setup\Declaration\Schema\Dto\ElementFactory;
+use Magento\Framework\Setup\Declaration\Schema\Dto\Table;
use Magento\Framework\Setup\Declaration\Schema\ElementHistory;
+use Magento\Framework\Setup\Declaration\Schema\ElementHistoryFactory;
use Magento\Framework\Setup\Declaration\Schema\OperationInterface;
/**
@@ -30,16 +35,42 @@ class ReCreateTable implements OperationInterface
*/
private $dropTable;
+ /**
+ * @var MigrateDataBetweenShards
+ */
+ private $migrateDataBetweenShards;
+
+ /**
+ * @var ElementHistoryFactory
+ */
+ private $elementHistoryFactory;
+
+ /**
+ * @var ElementFactory
+ */
+ private $elementFactory;
+
/**
* Constructor.
*
* @param CreateTable $createTable
* @param DropTable $dropTable
+ * @param MigrateDataBetweenShards $migrateDataBetweenShards
+ * @param ElementHistoryFactory $elementHistoryFactory
+ * @param ElementFactory $elementFactory
*/
- public function __construct(CreateTable $createTable, DropTable $dropTable)
- {
+ public function __construct(
+ CreateTable $createTable,
+ DropTable $dropTable,
+ MigrateDataBetweenShards $migrateDataBetweenShards,
+ ElementHistoryFactory $elementHistoryFactory,
+ ElementFactory $elementFactory
+ ) {
$this->createTable = $createTable;
$this->dropTable = $dropTable;
+ $this->migrateDataBetweenShards = $migrateDataBetweenShards;
+ $this->elementHistoryFactory = $elementHistoryFactory;
+ $this->elementFactory = $elementFactory;
}
/**
@@ -58,12 +89,62 @@ public function getOperationName()
return self::OPERATION_NAME;
}
+ /**
+ * Merge 2 tables: take old data from new table, columns and indexes from old tables:
+ * we need to take in account, that 3-rd party extensions can add columns and indexes and also
+ * internal constraints in old way: with UpgradeSchema/InstallSchema scripts
+ *
+ * @param ElementHistory $elementHistory
+ * @return Table
+ */
+ private function getRecreatedTable(ElementHistory $elementHistory) : Table
+ {
+ /** @var Table $newTable */
+ $newTable = $elementHistory->getNew();
+ /** @var Table $oldTable */
+ $oldTable = $elementHistory->getOld();
+ /** @var Table $recreationTable */
+ $recreationTable = $this->elementFactory->create(
+ 'table',
+ [
+ 'name' => $newTable->getName(),
+ 'type' => 'table',
+ 'nameWithoutPrefix' => $newTable->getNameWithoutPrefix(),
+ 'resource' => $newTable->getResource(),
+ 'engine' => $newTable->getEngine(),
+ 'charset' => $newTable->getCharset(),
+ 'collation' => $newTable->getCollation(),
+ 'onCreate' => $newTable->getOnCreate(),
+ 'comment' => $newTable->getOnCreate(),
+ 'columns' => $oldTable->getColumns(),
+ 'indexes' => $oldTable->getIndexes(),
+ 'constraints' => array_merge($oldTable->getInternalConstraints(), $newTable->getReferenceConstraints())
+ ]
+ );
+
+ return $recreationTable;
+ }
+
/**
* {@inheritdoc}
*/
public function doOperation(ElementHistory $elementHistory)
{
- $statement = $this->dropTable->doOperation($elementHistory);
- return array_merge($statement, $this->createTable->doOperation($elementHistory));
+ $recreatedTable = $this->getRecreatedTable($elementHistory);
+ $recreatedElementHistory = $this->elementHistoryFactory->create(
+ [
+ 'old' => $elementHistory->getOld(),
+ 'new' => $recreatedTable
+ ]
+ );
+ $statements = $this->createTable->doOperation($recreatedElementHistory);
+ /** @var Statement $statement */
+ foreach ($statements as $statement) {
+ if ($this->migrateDataBetweenShards->isApplicable((string) $recreatedTable->getOnCreate())) {
+ $statement->addTrigger($this->migrateDataBetweenShards->getCallback($recreatedElementHistory));
+ }
+ }
+
+ return array_merge($statements, $this->dropTable->doOperation($recreatedElementHistory));
}
}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/UpToDateDeclarativeSchema.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/UpToDateDeclarativeSchema.php
new file mode 100644
index 000000000000..d19c117dd620
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/UpToDateDeclarativeSchema.php
@@ -0,0 +1,60 @@
+schemaConfig = $schemaConfig;
+ $this->schemaDiff = $schemaDiff;
+ }
+
+ /**
+ * @return string
+ */
+ public function getNotUpToDateMessage() : string
+ {
+ return 'Declarative Schema is not up to date';
+ }
+
+ /**
+ * @return bool
+ */
+ public function isUpToDate() : bool
+ {
+ $declarativeSchema = $this->schemaConfig->getDeclarationConfig();
+ $dbSchema = $this->schemaConfig->getDbConfig();
+ $diff = $this->schemaDiff->diff($declarativeSchema, $dbSchema);
+ return empty($diff->getAll());
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd
index fa1894bb486c..66cd19d05128 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/schema.xsd
@@ -59,12 +59,15 @@
+
+
+
-
+
diff --git a/lib/internal/Magento/Framework/Setup/OldDbValidator.php b/lib/internal/Magento/Framework/Setup/OldDbValidator.php
new file mode 100644
index 000000000000..005f7bdd713b
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/OldDbValidator.php
@@ -0,0 +1,72 @@
+dbVersionInfo = $dbVersionInfo;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getNotUpToDateMessage(): string
+ {
+ $genericMessage = 'The module code base doesn\'t match the DB schema and data.' .
+ PHP_EOL .
+ 'Some modules use code versions newer or older than the database.';
+ $messages = [];
+ $versionParser = new VersionParser();
+ $codebaseUpdateNeeded = false;
+ foreach ($this->dbVersionInfo->getDbVersionErrors() as $error) {
+ if (!$codebaseUpdateNeeded && $error[DbVersionInfo::KEY_CURRENT] !== 'none') {
+ // check if module code base update is needed
+ $currentVersion = $versionParser->parseConstraints($error[DbVersionInfo::KEY_CURRENT]);
+ $requiredVersion = $versionParser->parseConstraints('>' . $error[DbVersionInfo::KEY_REQUIRED]);
+ if ($requiredVersion->matches($currentVersion)) {
+ $codebaseUpdateNeeded = true;
+ };
+
+ $messages[] = sprintf(
+ "%20s %10s: %11s -> %-11s",
+ $error[DbVersionInfo::KEY_MODULE],
+ $error[DbVersionInfo::KEY_TYPE],
+ $error[DbVersionInfo::KEY_CURRENT],
+ $error[DbVersionInfo::KEY_REQUIRED]
+ );
+ }
+ }
+
+ return implode(PHP_EOL, $messages) . ($codebaseUpdateNeeded ? $genericMessage : '');
+ }
+
+ /**
+ * @return bool
+ */
+ public function isUpToDate(): bool
+ {
+ return empty($this->dbVersionInfo->getDbVersionErrors());
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php b/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php
index 4ffc4f182835..d81d36d383f6 100644
--- a/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php
+++ b/lib/internal/Magento/Framework/Setup/Patch/PatchApplier.php
@@ -7,7 +7,7 @@
namespace Magento\Framework\Setup\Patch;
use Magento\Framework\App\ResourceConnection;
-use Magento\Framework\Module\ModuleResource;
+use Magento\Framework\Module\ModuleList;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\Phrase;
use Magento\Framework\Setup\Exception;
@@ -19,6 +19,16 @@
*/
class PatchApplier
{
+ /**
+ * Flag means, that we need to read schema patches
+ */
+ const SCHEMA_PATCH = 'schema';
+
+ /**
+ * Flag means, that we need to read data patches
+ */
+ const DATA_PATCH = 'data';
+
/**
* @var PatchRegistryFactory
*/
@@ -39,11 +49,6 @@ class PatchApplier
*/
private $resourceConnection;
- /**
- * @var ModuleResource
- */
- private $moduleResource;
-
/**
* @var PatchHistory
*/
@@ -69,18 +74,29 @@ class PatchApplier
*/
private $objectManager;
+ /**
+ * @var PatchBackwardCompatability
+ */
+ private $patchBackwardCompatability;
+
+ /**
+ * @var ModuleList
+ */
+ private $moduleList;
+
/**
* PatchApplier constructor.
* @param PatchReader $dataPatchReader
* @param PatchReader $schemaPatchReader
* @param PatchRegistryFactory $patchRegistryFactory
* @param ResourceConnection $resourceConnection
- * @param ModuleResource $moduleResource
+ * @param PatchBackwardCompatability $patchBackwardCompatability
* @param PatchHistory $patchHistory
* @param PatchFactory $patchFactory
* @param ObjectManagerInterface $objectManager
* @param \Magento\Framework\Setup\SchemaSetupInterface $schemaSetup
* @param ModuleDataSetupInterface $moduleDataSetup
+ * @param ModuleList $moduleList
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(Magento.TypeDuplication)
*/
@@ -89,51 +105,25 @@ public function __construct(
PatchReader $schemaPatchReader,
PatchRegistryFactory $patchRegistryFactory,
ResourceConnection $resourceConnection,
- ModuleResource $moduleResource,
+ PatchBackwardCompatability $patchBackwardCompatability,
PatchHistory $patchHistory,
PatchFactory $patchFactory,
ObjectManagerInterface $objectManager,
\Magento\Framework\Setup\SchemaSetupInterface $schemaSetup,
- \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
+ \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup,
+ ModuleList $moduleList
) {
$this->patchRegistryFactory = $patchRegistryFactory;
$this->dataPatchReader = $dataPatchReader;
$this->schemaPatchReader = $schemaPatchReader;
$this->resourceConnection = $resourceConnection;
- $this->moduleResource = $moduleResource;
$this->patchHistory = $patchHistory;
$this->patchFactory = $patchFactory;
$this->schemaSetup = $schemaSetup;
$this->moduleDataSetup = $moduleDataSetup;
$this->objectManager = $objectManager;
- }
-
- /**
- * Check is patch skipable by data setup version in DB
- *
- * @param string $patchClassName
- * @param string $moduleName
- * @return bool
- */
- private function isSkipableByDataSetupVersion(string $patchClassName, $moduleName)
- {
- $dbVersion = $this->moduleResource->getDataVersion($moduleName);
- return in_array(PatchVersionInterface::class, class_implements($patchClassName)) &&
- version_compare(call_user_func([$patchClassName, 'getVersion']), $dbVersion) <= 0;
- }
-
- /**
- * Check is patch skipable by schema setup version in DB
- *
- * @param string $patchClassName
- * @param string $moduleName
- * @return bool
- */
- private function isSkipableBySchemaSetupVersion(string $patchClassName, $moduleName)
- {
- $dbVersion = $this->moduleResource->getDbVersion($moduleName);
- return in_array(PatchVersionInterface::class, class_implements($patchClassName)) &&
- version_compare(call_user_func([$patchClassName, 'getVersion']), $dbVersion) <= 0;
+ $this->patchBackwardCompatability = $patchBackwardCompatability;
+ $this->moduleList = $moduleList;
}
/**
@@ -144,13 +134,12 @@ private function isSkipableBySchemaSetupVersion(string $patchClassName, $moduleN
*/
public function applyDataPatch($moduleName = null)
{
- $dataPatches = $this->dataPatchReader->read($moduleName);
- $registry = $this->prepareRegistry($dataPatches);
+ $registry = $this->prepareRegistry($moduleName, self::DATA_PATCH);
foreach ($registry as $dataPatch) {
/**
- * Due to bacward compatabilities reasons some patches should be skipped
+ * Due to backward compatabilities reasons some patches should be skipped
*/
- if ($this->isSkipableByDataSetupVersion($dataPatch, $moduleName)) {
+ if ($this->patchBackwardCompatability->isSkipableByDataSetupVersion($dataPatch, $moduleName)) {
$this->patchHistory->fixPatch($dataPatch);
continue;
}
@@ -187,13 +176,25 @@ public function applyDataPatch($moduleName = null)
* Register all patches in registry in order to manipulate chains and dependencies of patches
* of patches
*
- * @param array $patchNames
+ * @param string $moduleName
+ * @param string $patchType
* @return PatchRegistry
*/
- private function prepareRegistry(array $patchNames)
+ private function prepareRegistry($moduleName, $patchType)
{
+ $reader = $patchType === self::DATA_PATCH ? $this->dataPatchReader : $this->schemaPatchReader;
$registry = $this->patchRegistryFactory->create();
+ //Prepare modules to read
+ if ($moduleName === null) {
+ $patchNames = [];
+ foreach ($this->moduleList->getNames() as $moduleName) {
+ $patchNames += $reader->read($moduleName);
+ }
+ } else {
+ $patchNames = $reader->read($moduleName);
+ }
+
foreach ($patchNames as $patchName) {
$registry->registerPatch($patchName);
}
@@ -204,20 +205,20 @@ private function prepareRegistry(array $patchNames)
/**
* Apply all patches for one module
*
+ * Please note: that schema patches are not revertable
+ *
* @param null | string $moduleName
* @throws Exception
*/
public function applySchemaPatch($moduleName = null)
{
- $schemaPatches = $this->schemaPatchReader->read($moduleName);
- $registry = $this->prepareRegistry($schemaPatches);
-
+ $registry = $this->prepareRegistry($moduleName, self::SCHEMA_PATCH);
foreach ($registry as $schemaPatch) {
try {
/**
* Skip patches that were applied in old style
*/
- if ($this->isSkipableBySchemaSetupVersion($schemaPatch, $moduleName)) {
+ if ($this->patchBackwardCompatability->isSkipableBySchemaSetupVersion($schemaPatch, $moduleName)) {
$this->patchHistory->fixPatch($schemaPatch);
continue;
}
@@ -252,8 +253,7 @@ public function applySchemaPatch($moduleName = null)
*/
public function revertDataPatches($moduleName = null)
{
- $dataPatches = $this->dataPatchReader->read($moduleName);
- $registry = $this->prepareRegistry($dataPatches);
+ $registry = $this->prepareRegistry($moduleName, self::DATA_PATCH);
$adapter = $this->moduleDataSetup->getConnection();
foreach ($registry->getReverseIterator() as $dataPatch) {
diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchBackwardCompatability.php b/lib/internal/Magento/Framework/Setup/Patch/PatchBackwardCompatability.php
new file mode 100644
index 000000000000..9f22c9491b05
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/Patch/PatchBackwardCompatability.php
@@ -0,0 +1,60 @@
+moduleResource = $moduleResource;
+ }
+
+ /**
+ * Check is patch skipable by data setup version in DB
+ *
+ * @param string $patchClassName
+ * @param string $moduleName
+ * @return bool
+ */
+ public function isSkipableByDataSetupVersion(string $patchClassName, string $moduleName) : bool
+ {
+ $dbVersion = (string) $this->moduleResource->getDataVersion($moduleName);
+ return in_array(PatchVersionInterface::class, class_implements($patchClassName)) &&
+ version_compare(call_user_func([$patchClassName, 'getVersion']), $dbVersion) <= 0;
+ }
+
+ /**
+ * Check is patch skipable by schema setup version in DB
+ *
+ * @param string $patchClassName
+ * @param string $moduleName
+ * @return bool
+ */
+ public function isSkipableBySchemaSetupVersion(string $patchClassName, string $moduleName) : bool
+ {
+ $dbVersion = (string) $this->moduleResource->getDbVersion($moduleName);
+ return in_array(PatchVersionInterface::class, class_implements($patchClassName)) &&
+ version_compare(call_user_func([$patchClassName, 'getVersion']), $dbVersion) <= 0;
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchReader.php b/lib/internal/Magento/Framework/Setup/Patch/PatchReader.php
index 845716abcf49..fc857e6a8699 100644
--- a/lib/internal/Magento/Framework/Setup/Patch/PatchReader.php
+++ b/lib/internal/Magento/Framework/Setup/Patch/PatchReader.php
@@ -14,7 +14,7 @@
/**
* Allows to read all patches through the whole system
*/
-class PatchReader implements ReaderInterface
+class PatchReader
{
/**
* Folder name, where patches are
@@ -102,21 +102,13 @@ private function getPatchClassesPerModule($moduleName, $modulePath)
}
/**
- * @param null $moduleName
+ * @param string $moduleName
* @return array
*/
- public function read($moduleName = null)
+ public function read($moduleName)
{
- $patches = [];
- if ($moduleName === null) {
- foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleName => $modulePath) {
- $patches += $this->getPatchClassesPerModule($moduleName, $modulePath);
- }
- } else {
- $modulePath = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName);
- $patches = $this->getPatchClassesPerModule($moduleName, $modulePath);
- }
-
+ $modulePath = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName);
+ $patches = $this->getPatchClassesPerModule($moduleName, $modulePath);
return $patches;
}
}
diff --git a/lib/internal/Magento/Framework/Setup/Patch/PatchRegistry.php b/lib/internal/Magento/Framework/Setup/Patch/PatchRegistry.php
index 0d0d9abf2925..08e8f96bd5b6 100644
--- a/lib/internal/Magento/Framework/Setup/Patch/PatchRegistry.php
+++ b/lib/internal/Magento/Framework/Setup/Patch/PatchRegistry.php
@@ -97,9 +97,8 @@ public function registerPatch(string $patchName)
return $this->patches[$patchName];
}
- $patch = $patchName;
- $this->patches[$patchName] = $patch;
- return $patch;
+ $this->patches[$patchName] = $patchName;
+ return $patchName;
}
/**
diff --git a/lib/internal/Magento/Framework/Setup/Patch/UpToDateData.php b/lib/internal/Magento/Framework/Setup/Patch/UpToDateData.php
new file mode 100644
index 000000000000..e15d489a1f79
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/Patch/UpToDateData.php
@@ -0,0 +1,82 @@
+patchHistory = $patchHistory;
+ $this->patchReader = $dataPatchReader;
+ $this->patchBackwardCompatability = $patchBackwardCompatability;
+ $this->moduleList = $moduleList;
+ }
+
+ /**
+ * @return string
+ */
+ public function getNotUpToDateMessage() : string
+ {
+ return 'Data patches are not up to date';
+ }
+
+ /**
+ * @return bool
+ */
+ public function isUpToDate() : bool
+ {
+ foreach ($this->moduleList->getNames() as $moduleName) {
+ foreach ($this->patchReader->read($moduleName) as $patchName) {
+ if (!$this->patchBackwardCompatability->isSkipableByDataSetupVersion($patchName, $moduleName) &&
+ !$this->patchHistory->isApplied($patchName)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Patch/UpToDateSchema.php b/lib/internal/Magento/Framework/Setup/Patch/UpToDateSchema.php
new file mode 100644
index 000000000000..5fd940d19aab
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/Patch/UpToDateSchema.php
@@ -0,0 +1,81 @@
+patchHistory = $patchHistory;
+ $this->patchReader = $schemaReader;
+ $this->patchBackwardCompatability = $patchBackwardCompatability;
+ $this->moduleList = $moduleList;
+ }
+
+ /**
+ * @return string
+ */
+ public function getNotUpToDateMessage() : string
+ {
+ return 'Schema patches are not up to date';
+ }
+
+ /**
+ * @return bool
+ */
+ public function isUpToDate() : bool
+ {
+ foreach ($this->moduleList->getNames() as $moduleName) {
+ foreach ($this->patchReader->read($moduleName) as $patchName) {
+ if (!$this->patchBackwardCompatability->isSkipableBySchemaSetupVersion($patchName, $moduleName) &&
+ !$this->patchHistory->isApplied($patchName)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php
index 593f6d5b4339..0a2eb60fda48 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php
@@ -164,7 +164,10 @@ private function createTable($name)
$name,
'table',
'default',
- 'resource'
+ 'resource',
+ 'utf-8',
+ 'utf-8',
+ ''
);
}
@@ -273,6 +276,9 @@ public function testBuild(array $columns, array $references, array $constraints,
$resourceConnectionMock = $this->getMockBuilder(ResourceConnection::class)
->disableOriginalConstructor()
->getMock();
+ $resourceConnectionMock->expects(self::any())
+ ->method('getTableName')
+ ->willReturnArgument(0);
/** @var Schema $schema */
$schema = $this->objectManagerHelper->getObject(
Schema::class,
@@ -331,8 +337,8 @@ private function prepareSchemaMocks(array $columns, array $references, array $co
->method('getTableOptions')
->withConsecutive(...array_values($withContext))
->willReturnOnConsecutiveCalls(
- ['Engine' => 'innodb', 'Comment' => ''],
- ['Engine' => 'innodb', 'Comment' => 'Not null comment']
+ ['engine' => 'innodb', 'comment' => '', 'charset' => 'utf-8', 'collation' => 'utf-8'],
+ ['engine' => 'innodb', 'comment' => 'Not null comment', 'charset' => 'utf-8', 'collation' => 'utf-8']
);
$this->dbSchemaReaderMock->expects($this->any())
->method('readColumns')
@@ -380,7 +386,9 @@ private function prepareSchemaMocks(array $columns, array $references, array $co
'name' =>'first_table',
'resource' => 'default',
'engine' => 'innodb',
- 'comment' => null
+ 'comment' => null,
+ 'charset' => 'utf-8',
+ 'collation' => 'utf-8'
]
],
[
@@ -430,7 +438,9 @@ private function prepareSchemaMocks(array $columns, array $references, array $co
'name' =>'second_table',
'resource' => 'default',
'engine' => 'innodb',
- 'comment' => 'Not null comment'
+ 'comment' => 'Not null comment',
+ 'charset' => 'utf-8',
+ 'collation' => 'utf-8'
]
],
[
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php
index 523784ccb4fe..f596a448f1ab 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php
@@ -192,7 +192,10 @@ private function createTable($name)
$name,
'table',
'default',
- 'resource'
+ 'resource',
+ 'utf-8',
+ 'utf-8',
+ ''
);
}
@@ -314,108 +317,12 @@ public function testBuild(array $tablesData)
$refColumn,
'CASCADE'
);
- $table->addColumns([$firstColumn, $foreignColumn, $timestampColumn]);
- $table->addConstraints([$foreignKey, $primaryKey]);
+ $firstTableColumns = [$firstColumn, $foreignColumn, $timestampColumn];
+ $firstTableConstraints = [$foreignKey, $primaryKey];
+ $table->addColumns($firstTableColumns);
+ $table->addConstraints($firstTableConstraints);
$this->elementFactoryMock->expects(self::exactly(9))
->method('create')
- ->withConsecutive(
- [
- 'table',
- [
- 'name' =>'first_table',
- 'resource' => 'default',
- 'engine' => 'innodb',
- 'comment' => null
- ]
- ],
- [
- 'int',
- [
- 'name' => 'first_column',
- 'type' => 'int',
- 'table' => $table,
- 'padding' => 10,
- 'identity' => true,
- 'nullable' => false,
- 'resource' => 'default'
- ]
- ],
- [
- 'int',
- [
- 'name' => 'foreign_column',
- 'type' => 'int',
- 'table' => $table,
- 'padding' => 10,
- 'nullable' => false,
- 'resource' => 'default'
- ]
- ],
- [
- 'timestamp',
- [
- 'name' => 'second_column',
- 'type' => 'timestamp',
- 'table' => $table,
- 'default' => 'CURRENT_TIMESTAMP',
- 'on_update' => true,
- 'resource' => 'default'
- ]
- ],
- [
- 'table',
- [
- 'name' =>'second_table',
- 'resource' => 'default',
- 'engine' => 'innodb',
- 'comment' => null
- ]
- ],
- [
- 'int',
- [
- 'name' => 'ref_column',
- 'type' => 'int',
- 'table' => $refTable,
- 'padding' => 10,
- 'nullable' => false,
- 'resource' => 'default'
- ]
- ],
- [
- 'index',
- [
- 'name' => 'FIRST_INDEX',
- 'table' => $refTable,
- 'column' => ['ref_column'],
- 'columns' => [$refColumn],
- 'resource' => 'default'
- ]
- ],
- [
- 'foreign',
- [
- 'name' => 'some_foreign_key',
- 'type' => 'foreign',
- 'column' => $foreignColumn,
- 'table' => $table,
- 'referenceTable' => $refTable,
- 'referenceColumn' => $refColumn,
- 'resource' => 'default'
- ]
- ],
- [
- 'primary',
- [
- 'name' => 'PRIMARY',
- 'type' => 'primary',
- 'columns' => [$firstColumn],
- 'table' => $table,
- 'column' => ['first_column'],
- 'resource' => 'default'
- ]
- ]
- )
->willReturnOnConsecutiveCalls(
$table,
$firstColumn,
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php
index b88ad608c89f..8a8aecb81834 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php
@@ -13,6 +13,9 @@
use Magento\Framework\Setup\Declaration\Schema\Dto\Index;
use Magento\Framework\Setup\Declaration\Schema\Dto\Table;
+/**
+ * Test diff manager methods
+ */
class DiffManagerTest extends \PHPUnit\Framework\TestCase
{
/**
@@ -47,7 +50,16 @@ protected function setUp()
public function testShouldBeCreated()
{
$elements = ['first' => new \stdClass(), 'second' => new \stdClass()];
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
+ );
$element = new Column('third', 'int', $table);
$existingElement = new Column('second', 'int', $table);
self::assertTrue($this->model->shouldBeCreated($elements, $element));
@@ -60,7 +72,16 @@ public function testRegisterModification()
$diff = $this->getMockBuilder(Diff::class)
->disableOriginalConstructor()
->getMock();
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
+ );
$element = new Column('third', 'int', $table);
$generatedElement = new Column('third', 'int', $table, 'Previous column');
$diff->expects(self::once())
@@ -75,7 +96,16 @@ public function testRegisterIndexModification()
$diff = $this->getMockBuilder(Diff::class)
->disableOriginalConstructor()
->getMock();
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
+ );
$column = new Column('third', 'int', $table, 'Previous column');
$index = new Index('index_type', 'index', $table, [$column], 'btree');
$generatedIndex = new Index('index_type', 'index', $table, [$column], 'hash');
@@ -91,20 +121,32 @@ public function testRegisterRemovalReference()
$diff = $this->getMockBuilder(Diff::class)
->disableOriginalConstructor()
->getMock();
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
+ );
$refTable = new Table(
'ref_table',
'ref_table',
'table',
'default',
- 'innodb'
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
);
$column = new Column('third', 'int', $table, 'Previous column');
$reference = new Reference('ref', 'foreign', $table, $column, $refTable, $column, 'CASCADE');
$diff->expects(self::exactly(2))
->method('register')
->withConsecutive(
- [$reference, 'drop_reference', $reference, 'ref_table'],
+ [$reference, 'drop_reference', $reference],
[$table, 'drop_table', $table]
);
$this->model->registerRemoval($diff, [$reference, $table]);
@@ -116,7 +158,16 @@ public function testRegisterCreation()
$diff = $this->getMockBuilder(Diff::class)
->disableOriginalConstructor()
->getMock();
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
+ );
$column = new Column('third', 'int', $table, 'Previous column');
$reference = new Reference('ref', 'foreign', $table, $column, $table, $column, 'CASCADE');
$diff->expects(self::exactly(3))
@@ -137,18 +188,30 @@ public function testRegisterTableModificationWhenChangeResource()
$diff = $this->getMockBuilder(Diff::class)
->disableOriginalConstructor()
->getMock();
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
+ );
$generateTable = new Table(
'name',
'name',
'table',
'sales',
- 'innodb'
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
);
$diff->expects(self::once())
->method('register')
->with($table, 'recreate_table', $generateTable);
- $this->model->registerTableModification($table, $generateTable, $diff);
+ $this->model->registerRecreation($table, $generateTable, $diff);
}
public function testRegisterTableModificationWhenChangeEngine()
@@ -157,13 +220,25 @@ public function testRegisterTableModificationWhenChangeEngine()
$diff = $this->getMockBuilder(Diff::class)
->disableOriginalConstructor()
->getMock();
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
+ );
$generateTable = new Table(
'name',
'name',
'table',
'default',
- 'memory'
+ 'memory',
+ 'utf-8',
+ 'utf_8_general_ci',
+ ''
);
$diff->expects(self::once())
->method('register')
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Dto/Factories/TableTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Dto/Factories/TableTest.php
index 9562d38d74cf..fc7e097dc446 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Dto/Factories/TableTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Dto/Factories/TableTest.php
@@ -8,6 +8,9 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Framework\Setup\Declaration\Schema\Dto\Table;
+/**
+ * Test table factory
+ */
class TableTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Table */
@@ -53,7 +56,10 @@ public function testCreate()
$expectedData = [
'name' => 'pf_some_table',
'engine' => 'innodb',
- 'nameWithoutPrefix' => 'some_table'
+ 'nameWithoutPrefix' => 'some_table',
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_general_ci',
+ 'onCreate' => ''
];
$this->objectManagerMock->expects(self::once())
->method('create')
@@ -74,7 +80,10 @@ public function testCreateWithPrefix()
$expectedData = [
'name' => 'pf_some_table',
'engine' => 'memory',
- 'nameWithoutPrefix' => 'some_table'
+ 'nameWithoutPrefix' => 'some_table',
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_general_ci',
+ 'onCreate' => ''
];
$this->objectManagerMock->expects(self::once())
->method('create')
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php
index 38e16152c415..d061fc1fb6c9 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php
@@ -118,7 +118,16 @@ protected function setUp()
*/
private function prepareColumn()
{
- $table = new Table('table', 'table', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'table',
+ 'table',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
+ );
$column = new Integer(
'int',
'int',
@@ -158,7 +167,7 @@ public function testDoOperation()
->willReturn(true);
$this->migrateDataTrigger->expects(self::once())
->method('getCallback')
- ->with($column)
+ ->with($elementHistory)
->willReturn($callback);
$statement = $this->getMockBuilder(Statement::class)
->disableOriginalConstructor()
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/OperationsExecutorTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/OperationsExecutorTest.php
index 50fff290da18..26cbc0afc559 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/OperationsExecutorTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/OperationsExecutorTest.php
@@ -123,7 +123,16 @@ protected function setUp()
*/
private function prepareTable()
{
- $table = new Table('table', 'table', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'table',
+ 'table',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
+ );
$column = new Integer(
'int',
'int',
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php
index 573fc483a19c..a0bf75800434 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php
@@ -33,13 +33,25 @@ protected function setUp()
public function testValidate()
{
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
+ );
$refTable = new Table(
'ref_table',
'name',
'table',
'default',
- 'innodb'
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
);
$column = new Real('decimal', 'decimal', $table, 10, 5);
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/RealTypesTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/RealTypesTest.php
index 573cacae322f..0c0d4ac2b455 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/RealTypesTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/RealTypesTest.php
@@ -32,7 +32,16 @@ protected function setUp()
public function testValidate()
{
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
+ );
$okColumn = new Real('decimal', 'decimal', $table, 10, 5);
$invalidColumn = new Real('float', 'float', $table, 5, 10);
$table->addColumns([$okColumn, $invalidColumn]);
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php
index d1ae5e7c9127..c4e88b569d9c 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php
@@ -37,13 +37,25 @@ protected function setUp()
public function testValidate()
{
- $table = new Table('name', 'name', 'table', 'default', 'innodb');
+ $table = new Table(
+ 'name',
+ 'name',
+ 'table',
+ 'default',
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
+ );
$refTable = new Table(
'ref_table',
'name',
'table',
'default',
- 'innodb'
+ 'innodb',
+ 'utf-8',
+ 'utf-8',
+ ''
);
$column = new Real('decimal', 'decimal', $table, 10, 5);
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Patch/PatchApplierTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Patch/PatchApplierTest.php
index 76d40a983de7..66aff8e77902 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Patch/PatchApplierTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Patch/PatchApplierTest.php
@@ -11,6 +11,7 @@
use Magento\Framework\Module\ModuleResource;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
+use Magento\Framework\Setup\Patch\PatchBackwardCompatability;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Framework\Setup\Patch\PatchApplier;
@@ -87,6 +88,11 @@ class PatchApplierTest extends \PHPUnit\Framework\TestCase
*/
private $connectionMock;
+ /**
+ * @var PatchBackwardCompatability |\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $patchBacwardCompatability;
+
protected function setUp()
{
$this->patchRegistryFactoryMock = $this->createMock(PatchRegistryFactory::class);
@@ -103,6 +109,12 @@ protected function setUp()
$this->moduleDataSetupMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock);
$objectManager = new ObjectManager($this);
+ $this->patchBacwardCompatability = $objectManager->getObject(
+ PatchBackwardCompatability::class,
+ [
+ 'moduleResource' => $this->moduleResourceMock
+ ]
+ );
$this->patchApllier = $objectManager->getObject(
PatchApplier::class,
[
@@ -116,6 +128,7 @@ protected function setUp()
'objectManager' => $this->objectManagerMock,
'schemaSetup' => $this->schemaSetupMock,
'moduleDataSetup' => $this->moduleDataSetupMock,
+ 'patchBackwardCompatability' => $this->patchBacwardCompatability
]
);
require_once __DIR__ . '/../_files/data_patch_classes.php';
@@ -216,27 +229,31 @@ public function testApplyDataPatchForInstalledModule($moduleName, $dataPatches,
\SomeDataPatch::class,
\OtherDataPatch::class
];
- $patchRegistryMock = $this->createAggregateIteratorMock(PatchRegistry::class, $patches, ['registerPatch']);
- $patchRegistryMock->expects($this->exactly(2))
+ $patchRegistryMock = $this->createAggregateIteratorMock(
+ PatchRegistry::class,
+ $patches,
+ ['registerPatch']
+ );
+ $patchRegistryMock->expects(self::exactly(2))
->method('registerPatch');
- $this->patchRegistryFactoryMock->expects($this->any())
+ $this->patchRegistryFactoryMock->expects(self::any())
->method('create')
->willReturn($patchRegistryMock);
$patch1 = $this->createMock(\SomeDataPatch::class);
- $patch1->expects($this->never())->method('apply');
+ $patch1->expects(self::never())->method('apply');
$patch2 = $this->createMock(\OtherDataPatch::class);
- $patch2->expects($this->once())->method('apply');
- $this->objectManagerMock->expects($this->any())->method('create')->willReturnMap(
+ $patch2->expects(self::once())->method('apply');
+ $this->objectManagerMock->expects(self::any())->method('create')->willReturnMap(
[
['\\' . \SomeDataPatch::class, ['moduleDataSetup' => $this->moduleDataSetupMock], $patch1],
['\\' . \OtherDataPatch::class, ['moduleDataSetup' => $this->moduleDataSetupMock], $patch2],
]
);
- $this->connectionMock->expects($this->exactly(1))->method('beginTransaction');
- $this->connectionMock->expects($this->exactly(1))->method('commit');
- $this->patchHistoryMock->expects($this->exactly(2))->method('fixPatch');
+ $this->connectionMock->expects(self::exactly(1))->method('beginTransaction');
+ $this->connectionMock->expects(self::exactly(1))->method('commit');
+ $this->patchHistoryMock->expects(self::exactly(2))->method('fixPatch');
$this->patchApllier->applyDataPatch($moduleName);
}
diff --git a/lib/internal/Magento/Framework/Setup/UpToDateValidatorInterface.php b/lib/internal/Magento/Framework/Setup/UpToDateValidatorInterface.php
new file mode 100644
index 000000000000..033fdaa3de2e
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/UpToDateValidatorInterface.php
@@ -0,0 +1,36 @@
+objectManagerProvider = $objectManagerProvider;
$this->deploymentConfig = $deploymentConfig;
+ /**
+ * As DbStatucCommand is in setup and all validators are part of the framework, we can`t configure
+ * this command with dependency injection and we need to inject each validator manually
+ */
+ $this->upToDateValidators = [
+ $this->objectManagerProvider->get()->get(UpToDateDeclarativeSchema::class),
+ $this->objectManagerProvider->get()->get(UpToDateSchema::class),
+ $this->objectManagerProvider->get()->get(UpToDateData::class),
+ $this->objectManagerProvider->get()->get(OldDbValidator::class),
+ ];
parent::__construct();
}
@@ -71,43 +89,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
);
return Cli::RETURN_FAILURE;
}
- /** @var DbVersionInfo $dbVersionInfo */
- $dbVersionInfo = $this->objectManagerProvider->get()
- ->get(\Magento\Framework\Module\DbVersionInfo::class);
- $outdated = $dbVersionInfo->getDbVersionErrors();
- if (!empty($outdated)) {
- $output->writeln("The module code base doesn't match the DB schema and data.");
- $versionParser = new VersionParser();
- $codebaseUpdateNeeded = false;
- foreach ($outdated as $row) {
- if (!$codebaseUpdateNeeded && $row[DbVersionInfo::KEY_CURRENT] !== 'none') {
- // check if module code base update is needed
- $currentVersion = $versionParser->parseConstraints($row[DbVersionInfo::KEY_CURRENT]);
- $requiredVersion = $versionParser->parseConstraints('>' . $row[DbVersionInfo::KEY_REQUIRED]);
- if ($requiredVersion->matches($currentVersion)) {
- $codebaseUpdateNeeded = true;
- };
- }
- $output->writeln(sprintf(
- "%20s %10s: %11s -> %-11s",
- $row[DbVersionInfo::KEY_MODULE],
- $row[DbVersionInfo::KEY_TYPE],
- $row[DbVersionInfo::KEY_CURRENT],
- $row[DbVersionInfo::KEY_REQUIRED]
- ));
- }
- if ($codebaseUpdateNeeded) {
- $output->writeln(
- 'Some modules use code versions newer or older than the database. ' .
- "First update the module code, then run 'setup:upgrade'."
- );
- return Cli::RETURN_FAILURE;
+
+ $outDated = false;
+
+ foreach ($this->upToDateValidators as $validator) {
+ if (!$validator->isUpToDate()) {
+ $output->writeln(sprintf('%s', $validator->getNotUpToDateMessage()));
+ $outDated = true;
}
+ }
- $output->writeln(
- "Run 'setup:upgrade' to update your DB schema and data."
- );
- return static::EXIT_CODE_UPGRADE_REQUIRED;
+ if ($outDated) {
+ $output->writeln('Run \'setup:upgrade\' to update your DB schema and data.');
+ return self::EXIT_CODE_UPGRADE_REQUIRED;
}
$output->writeln(
diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/DbStatusCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbStatusCommandTest.php
index 9c28c2be0426..b769012ea81d 100644
--- a/setup/src/Magento/Setup/Test/Unit/Console/Command/DbStatusCommandTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/DbStatusCommandTest.php
@@ -7,6 +7,7 @@
use Magento\Framework\Console\Cli;
use Magento\Framework\Module\DbVersionInfo;
+use Magento\Framework\Setup\UpToDateValidatorInterface;
use Magento\Setup\Console\Command\DbStatusCommand;
use Magento\Framework\App\DeploymentConfig;
use Magento\Setup\Model\ObjectManagerProvider;
@@ -34,6 +35,11 @@ class DbStatusCommandTest extends \PHPUnit\Framework\TestCase
*/
private $command;
+ /**
+ * @var array | Mock[]
+ */
+ private $validators;
+
/**
* @inheritdoc
*/
@@ -51,95 +57,48 @@ protected function setUp()
$this->deploymentConfig = $this->getMockBuilder(DeploymentConfig::class)
->disableOriginalConstructor()
->getMock();
+ $this->validators = [
+ 'declarative_schema' => $this->getMockBuilder(UpToDateValidatorInterface::class)->getMock(),
+ 'up_to_date_schema' => $this->getMockBuilder(UpToDateValidatorInterface::class)->getMock(),
+ 'up_to_date_data' => $this->getMockBuilder(UpToDateValidatorInterface::class)->getMock(),
+ 'old_validator' => $this->getMockBuilder(UpToDateValidatorInterface::class)->getMock(),
+ ];
$objectManagerProvider->expects($this->any())
->method('get')
->will($this->returnValue($objectManager));
- $objectManager->expects($this->any())
+ $objectManager->expects(self::exactly(4))
->method('get')
- ->will($this->returnValue($this->dbVersionInfo));
-
+ ->willReturnOnConsecutiveCalls(
+ $this->validators['declarative_schema'],
+ $this->validators['up_to_date_schema'],
+ $this->validators['up_to_date_data'],
+ $this->validators['old_validator']
+ );
$this->command = new DbStatusCommand($objectManagerProvider, $this->deploymentConfig);
}
- /**
- * @param array $outdatedInfo
- * @param string $expectedMessage
- * @param int $expectedCode
- *
- * @dataProvider executeDataProvider
- */
- public function testExecute(array $outdatedInfo, $expectedMessage, $expectedCode)
+ public function testExecute()
{
+ $this->validators['old_validator']->expects(self::once())
+ ->method('isUpToDate')
+ ->willReturn(true);
+ $this->validators['up_to_date_schema']->expects(self::once())
+ ->method('isUpToDate')
+ ->willReturn(true);
+ $this->validators['up_to_date_data']->expects(self::once())
+ ->method('isUpToDate')
+ ->willReturn(true);
+ $this->validators['declarative_schema']->expects(self::once())
+ ->method('isUpToDate')
+ ->willReturn(true);
$this->deploymentConfig->expects($this->once())
->method('isAvailable')
->will($this->returnValue(true));
- $this->dbVersionInfo->expects($this->once())
- ->method('getDbVersionErrors')
- ->will($this->returnValue($outdatedInfo));
-
$tester = new CommandTester($this->command);
$tester->execute([]);
-
- $this->assertStringMatchesFormat($expectedMessage, $tester->getDisplay());
- $this->assertSame($expectedCode, $tester->getStatusCode());
- }
-
- public function executeDataProvider()
- {
- return [
- 'DB is up to date' => [
- [],
- 'All modules are up to date%a',
- Cli::RETURN_SUCCESS
- ],
- 'DB is outdated' => [
- [
- [
- DbVersionInfo::KEY_MODULE => 'module_a',
- DbVersionInfo::KEY_TYPE => 'schema',
- DbVersionInfo::KEY_CURRENT => '1.0.0',
- DbVersionInfo::KEY_REQUIRED => '2.0.0'
- ]
- ],
- '%amodule_a%aschema%a1%a->%a2'
- . "%aRun 'setup:upgrade' to update your DB schema and data%a",
- DbStatusCommand::EXIT_CODE_UPGRADE_REQUIRED,
- ],
- 'code is outdated' => [
- [
- [
- DbVersionInfo::KEY_MODULE => 'module_a',
- DbVersionInfo::KEY_TYPE => 'data',
- DbVersionInfo::KEY_CURRENT => '2.0.0',
- DbVersionInfo::KEY_REQUIRED => '1.0.0'
- ]
- ],
- '%amodule_a%adata%a2.0.0%a->%a1.0.0'
- . '%aSome modules use code versions newer or older than the database%a',
- Cli::RETURN_FAILURE,
- ],
- 'both DB and code is outdated' => [
- [
- [
- DbVersionInfo::KEY_MODULE => 'module_a',
- DbVersionInfo::KEY_TYPE => 'schema',
- DbVersionInfo::KEY_CURRENT => '1.0.0',
- DbVersionInfo::KEY_REQUIRED => '2.0.0'
- ],
- [
- DbVersionInfo::KEY_MODULE => 'module_b',
- DbVersionInfo::KEY_TYPE => 'data',
- DbVersionInfo::KEY_CURRENT => '2.0.0',
- DbVersionInfo::KEY_REQUIRED => '1.0.0'
- ]
- ],
- '%amodule_a%aschema%a1.0.0%a->%a2.0.0'
- . '%amodule_b%adata%a2.0.0%a->%a1.0.0'
- . '%aSome modules use code versions newer or older than the database%a',
- Cli::RETURN_FAILURE,
- ],
- ];
+ $this->assertStringMatchesFormat('All modules are up to date.', $tester->getDisplay());
+ $this->assertSame(0, $tester->getStatusCode());
}
public function testExecuteNotInstalled()
@@ -147,9 +106,6 @@ public function testExecuteNotInstalled()
$this->deploymentConfig->expects($this->once())
->method('isAvailable')
->will($this->returnValue(false));
- $this->dbVersionInfo->expects($this->never())
- ->method('getDbVersionErrors');
-
$tester = new CommandTester($this->command);
$tester->execute([]);