Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setConfirmedAt example
$requestData
=
new
RequestDataBag
(
)
;
$requestData
->
add
(
[
'email' => 'test@example.com',
'option' => 'direct',
'firstName' => 'Y',
'lastName' => 'Tran',
]
)
;
$newsletterRecipientEntity
=
new
NewsletterRecipientEntity
(
)
;
$newsletterRecipientEntity
->
setId
(
Uuid::
randomHex
(
)
)
;
$newsletterRecipientEntity
->
setConfirmedAt
(
new
\
DateTime
(
)
)
;
$entityRepository
=
new
StaticEntityRepository
(
[
[
$newsletterRecipientEntity
->
getId
(
)
]
,
new
NewsletterRecipientCollection
(
[
$newsletterRecipientEntity
]
)
,
]
)
;
$systemConfig
=
new
StaticSystemConfigService
(
[
TestDefaults::SALES_CHANNEL =>
[
'core.newsletter.doubleOptIn' => true,
]
,
]
)
;
public
function
testSubscribeWithValidation
(
array
$data
, array
$properties
, array
$constraints
)
: void
{
$requestData
=
new
RequestDataBag
(
)
;
$requestData
->
add
(
$data
)
;
$newsletterRecipientEntity
=
new
NewsletterRecipientEntity
(
)
;
$newsletterRecipientEntity
->
setId
(
Uuid::
randomHex
(
)
)
;
$newsletterRecipientEntity
->
setConfirmedAt
(
new
\
DateTime
(
)
)
;
$salutationEntitySearchResult
=
new
EntitySearchResult
(
'salutation',
1,
new
EntityCollection
(
[
]
)
,
null,
new
Criteria
(
)
,
Context::
createDefaultContext
(
)
)
;
$entityRepository
=
$this
->
createMock
(
EntityRepository::
class
)
;