diff --git a/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml b/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml
index c891a578cdcca..185f7fdaaffa8 100644
--- a/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml
+++ b/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml
@@ -11,6 +11,7 @@
+
diff --git a/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php b/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php
index 8286175123fe2..84cb853ad5982 100644
--- a/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php
+++ b/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php
@@ -17,6 +17,7 @@ interface ProductLinkManagementInterface
*
* @param string $sku
* @param string $type
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
* @return \Magento\Catalog\Api\Data\ProductLinkInterface[]
*/
public function getLinkedItemsByType($sku, $type);
@@ -28,6 +29,7 @@ public function getLinkedItemsByType($sku, $type);
* @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $items
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\CouldNotSaveException
+ * @throws \Magento\Framework\Exception\InputException
* @return bool
*/
public function setProductLinks($sku, array $items);
diff --git a/app/code/Magento/Catalog/Model/ProductLink/Management.php b/app/code/Magento/Catalog/Model/ProductLink/Management.php
index 066549274b07c..017985e3f549f 100644
--- a/app/code/Magento/Catalog/Model/ProductLink/Management.php
+++ b/app/code/Magento/Catalog/Model/ProductLink/Management.php
@@ -6,37 +6,42 @@
namespace Magento\Catalog\Model\ProductLink;
-use Magento\Catalog\Api\Data;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\InputException;
+use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Catalog\Model\Product\LinkTypeProvider;
+use Magento\Catalog\Api\ProductLinkManagementInterface;
-class Management implements \Magento\Catalog\Api\ProductLinkManagementInterface
+/**
+ * Manage product links from api
+ */
+class Management implements ProductLinkManagementInterface
{
/**
- * @var \Magento\Catalog\Api\ProductRepositoryInterface
+ * @var ProductRepositoryInterface
*/
protected $productRepository;
/**
- * @var \Magento\Catalog\Model\Product\LinkTypeProvider
+ * @var LinkTypeProvider
*/
protected $linkTypeProvider;
/**
- * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
- * @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
+ * @param ProductRepositoryInterface $productRepository
+ * @param LinkTypeProvider $linkTypeProvider
*/
public function __construct(
- \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
- \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
+ ProductRepositoryInterface $productRepository,
+ LinkTypeProvider $linkTypeProvider
) {
$this->productRepository = $productRepository;
$this->linkTypeProvider = $linkTypeProvider;
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getLinkedItemsByType($sku, $type)
{
@@ -63,47 +68,42 @@ public function getLinkedItemsByType($sku, $type)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function setProductLinks($sku, array $items)
{
+
+ if (empty($items)) {
+ throw InputException::invalidFieldValue('items', 'empty array');
+ }
+
$linkTypes = $this->linkTypeProvider->getLinkTypes();
// Check if product link type is set and correct
- if (!empty($items)) {
- foreach ($items as $newLink) {
- $type = $newLink->getLinkType();
- if ($type == null) {
- throw InputException::requiredField("linkType");
- }
- if (!isset($linkTypes[$type])) {
- throw new NoSuchEntityException(
- __('The "%1" link type wasn\'t found. Verify the type and try again.', $type)
- );
- }
+ foreach ($items as $newLink) {
+ $type = $newLink->getLinkType();
+ if ($type == null) {
+ throw InputException::requiredField("linkType");
+ }
+ if (!isset($linkTypes[$type])) {
+ throw new NoSuchEntityException(
+ __('The "%1" link type wasn\'t found. Verify the type and try again.', $type)
+ );
}
}
$product = $this->productRepository->get($sku);
- // Replace only links of the specified type
$existingLinks = $product->getProductLinks();
- $newLinks = [];
- if (!empty($existingLinks)) {
- foreach ($existingLinks as $link) {
- if ($link->getLinkType() != $type) {
- $newLinks[] = $link;
- }
- }
- $newLinks = array_merge($newLinks, $items);
- } else {
- $newLinks = $items;
- }
+ $newLinks = array_merge($existingLinks, $items);
+
$product->setProductLinks($newLinks);
try {
$this->productRepository->save($product);
} catch (\Exception $exception) {
- throw new CouldNotSaveException(__('The linked products data is invalid. Verify the data and try again.'));
+ throw new CouldNotSaveException(
+ __('The linked products data is invalid. Verify the data and try again.')
+ );
}
return true;
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php
index ab52d87f56291..69bd7dc059022 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php
@@ -7,45 +7,66 @@
namespace Magento\Catalog\Test\Unit\Model\ProductLink;
use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Framework\Exception\InputException;
+use Magento\Framework\Exception\CouldNotSaveException;
+use Magento\Catalog\Model\ProductLink\Management;
+use Magento\Catalog\Model\ProductRepository;
+use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\LinkTypeProvider;
+use Magento\Catalog\Model\ProductLink\Link;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
-class ManagementTest extends \PHPUnit\Framework\TestCase
+/**
+ * Unit Test for Magento\Catalog\Model\ProductLink\Management
+ */
+class ManagementTest extends TestCase
{
+
+ const STUB_PRODUCT_SKU_1 = 'Simple Product 1';
+ const STUB_PRODUCT_SKU_2 = 'Simple Product 2';
+ const STUB_PRODUCT_TYPE = 'simple';
+ const STUB_LINK_TYPE = 'related';
+ const STUB_BAD_TYPE = 'bad type';
+
/**
- * @var \Magento\Catalog\Model\ProductLink\Management
+ * @var Management
*/
protected $model;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ProductRepository|MockObject
*/
-
protected $productRepositoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var Product|MockObject
*/
protected $productMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var LinkTypeProvider|MockObject
*/
protected $linkTypeProviderMock;
/**
- * @var \Magento\Framework\ObjectManagerInterface
+ * @var ObjectManagerHelper
*/
protected $objectManager;
- protected function setUp()
+ /**
+ * @inheritDoc
+ */
+ protected function setUp(): void
{
- $this->productRepositoryMock = $this->createMock(\Magento\Catalog\Model\ProductRepository::class);
- $this->productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
-
- $this->linkTypeProviderMock = $this->createMock(\Magento\Catalog\Model\Product\LinkTypeProvider::class);
+ $this->productRepositoryMock = $this->createMock(ProductRepository::class);
+ $this->productMock = $this->createMock(Product::class);
+ $this->linkTypeProviderMock = $this->createMock(LinkTypeProvider::class);
- $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->objectManager = new ObjectManagerHelper($this);
$this->model = $this->objectManager->getObject(
- \Magento\Catalog\Model\ProductLink\Management::class,
+ Management::class,
[
'productRepository' => $this->productRepositoryMock,
'linkTypeProvider' => $this->linkTypeProviderMock
@@ -53,193 +74,320 @@ protected function setUp()
);
}
- public function testGetLinkedItemsByType()
+ /**
+ * Test getLinkedItemsByType()
+ *
+ * @return void
+ */
+ public function testGetLinkedItemsByType(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
- $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->once())
+ ->method('getProductLinks')
+ ->willReturn($links);
- $this->productMock->expects($this->once())->method('getProductLinks')->willReturn($links);
- $this->assertEquals($links, $this->model->getLinkedItemsByType($productSku, $linkType));
+ $this->assertEquals(
+ $links,
+ $this->model->getLinkedItemsByType($productSku, $linkType)
+ );
}
/**
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionMessage The "bad type" link type is unknown. Verify the type and try again.
+ * Test for GetLinkedItemsByType() with wrong type
+ *
+ * @return void
+ * @throws NoSuchEntityException
*/
- public function testGetLinkedItemsByTypeWithWrongType()
+ public function testGetLinkedItemsByTypeWithWrongType(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'bad type';
- $this->productRepositoryMock->expects($this->never())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_BAD_TYPE;
+
+ $this->productRepositoryMock->expects($this->never())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->never())
+ ->method('getProductLinks')
+ ->willReturn($links);
+
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage(
+ 'The "bad type" link type is unknown. Verify the type and try again.'
+ );
- $this->productMock->expects($this->never())->method('getProductLinks')->willReturn($links);
$this->model->getLinkedItemsByType($productSku, $linkType);
}
- public function testSetProductLinks()
+ /**
+ * Test for setProductLinks()
+ *
+ * @return void
+ */
+ public function testSetProductLinks(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
- $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 1");
- $inputRelatedLink->setData("type_id", "related");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->once())
+ ->method('getProductLinks')
+ ->willReturn([]);
+ $this->productMock->expects($this->once())
+ ->method('setProductLinks')
+ ->with($links);
- $this->productMock->expects($this->once())->method('getProductLinks')->willReturn([]);
- $this->productMock->expects($this->once())->method('setProductLinks')->with($links);
$this->assertTrue($this->model->setProductLinks($productSku, $links));
}
/**
- * @expectedException \Magento\Framework\Exception\InputException
- * @expectedExceptionMessage "linkType" is required. Enter and try again.
+ * Test for SetProductLinks without link type in link object
+ *
+ * @return void
+ * @throws InputException
*/
- public function testSetProductLinksWithoutLinkTypeInLink()
+ public function testSetProductLinksWithoutLinkTypeInLink(): void
{
- $productSku = 'Simple Product 1';
+ $productSku = self::STUB_PRODUCT_SKU_1;
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
+ $inputRelatedLink = $this->objectManager->getObject(Link::class);
$inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setData("sku", "Simple Product 1");
+ $inputRelatedLink->setData("sku", self::STUB_PRODUCT_SKU_2);
$inputRelatedLink->setPosition(0);
$links = [$inputRelatedLink];
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->expectException(InputException::class);
+ $this->expectExceptionMessage(
+ '"linkType" is required. Enter and try again.'
+ );
$this->assertTrue($this->model->setProductLinks($productSku, $links));
}
/**
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionMessage The "bad type" link type wasn't found. Verify the type and try again.
+ * Test for SetProductLinks with empty array of items
+ *
+ * @return void
+ * @throws InputException
+ */
+ public function testSetProductLinksWithEmptyArrayItems(): void
+ {
+ $productSku = self::STUB_PRODUCT_SKU_1;
+
+ $this->productRepositoryMock->expects($this->never())
+ ->method('get')
+ ->with($productSku)
+ ->willReturn($this->productMock);
+
+ $this->linkTypeProviderMock->expects($this->never())
+ ->method('getLinkTypes')
+ ->willReturn([]);
+
+ $this->expectException(InputException::class);
+ $this->expectExceptionMessage(
+ 'Invalid value of "empty array" provided for the items field.'
+ );
+
+ $this->assertTrue($this->model->setProductLinks($productSku, []));
+ }
+
+ /**
+ * Test setProductLinks() throw exception if product link type not exist
+ *
+ * @return void
+ * @throws NoSuchEntityException
*/
public function testSetProductLinksThrowExceptionIfProductLinkTypeDoesNotExist()
{
- $productSku = 'Simple Product 1';
- $linkType = 'bad type';
- $this->productRepositoryMock->expects($this->never())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_BAD_TYPE;
+
+ $this->productRepositoryMock->expects($this->never())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage(
+ 'The "bad type" link type wasn\'t found. Verify the type and try again.'
+ );
$this->assertTrue($this->model->setProductLinks('', $links));
}
/**
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again.
+ * Test for setProductLinks() with no product exception
+ *
+ * @return void
+ * @throws NoSuchEntityException
*/
public function testSetProductLinksNoProductException()
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
-
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
$this->productRepositoryMock->expects($this->once())
->method('get')
- ->will(
- $this->throwException(
- new \Magento\Framework\Exception\NoSuchEntityException(
- __("The product that was requested doesn't exist. Verify the product and try again.")
- )
+ ->willThrowException(
+ new NoSuchEntityException(
+ __("The product that was requested doesn't exist. Verify the product and try again.")
)
);
+
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage(
+ "The product that was requested doesn't exist. Verify the product and try again."
+ );
+
$this->model->setProductLinks($productSku, $links);
}
/**
- * @expectedException \Magento\Framework\Exception\CouldNotSaveException
- * @expectedExceptionMessage The linked products data is invalid. Verify the data and try again.
+ * Test setProductLnks() with invliad data exception
+ *
+ * @return void
+ * @throws CouldNotSaveException
*/
- public function testSetProductLinksInvalidDataException()
+ public function testSetProductLinksInvalidDataException(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
- $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "bad sku");
- $inputRelatedLink->setData("type_id", "bad type");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
+
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->once())
+ ->method('getProductLinks')
+ ->willReturn([]);
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('save')
+ ->willThrowException(
+ new CouldNotSaveException(
+ __("The linked products data is invalid. Verify the data and try again.")
+ )
+ );
+
+ $this->expectException(CouldNotSaveException::class);
+ $this->expectExceptionMessage(
+ "The linked products data is invalid. Verify the data and try again."
+ );
+
+ $this->model->setProductLinks($productSku, $links);
+ }
+
+ /**
+ * Mock for getLinkTypesMock
+ *
+ * @return void
+ */
+ private function getLinkTypesMock(): void
+ {
+ $linkTypes = [
+ 'related' => 1,
+ 'upsell' => 4,
+ 'crosssell' => 5,
+ 'associated' => 3
+ ];
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
$this->linkTypeProviderMock->expects($this->once())
->method('getLinkTypes')
->willReturn($linkTypes);
+ }
- $this->productMock->expects($this->once())->method('getProductLinks')->willReturn([]);
-
- $this->productRepositoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
- $this->model->setProductLinks($productSku, $links);
+ /**
+ * get inputRelatedLinkMock
+ *
+ * @param string $productSku1
+ * @param string $linkType
+ * @param string $productSku2
+ * @param string $typeId
+ * @return array
+ */
+ private function getInputRelatedLinkMock(
+ string $productSku1,
+ string $linkType,
+ string $productSku2,
+ string $typeId
+ ) {
+
+ $inputRelatedLinkMock = $this->objectManager->getObject(Link::class);
+ $inputRelatedLinkMock->setProductSku($productSku1);
+ $inputRelatedLinkMock->setLinkType($linkType);
+ $inputRelatedLinkMock->setData("sku", $productSku2);
+ $inputRelatedLinkMock->setData("type_id", $typeId);
+ $inputRelatedLinkMock->setPosition(0);
+
+ return [$inputRelatedLinkMock];
}
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php b/app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php
new file mode 100644
index 0000000000000..c44a64f1d7433
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php
@@ -0,0 +1,135 @@
+objectManager = new ObjectManager($this);
+ $this->observerMock = $this->createMock(Observer::class);
+ $this->timezone = $this->createMock(Timezone::class);
+ $this->dateObject = $this->createMock(\DateTime::class);
+
+ $this->eventMock = $this->getMockBuilder(Event::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getProduct'])
+ ->getMock();
+
+ $this->productMock = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getSpecialPrice', 'getSpecialFromDate', 'setData'])
+ ->getMock();
+
+ $this->observer = $this->objectManager->getObject(
+ SetSpecialPriceStartDate::class,
+ [
+ 'localeDate' => $this->timezone
+ ]
+ );
+ }
+
+ /**
+ * Test observer execute method
+ */
+ public function testExecuteModifySpecialFromDate(): void
+ {
+ $specialPrice = 15;
+ $specialFromDate = null;
+ $localeDateMock = ['special_from_date' => $this->returnValue($this->dateObject)];
+
+ $this->observerMock
+ ->expects($this->once())
+ ->method('getEvent')
+ ->willReturn($this->eventMock);
+
+ $this->eventMock
+ ->expects($this->once())
+ ->method('getProduct')
+ ->willReturn($this->productMock);
+
+ $this->dateObject->expects($this->any())
+ ->method('setTime')
+ ->willReturnSelf();
+
+ $this->timezone
+ ->expects($this->once())
+ ->method('date')
+ ->willReturn($this->dateObject);
+
+ $this->productMock
+ ->expects($this->once())
+ ->method('getSpecialPrice')
+ ->willReturn($specialPrice);
+
+ $this->productMock
+ ->expects($this->once())
+ ->method('getSpecialFromDate')
+ ->willReturn($specialFromDate);
+
+ $this->productMock
+ ->expects($this->once())
+ ->method('setData')
+ ->willReturn($localeDateMock);
+
+ $this->observer->execute($this->observerMock);
+ }
+}
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml
index 6674c55064169..99037a5c89af1 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml
@@ -13,6 +13,7 @@
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml
index 7cc0719dcbeb2..be7122fbef054 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml
@@ -10,6 +10,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClearCustomersFiltersActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClearCustomersFiltersActionGroup.xml
new file mode 100644
index 0000000000000..3ca41bb014d47
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClearCustomersFiltersActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Goes to the Admin Customers grid page. Clicks on 'Clear Filters'.
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebSiteAndGroupActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebSiteAndGroupActionGroup.xml
new file mode 100644
index 0000000000000..fb4c1980fe975
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebSiteAndGroupActionGroup.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+ Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml
index 9741d4e4133bf..5757f79a7ac61 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml
@@ -47,28 +47,4 @@
-
-
-
- Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml
index 4c3660ac605a6..2ccef6f72e23f 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml
@@ -8,7 +8,7 @@
-
+
EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml
index 3551375c0e76b..e39800f8d9dd9 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml
@@ -8,7 +8,7 @@
-
+
EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'.
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml
index 8ac4779de7a9a..c2b41251c05b1 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml
@@ -9,7 +9,7 @@
-
+
Adds the provided Address to a Customer from the Admin Customers creation/edit page.
@@ -34,38 +34,4 @@
-
-
-
- EXTENDS: AdminEditCustomerAddressesFrom. Clicks on 'Set Default' for Billing/Shipping.
-
-
-
-
-
-
-
-
- EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.
-
-
-
-
-
-
-
-
-
-
- Selects the provided Option in the provided Customer Address Attribute drop down menu. Clicks on Save.
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertSignedUpNewsletterActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertSignedUpNewsletterActionGroup.xml
new file mode 100644
index 0000000000000..deabec7d671d6
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertSignedUpNewsletterActionGroup.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+ Validates that the provided Customer details are present and correct on the Storefront Customer Dashboard page.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml
index 81b8cabaa51ef..62f4c87545c6f 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml
@@ -30,29 +30,4 @@
-
-
-
- Goes to the Admin Customers grid page. Deletes a Customer based on the provided Email Address.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerByEmailActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerByEmailActionGroup.xml
new file mode 100644
index 0000000000000..5920596633f76
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerByEmailActionGroup.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+ Goes to the Admin Customers grid page. Deletes a Customer based on the provided Email Address.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerFromAdminActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerFromAdminActionGroup.xml
new file mode 100644
index 0000000000000..04083f688b75d
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerFromAdminActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Goes to the Admin Customers grid page. Deletes the provided Customer from the grid. Validates that the Success message is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoActionGroup.xml
new file mode 100644
index 0000000000000..c72010fe5c3bf
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoActionGroup.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ Fills in the provided Customer details (First/Last Name, Company, Phone # and Address) on the Admin Customer creation/edit page. Clicks on the Save button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoFillStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoFillStateActionGroup.xml
new file mode 100644
index 0000000000000..891b578e54e6b
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoFillStateActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ EXTENDS: EnterCustomerAddressInfo. Fills the State field.
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerAddressFromAdminActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerAddressFromAdminActionGroup.xml
new file mode 100644
index 0000000000000..86ac1dc650bbc
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerAddressFromAdminActionGroup.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ Filters the Admin Customers Addresses based on the provided Address. Clicks on Edit.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml
index e338d1ae4bbd0..c9d5375d9b3d7 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml
@@ -26,57 +26,4 @@
-
-
-
- Filters the Admin Customers Addresses based on the provided Address. Clicks on Edit.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Goes to the Admin Customers grid page. Deletes the provided Customer from the grid. Validates that the Success message is present and correct.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Goes to the Admin Customers grid page. Clicks on 'Clear Filters'.
-
-
-
-
-
-
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SaveRegistrationFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SaveRegistrationFormActionGroup.xml
new file mode 100644
index 0000000000000..babef0fdd60d9
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SaveRegistrationFormActionGroup.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SelectDropdownCustomerAddressAttributeValueActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SelectDropdownCustomerAddressAttributeValueActionGroup.xml
new file mode 100644
index 0000000000000..5d0fb2e7b5c8d
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SelectDropdownCustomerAddressAttributeValueActionGroup.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ Selects the provided Option in the provided Customer Address Attribute drop down menu. Clicks on Save.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewCustomerStorefrontActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewCustomerStorefrontActionGroup.xml
new file mode 100644
index 0000000000000..f994bafda73e0
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewCustomerStorefrontActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ EXTENDS: SignUpNewUserFromStorefrontActionGroup. Adds a waitForPageLoad action to the Action Group. Removes the action for 'seeThankYouMessage'.
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml
index 3cb37a248aa30..56afa8854ce0d 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml
@@ -30,193 +30,4 @@
-
-
-
- Goes to the Storefront. Clicks on 'Create Account'. Fills in the provided Customer details, including Newsletter Sign-Up. Clicks on 'Create Account' button.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Validates that the provided Customer details are present and correct on the Storefront Customer Dashboard page.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fills in the provided Customer details (First/Last Name, Company, Phone # and Address) on the Admin Customer creation/edit page. Clicks on the Save button.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- EXTENDS: EnterCustomerAddressInfo. Fills the State field.
-
-
-
-
-
-
-
- Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address is present and correct on the Storefront Customer Dashboard Address section.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address is present and correct.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address, including the State, is present and correct.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address, including the State, is present and correct.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Goes to the Storefront Customer Dashboard page. Validates that the Customer First/Last Name is present and correct.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- EXTENDS: SignUpNewUserFromStorefrontActionGroup. Adds a waitForPageLoad action to the Action Group. Removes the action for 'seeThankYouMessage'.
-
-
-
-
-
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerDefaultAddressActionGroup.xml
similarity index 57%
rename from app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerAddressActionGroup.xml
rename to app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerDefaultAddressActionGroup.xml
index dc21ce5f52d73..ce26d14bb95f7 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerAddressActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerDefaultAddressActionGroup.xml
@@ -8,28 +8,6 @@
-
-
- Goes to the Storefront Customer Add New Address page. Fills in the provided Address details. Clicks on Save.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Goes to the Storefront Customer Add New Default Address page. Fills in the provided Address details. Clicks on Save.
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddNewCustomerAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddNewCustomerAddressActionGroup.xml
new file mode 100644
index 0000000000000..358930070bc1b
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddNewCustomerAddressActionGroup.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ Goes to the Storefront Customer Add New Address page. Fills in the provided Address details. Clicks on Save.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCreateCustomerSignedUpNewsletterActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCreateCustomerSignedUpNewsletterActionGroup.xml
new file mode 100644
index 0000000000000..22a90fca78cb2
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCreateCustomerSignedUpNewsletterActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Goes to the Storefront. Clicks on 'Create Account'. Fills in the provided Customer details, including Newsletter Sign-Up. Clicks on 'Create Account' button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml
index 98a7f4c8d1544..bbe5fcbbf4038 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml
@@ -16,15 +16,4 @@
-
-
-
- Clicks on Customer Account. Clicks on 'Sign-Out'. Validates that the success message is present and correct. PLEASE NOTE: The Success Message is hardcoded.
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontFillRegistrationFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontFillRegistrationFormActionGroup.xml
new file mode 100644
index 0000000000000..984d4f437aeb0
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontFillRegistrationFormActionGroup.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml
index 31a988ac9da0d..b013b1db1c8e7 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml
@@ -16,15 +16,4 @@
-
-
-
- Goes to the Storefront Customer Create page using Store code in URL option.
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup.xml
new file mode 100644
index 0000000000000..f095927c5be1b
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Goes to the Storefront Customer Create page using Store code in URL option.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml
new file mode 100644
index 0000000000000..61c5f9ef7c66e
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Clicks on Customer Account. Clicks on 'Sign-Out'. Validates that the success message is present and correct. PLEASE NOTE: The Success Message is hardcoded.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressActionGroup.xml
new file mode 100644
index 0000000000000..c439f7529993c
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address is present and correct on the Storefront Customer Dashboard Address section.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressWithStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressWithStateActionGroup.xml
new file mode 100644
index 0000000000000..7e46fcd7807db
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressWithStateActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address, including the State, is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerNameOnFrontendActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerNameOnFrontendActionGroup.xml
new file mode 100644
index 0000000000000..49ee62e5e86d2
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerNameOnFrontendActionGroup.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard page. Validates that the Customer First/Last Name is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressActionGroup.xml
new file mode 100644
index 0000000000000..e6d07ef1afc63
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressActionGroup.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressWithStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressWithStateActionGroup.xml
new file mode 100644
index 0000000000000..a90a05bead69c
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressWithStateActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address, including the State, is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml
new file mode 100644
index 0000000000000..5efcfc0e79b0d
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+
+ Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.
+
+
+
+
+
+
+
+
+
+
+ EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'.
+
+
+
+
+
+
+
+
+ Fills in the provided Customer details (First/Last Name, Company, Phone # and Address) on the Admin Customer creation/edit page. Clicks on the Save button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EXTENDS: EnterCustomerAddressInfo. Fills the State field.
+
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address is present and correct on the Storefront Customer Dashboard Address section.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address, including the State, is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address, including the State, is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Goes to the Storefront Customer Dashboard page. Validates that the Customer First/Last Name is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml
index f58f23dee4235..010f03c9fc97f 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml
@@ -42,7 +42,7 @@
-
+
@@ -115,7 +115,7 @@
-
+
@@ -170,7 +170,7 @@
-
+
@@ -305,4 +305,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml
index daab5fd2061fb..88cdb32323d56 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml
@@ -52,7 +52,7 @@
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml
index 4c35cdbdb7cbb..560f70ffff571 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml
@@ -72,7 +72,7 @@
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml
index 7a96616885468..fb08a07a7c319 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml
index d36d640c5ad17..1459a8e654c28 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml
@@ -32,19 +32,19 @@
-
+
-
+
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml
index 285de8d777b48..d2398629b7f40 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml
@@ -32,19 +32,19 @@
-
+
-
+
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml
index dae456c96a679..9e6e1ac0968fa 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml
@@ -33,20 +33,20 @@
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml
index 7b6e695aa8dc4..d6879761b10c3 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml
@@ -33,25 +33,25 @@
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml
index e11404db9a9a9..feccf82d32b2f 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml
@@ -33,25 +33,25 @@
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml b/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml
index 853872dd907bd..e32bbaa1c9760 100644
--- a/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml
+++ b/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php
index f89201688b7fa..6bdaa40019f8a 100644
--- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php
+++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php
@@ -17,6 +17,7 @@
use Magento\Newsletter\Model\SubscriptionManagerInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;
+use Magento\Framework\Api\SearchResults;
use Psr\Log\LoggerInterface;
/**
@@ -233,6 +234,27 @@ public function afterGetById(CustomerRepositoryInterface $subject, CustomerInter
return $customer;
}
+ /**
+ * Add subscription status to customer list
+ *
+ * @param CustomerRepositoryInterface $subject
+ * @param SearchResults $searchResults
+ * @return SearchResults
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function afterGetList(CustomerRepositoryInterface $subject, SearchResults $searchResults): SearchResults
+ {
+ foreach ($searchResults->getItems() as $customer) {
+ /** @var CustomerExtensionInterface $extensionAttributes */
+ $extensionAttributes = $customer->getExtensionAttributes();
+
+ $isSubscribed = (int) $extensionAttributes->getIsSubscribed() === Subscriber::STATUS_SUBSCRIBED ?: false;
+ $extensionAttributes->setIsSubscribed($isSubscribed);
+ }
+
+ return $searchResults;
+ }
+
/**
* Set Is Subscribed extension attribute
*
diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml
index 07c7cc050d5cf..5b9c7ae46c42d 100644
--- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml
+++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml
@@ -11,6 +11,7 @@
+
diff --git a/app/code/Magento/Newsletter/etc/extension_attributes.xml b/app/code/Magento/Newsletter/etc/extension_attributes.xml
index 50f46af5c033b..09925024e97d5 100644
--- a/app/code/Magento/Newsletter/etc/extension_attributes.xml
+++ b/app/code/Magento/Newsletter/etc/extension_attributes.xml
@@ -8,6 +8,10 @@
-
+
+
+ subscriber_status
+
+
diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml
index 6d35319172823..a2488d564001c 100644
--- a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml
+++ b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml
index 1fa01e0efa156..b8445d152cc3b 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml
@@ -14,6 +14,7 @@
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml
index e7bf7702328c0..3d584f988780e 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml
@@ -48,7 +48,7 @@
-
+
@@ -166,7 +166,7 @@
-
+
diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml
index 741be6985d517..f182cd2c6a431 100644
--- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml
+++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml
@@ -14,6 +14,7 @@
+
diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml
index 3bf278db8410a..d78148cca3cc2 100644
--- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml
+++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml
@@ -12,6 +12,7 @@
+
diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php
index 7a02e2f843719..8ee23a1efea44 100644
--- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php
@@ -8,6 +8,8 @@
use Magento\Customer\Api\Data\CustomerInterface as Customer;
use Magento\Customer\Api\Data\AddressInterface as Address;
+use Magento\Framework\Api\FilterBuilder;
+use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SortOrder;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\LocalizedException;
@@ -482,11 +484,17 @@ public function testCreateCustomerWithoutAddressRequiresException()
/**
* Test with a single filter
+ *
+ * @param bool $subscribeStatus
+ * @return void
+ *
+ * @dataProvider subscriptionDataProvider
*/
- public function testSearchCustomers()
+ public function testSearchCustomers(bool $subscribeStatus): void
{
- $builder = Bootstrap::getObjectManager()->create(\Magento\Framework\Api\FilterBuilder::class);
- $customerData = $this->_createCustomer();
+ $builder = Bootstrap::getObjectManager()->create(FilterBuilder::class);
+ $subscribeData = $this->buildSubscriptionData($subscribeStatus);
+ $customerData = $this->_createCustomer($subscribeData);
$filter = $builder
->setField(Customer::EMAIL)
->setValue($customerData[Customer::EMAIL])
@@ -494,13 +502,13 @@ public function testSearchCustomers()
$this->searchCriteriaBuilder->addFilters([$filter]);
$searchData = $this->dataObjectProcessor->buildOutputDataArray(
$this->searchCriteriaBuilder->create(),
- \Magento\Framework\Api\SearchCriteriaInterface::class
+ SearchCriteriaInterface::class
);
$requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
- 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
+ 'httpMethod' => Request::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -511,6 +519,35 @@ public function testSearchCustomers()
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(1, $searchResults['total_count']);
$this->assertEquals($customerData[Customer::ID], $searchResults['items'][0][Customer::ID]);
+ $this->assertEquals($subscribeStatus, $searchResults['items'][0]['extension_attributes']['is_subscribed']);
+ }
+
+ /**
+ * Build subscription extension attributes data
+ *
+ * @param bool $status
+ * @return array
+ */
+ private function buildSubscriptionData(bool $status): array
+ {
+ return [
+ 'extension_attributes' => [
+ 'is_subscribed' => $status,
+ ],
+ ];
+ }
+
+ /**
+ * Subscription customer data provider
+ *
+ * @return array
+ */
+ public function subscriptionDataProvider(): array
+ {
+ return [
+ 'subscribed user' => [true],
+ 'not subscribed user' => [false],
+ ];
}
/**
@@ -857,11 +894,12 @@ protected function _getCustomerData($customerId)
}
/**
+ * @param array|null $additionalData
* @return array|bool|float|int|string
*/
- protected function _createCustomer()
+ protected function _createCustomer(?array $additionalData = [])
{
- $customerData = $this->customerHelper->createSampleCustomer();
+ $customerData = $this->customerHelper->createSampleCustomer($additionalData);
$this->currentCustomerId[] = $customerData['id'];
return $customerData;
}