Skip to content

Commit 3d9136d

Browse files
committed
Merge remote-tracking branch 'mainline-ce/2.4-develop' into MC-35827-2
2 parents 953b476 + 1e64fa5 commit 3d9136d

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

dev/tests/integration/framework/Magento/TestFramework/Workaround/Cleanup/StaticProperties.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class StaticProperties
4646
\Magento\TestFramework\Annotation\AppIsolation::class,
4747
\Magento\TestFramework\Workaround\Cleanup\StaticProperties::class,
4848
\Magento\Framework\Phrase::class,
49+
\Magento\TestFramework\Workaround\Override\Fixture\ResolverInterface::class,
50+
\Magento\TestFramework\Workaround\Override\ConfigInterface::class,
4951
];
5052

5153
private const CACHE_NAME = 'integration_test_static_properties';
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Catalog\Api\Data\ProductInterface;
9+
use Magento\Catalog\Api\Data\ProductInterfaceFactory;
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Catalog\Helper\DefaultCategory;
12+
use Magento\Catalog\Model\Product\Attribute\Source\Status;
13+
use Magento\Catalog\Model\Product\Type;
14+
use Magento\Catalog\Model\Product\Visibility;
15+
use Magento\Store\Api\WebsiteRepositoryInterface;
16+
use Magento\TestFramework\Helper\Bootstrap;
17+
18+
$objectManager = Bootstrap::getObjectManager();
19+
/** @var WebsiteRepositoryInterface $websiteRepository */
20+
$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
21+
$defaultWebsiteId = $websiteRepository->get('base')->getId();
22+
/** @var DefaultCategory $defaultCategory */
23+
$defaultCategory = $objectManager->get(DefaultCategory::class);
24+
/** @var ProductRepositoryInterface $productRepository */
25+
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
26+
/** @var ProductInterfaceFactory $productFactory */
27+
$productFactory = $objectManager->get(ProductInterfaceFactory::class);
28+
$product = $productFactory->create();
29+
$productData = [
30+
ProductInterface::TYPE_ID => Type::TYPE_SIMPLE,
31+
ProductInterface::ATTRIBUTE_SET_ID => $product->getDefaultAttributeSetId(),
32+
ProductInterface::SKU => 'product_disabled',
33+
ProductInterface::NAME => 'Product with category',
34+
ProductInterface::PRICE => 10,
35+
ProductInterface::VISIBILITY => Visibility::VISIBILITY_BOTH,
36+
ProductInterface::STATUS => Status::STATUS_DISABLED,
37+
'website_ids' => [$defaultWebsiteId],
38+
'stock_data' => [
39+
'use_config_manage_stock' => 1,
40+
'qty' => 100,
41+
'is_qty_decimal' => 0,
42+
'is_in_stock' => 1,
43+
],
44+
'category_ids' => [$defaultCategory->getId()],
45+
];
46+
$product->setData($productData);
47+
48+
$productRepository->save($product);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Catalog\Api\ProductRepositoryInterface;
9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Framework\Registry;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
$objectManager = Bootstrap::getObjectManager();
14+
/** @var Registry $registry */
15+
$registry = $objectManager->get(Registry::class);
16+
/** @var ProductRepositoryInterface $productRepository */
17+
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
18+
$registry->unregister('isSecureArea');
19+
$registry->register('isSecureArea', true);
20+
21+
try {
22+
$productRepository->deleteById('product_disabled');
23+
} catch (NoSuchEntityException $e) {
24+
// product already deleted
25+
}
26+
27+
$registry->unregister('isSecureArea');
28+
$registry->register('isSecureArea', false);

dev/tests/integration/testsuite/Magento/Customer/Model/EmailNotificationTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,36 @@ public function testRemindPasswordCustomTemplate(): void
141141
$this->assertMessage($expectedSender);
142142
}
143143

144+
/**
145+
* @magentoDataFixture Magento/Customer/_files/customer.php
146+
*
147+
* @return void
148+
*/
149+
public function testChangeEmailCustomTemplate(): void
150+
{
151+
$this->setEmailTemplateConfig(EmailNotification::XML_PATH_CHANGE_EMAIL_TEMPLATE);
152+
$customer = $this->customerRepository->get('customer@example.com');
153+
$customer->setEmail('customer_update@example.com');
154+
$this->emailNotification->credentialsChanged($customer, 'customer@example.com');
155+
$expectedSender = ['name' => 'CustomerSupport', 'email' => 'support@example.com'];
156+
$this->assertMessage($expectedSender);
157+
}
158+
159+
/**
160+
* @magentoDataFixture Magento/Customer/_files/customer.php
161+
*
162+
* @return void
163+
*/
164+
public function testChangeEmailAndPasswordCustomTemplate(): void
165+
{
166+
$this->setEmailTemplateConfig(EmailNotification::XML_PATH_CHANGE_EMAIL_AND_PASSWORD_TEMPLATE);
167+
$customer = $this->customerRepository->get('customer@example.com');
168+
$customer->setEmail('customer_update@example.com');
169+
$this->emailNotification->credentialsChanged($customer, 'customer@example.com', true);
170+
$expectedSender = ['name' => 'CustomerSupport', 'email' => 'support@example.com'];
171+
$this->assertMessage($expectedSender);
172+
}
173+
144174
/**
145175
* Assert message.
146176
*

0 commit comments

Comments
 (0)