- getFileThumbUrl($file)) : ?> - +
+ getFileThumbUrl($file)): ?> +
- getFileWidth($file)) : ?> - = $block->escapeHtml($block->getFileWidth($file)) ?>x= $block->escapeHtml($block->getFileHeight($file)) ?> = $block->escapeHtml(__('px.')) ?>line1
\nline2", $attributeName) + $this->_helper->{$method}(uniqid(), __("line1
\nline2"), $attributeName) ); $attribute->setIsHtmlAllowedOnFront($isHtml)->setIsWysiwygEnabled($isWysiwyg); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_multiwebsite_different_description.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_multiwebsite_different_description.php new file mode 100644 index 0000000000000..b77a53621d0bf --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_multiwebsite_different_description.php @@ -0,0 +1,38 @@ +create(ProductFactory::class); +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->create(WebsiteRepositoryInterface::class); +$websiteId = $websiteRepository->get('test')->getId(); +$defaultWebsiteId = $websiteRepository->get('base')->getId(); + +$product = $productFactory->create(); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId($product->getDefaultAttributeSetId()) + ->setWebsiteIds([$defaultWebsiteId, $websiteId]) + ->setName('Simple Product on two websites') + ->setSku('simple-on-two-websites-different-description') + ->setPrice(10) + ->setDescription('Product base description
'); + +$productRepository->save($product); +$product = $productRepository->get('simple-on-two-websites-different-description'); +$product->setDescription('Product second description
'); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_multiwebsite_different_description_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_multiwebsite_different_description_rollback.php new file mode 100644 index 0000000000000..934d380362fcf --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_multiwebsite_different_description_rollback.php @@ -0,0 +1,30 @@ +create(ProductRepositoryInterface::class); +$registry = $objectManager->get(Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +try { + $productRepository->deleteById('simple-on-two-websites-different-description'); +} catch (NoSuchEntityException $e) { + //product already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); + +require __DIR__ . '/../../Store/_files/website_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_12345.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_12345.php index 70aa7c07ed536..b16a312488131 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_12345.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_12345.php @@ -21,7 +21,7 @@ /** @var ProductRepositoryInterface $productRepository */ $productRepository = Bootstrap::getObjectManager() - ->create(ProductRepositoryInterface::class); + ->get(ProductRepositoryInterface::class); /** @var $installer CategorySetup */ $installer = Bootstrap::getObjectManager()->create(CategorySetup::class); @@ -105,7 +105,7 @@ $registry->unregister('isSecureArea'); $registry->register('isSecureArea', true); try { - $productToDelete = $productRepository->getById(11); + $productToDelete = $productRepository->getById(111); $productRepository->delete($productToDelete); /** @var \Magento\Quote\Model\ResourceModel\Quote\Item $itemResource */ diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Account/LoginPostTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Account/LoginPostTest.php index 10476eb01f306..f55907c17e7bb 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Account/LoginPostTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Account/LoginPostTest.php @@ -28,6 +28,11 @@ class LoginPostTest extends AbstractController /** @var EncoderInterface */ private $urlEncoder; + /** + * @var Url + */ + private $customerUrl; + /** * @inheritdoc */ @@ -37,6 +42,7 @@ protected function setUp() $this->session = $this->_objectManager->get(Session::class); $this->urlEncoder = $this->_objectManager->get(EncoderInterface::class); + $this->customerUrl = $this->_objectManager->get(Url::class); } /** @@ -107,13 +113,16 @@ public function missingParametersDataProvider(): array */ public function testLoginWithUnconfirmedPassword(): void { - $this->markTestSkipped('Blocked by MC-31370.'); $email = 'unconfirmedcustomer@example.com'; $this->prepareRequest($email, 'Qwert12345'); $this->dispatch('customer/account/loginPost'); $this->assertEquals($email, $this->session->getUsername()); + $message = __( + 'This account is not confirmed. Click here to resend confirmation email.', + $this->customerUrl->getEmailConfirmationUrl($this->session->getUsername()) + ); $this->assertSessionMessages( - $this->equalTo([(string)__('This account is not confirmed. Click here to resend confirmation email.')]), + $this->equalTo([(string)$message]), MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php index 4ff16189df1ba..3721d189a5544 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php @@ -13,6 +13,8 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\State\ExpiredException; use Magento\Framework\Reflection\DataObjectProcessor; +use Magento\Framework\Url as UrlBuilder; +use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; /** @@ -651,6 +653,34 @@ public function testGetDefaultAddressesForNonExistentAddress() $this->assertNull($this->accountManagement->getDefaultShippingAddress($customerId)); } + /** + * Test reset password for customer on second website when shared account is enabled + * + * When customer from second website initiate reset password on first website + * global scope should not be reinited to customer scope + * + * @magentoConfigFixture current_store customer/account_share/scope 0 + * @magentoDataFixture Magento/Customer/_files/customer_for_second_website.php + */ + public function testInitiatePasswordResetForCustomerOnSecondWebsite() + { + $storeManager = $this->objectManager->get(StoreManagerInterface::class); + $store = $storeManager->getStore(); + + $this->accountManagement->initiatePasswordReset( + 'customer@example.com', + AccountManagement::EMAIL_RESET, + $storeManager->getWebsite()->getId() + ); + + $this->assertEquals($store->getId(), $storeManager->getStore()->getId()); + $urlBuilder = $this->objectManager->get(UrlBuilder::class); + // to init scope if it has not inited yet + $urlBuilder->setScope($urlBuilder->getData('scope')); + $scope = $urlBuilder->getData('scope'); + $this->assertEquals($store->getId(), $scope->getId()); + } + /** * Set Rp data to Customer in fixture * diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php index 20a1f4623a1f7..62750e9ec7de1 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_group_rollback.php @@ -7,6 +7,7 @@ use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Customer\Api\GroupRepositoryInterface; +use Magento\Framework\Registry; use Magento\TestFramework\Helper\Bootstrap; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Exception\NoSuchEntityException; @@ -21,6 +22,11 @@ ->create(); $groups = $groupRepository->getList($searchCriteria) ->getItems(); + +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); foreach ($groups as $group) { try { $groupRepository->delete($group); @@ -28,3 +34,5 @@ //Group already removed } } +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filter/DirectiveProcessor/SimpleDirectiveTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filter/DirectiveProcessor/SimpleDirectiveTest.php index ccf867c51c3c8..5b8b9e6d1f3e3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Filter/DirectiveProcessor/SimpleDirectiveTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Filter/DirectiveProcessor/SimpleDirectiveTest.php @@ -74,6 +74,7 @@ public function testDefaultFiltersAreUsed() public function testParametersAreParsed() { $filter = $this->objectManager->create(Template::class); + $filter->setStrictMode(false); $processor = $this->createWithProcessorsAndFilters( ['mydir' => $this->objectManager->create(MyDirProcessor::class)], diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filter/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filter/TemplateTest.php index de09b87b04e4a..f99a34a077524 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Filter/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Filter/TemplateTest.php @@ -155,6 +155,7 @@ public function testIfDirective() public function testNonDataObjectVariableParsing() { + $previous = $this->templateFilter->setStrictMode(false); $this->templateFilter->setVariables( [ 'address' => new class { @@ -168,11 +169,33 @@ public function format($type) $template = '{{var address.format(\'html\')}}'; $expected = 'Product base description
', + 'Product second description
' + ], + $this->getContent->execute($contentIdentity) + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/category_with_asset.php b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/category_with_asset.php new file mode 100644 index 0000000000000..d890ea52dfad7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/category_with_asset.php @@ -0,0 +1,35 @@ +create(Category::class); +$category->isObjectNew(true); +$category->setId( + 28767 +)->setCreatedAt( + '2014-06-23 09:50:07' +)->setName( + 'Category 1' +)->setDescription( + 'content {{media url="testDirectory/path.jpg"}} content' +)->setParentId( + 2 +)->setPath( + '1/2/333' +)->setLevel( + 2 +)->setAvailableSortBy( + ['position', 'name'] +)->setDefaultSortBy( + 'name' +)->setIsActive( + true +)->setPosition( + 1 +)->save(); diff --git a/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/category_with_asset_rollback.php b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/category_with_asset_rollback.php new file mode 100644 index 0000000000000..a5010883e120c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/category_with_asset_rollback.php @@ -0,0 +1,20 @@ +get(\Magento\Framework\Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var $category \Magento\Catalog\Model\Category */ +$category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Category::class); +$category->load(28767); +if ($category->getId()) { + $category->delete(); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/product_with_asset.php b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/product_with_asset.php new file mode 100644 index 0000000000000..2a1177661572a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/product_with_asset.php @@ -0,0 +1,51 @@ +reinitialize(); + +/** @var ObjectManager $objectManager */ +$objectManager = Bootstrap::getObjectManager(); + +/** @var $product Product */ +$product = $objectManager->create(Product::class); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setId(1567) + ->setAttributeSetId(4) + ->setName('Simple Product') + ->setSku('simple_with_asset') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription('content {{media url="testDirectory/path.jpg"}} content') + ->setTaxClassId(0) + ->setDescription('content {{media url="testDirectory/path.jpg"}} content') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ] + ); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/product_with_asset_rollback.php b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/product_with_asset_rollback.php new file mode 100644 index 0000000000000..8f45ecac0d6f1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/MediaContentCatalog/_files/product_with_asset_rollback.php @@ -0,0 +1,25 @@ +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_with_asset', false, null, true); + $productRepository->delete($product); +} catch (NoSuchEntityException $e) { +} +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/block_with_asset.php b/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/block_with_asset.php new file mode 100644 index 0000000000000..eb2adf0c0a348 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/block_with_asset.php @@ -0,0 +1,25 @@ +create(Block::class); +$block->setTitle( + 'CMS Block Title' +)->setIdentifier( + 'fixture_block_with_asset' +)->setContent( + 'content {{media url="testDirectory/path.jpg"}} content' +)->setIsActive( + 1 +)->setStores( + [ + Bootstrap::getObjectManager()->get(StoreManagerInterface::class)->getStore()->getId() + ] +)->save(); diff --git a/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/block_with_asset_rollback.php b/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/block_with_asset_rollback.php new file mode 100644 index 0000000000000..68069953f22f7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/block_with_asset_rollback.php @@ -0,0 +1,30 @@ +get(BlockRepositoryInterface::class); + +/** @var SearchCriteriaBuilder $searchCriteriaBuilder */ +$searchCriteriaBuilder = $objectManager->get(SearchCriteriaBuilder::class); +$searchCriteria = $searchCriteriaBuilder->addFilter(BlockInterface::IDENTIFIER, 'fixture_block_with_asset') + ->create(); +$result = $blockRepository->getList($searchCriteria); + +/** + * Tests which are wrapped with MySQL transaction clear all data by transaction rollback. + * In that case there is "if" which checks that "fixture_block_with_asset" still exists in database. + */ +foreach ($result->getItems() as $item) { + $blockRepository->delete($item); +} diff --git a/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/page_with_asset.php b/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/page_with_asset.php new file mode 100644 index 0000000000000..8ac3f0aea693a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/MediaContentCms/_files/page_with_asset.php @@ -0,0 +1,19 @@ +create(\Magento\Cms\Model\Page::class); +$page->setTitle('Cms Page 100') + ->setIdentifier('fixture_page_with_asset') + ->setStores([0]) + ->setIsActive(1) + ->setContent('content {{media url="testDirectory/path.jpg"}} content') + ->setContentHeading('