customer_sec_website.php 876 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. use Magento\Customer\Api\CustomerRepositoryInterface;
  8. use Magento\Customer\Api\Data\CustomerInterface;
  9. use Magento\TestFramework\Helper\Bootstrap;
  10. require __DIR__ . '/../../Store/_files/websites_different_countries.php';
  11. $objectManager = Bootstrap::getObjectManager();
  12. /** @var CustomerInterface $customer */
  13. $customer = $objectManager->create(CustomerInterface::class);
  14. $customer->setWebsiteId($websiteId)
  15. ->setEmail('customer.web@example.com')
  16. ->setGroupId(1)
  17. ->setStoreId($store->getId())
  18. ->setFirstname('John')
  19. ->setLastname('Doe')
  20. ->setGender(1);
  21. /** @var $repository CustomerRepositoryInterface */
  22. $repository = $objectManager->get(CustomerRepositoryInterface::class);
  23. $customer = $repository->save($customer);