/** * Setup customer data */ protected function setUp() { $customerIdFromFixture = 1; $this->contactsHelper = Bootstrap::getObjectManager()->create('Magento\\Contact\\Helper\\Data'); $this->customerSession = Bootstrap::getObjectManager()->create('Magento\\Customer\\Model\\Session'); /** * @var $customerRepository \Magento\Customer\Api\CustomerRepositoryInterface */ $customerRepository = Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\CustomerRepositoryInterface'); $customerData = $customerRepository->getById($customerIdFromFixture); $this->customerSession->setCustomerDataObject($customerData); }
/** * Setup customer data */ protected function setUp() { $customerIdFromFixture = 1; $this->contactsHelper = Bootstrap::getObjectManager()->create('Magento\\Contact\\Helper\\Data'); $this->customerSession = Bootstrap::getObjectManager()->create('Magento\\Customer\\Model\\Session'); /** * @var $customerService \Magento\Customer\Service\V1\CustomerAccountServiceInterface */ $customerService = Bootstrap::getObjectManager()->create('Magento\\Customer\\Service\\V1\\CustomerAccountServiceInterface'); $customerData = $customerService->getCustomer($customerIdFromFixture); $this->customerSession->setCustomerDataObject($customerData); }