Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchCustomerById example
$this
->
assignSalesChannelContext
(
$this
->browser
)
;
}
public
function
testUpdateRemoteAddressByLogin
(
)
: void
{
$email
= Uuid::
randomHex
(
)
. '@example.com';
$customerId
=
$this
->
login
(
$email
)
;
$remoteAddress
=
$this
->browser->
getRequest
(
)
->
getClientIp
(
)
;
$customer
=
$this
->
fetchCustomerById
(
$customerId
)
;
static
::
assertNotSame
(
$customer
->
getRemoteAddress
(
)
,
$remoteAddress
)
;
static
::
assertSame
(
$customer
->
getRemoteAddress
(
)
, IpUtils::
anonymize
(
(string)
$remoteAddress
)
)
;
}
private
function
login
(
string
$email
)
: string
{
$customerId
=
$this
->
createCustomer
(
$email
)
;
$this
->browser->
request
(
'POST', '/store-api/account/login',
[
'username' =>
$email
,