Your IP : 127.0.0.1


Current Path : /home/dev2.destoffenstraat.com/app/code/Geissweb/Euvat/Test/Integration/_files/customer/
Upload File :
Current File : /home/dev2.destoffenstraat.com/app/code/Geissweb/Euvat/Test/Integration/_files/customer/address.php

<?php
/**
 * Customer address fixture with entity_id = 1
 *
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var \Magento\Customer\Model\Address $customerAddress */
$customerAddress = $objectManager->create(\Magento\Customer\Model\Address::class);
/** @var \Magento\Customer\Model\CustomerRegistry $customerRegistry */
$customerRegistry = $objectManager->get(\Magento\Customer\Model\CustomerRegistry::class);
$customerAddress->isObjectNew(true);
$customerAddress->setData(
    [
        'entity_id' => 1,
        'attribute_set_id' => 2,
        'telephone' => 3468676,
        'postcode' => 12345,
        'country_id' => 'DE',
        'city' => 'Berlin',
        'company' => 'Berlin GmbH',
        'street' => 'Grüne Straße 82',
        'lastname' => 'Bob',
        'firstname' => 'Marley',
        'parent_id' => 1
    ]
);
$customerAddress->save();


/** @var \Magento\Customer\Api\AddressRepositoryInterface $addressRepository */
$addressRepository = $objectManager->get(\Magento\Customer\Api\AddressRepositoryInterface::class);
$customerAddress = $addressRepository->getById($customerAddress->getId());
$customerAddress->setCustomerId(1);
$customerAddress = $addressRepository->save($customerAddress);
$customerRegistry->remove($customerAddress->getCustomerId());
/** @var \Magento\Customer\Model\AddressRegistry $addressRegistry */
$addressRegistry = $objectManager->get(\Magento\Customer\Model\AddressRegistry::class);
$addressRegistry->remove($customerAddress->getId());