/** @var array<string, string|null> $row */
$row =
$connection->
fetchAssociative('SELECT * FROM newsletter_recipient WHERE email = "test@example.com"'
);
static::
assertNotEmpty($row);
static::
assertSame('optIn',
$row['status'
]);
static::
assertNotNull($row['confirmed_at'
]);
// the confirmation date should have changed
static::
assertNotSame($row['confirmed_at'
],
$firstConfirmedAt);
} public function testSubscribeIfAlreadyRegistered(): void
{ $listener =
$this->
getMockBuilder(CallableClass::
class)->
getMock();
$listener->
expects(static::
never())->
method('__invoke'
);
$dispatcher =
$this->
getContainer()->
get('event_dispatcher'
);
$this->
addEventListener($dispatcher, NewsletterRegisterEvent::
class,
$listener);
$context = Context::
createDefaultContext();
$newsletterRecipientRepository =
$this->
getContainer()->
get('newsletter_recipient.repository'
);
$data =
[ 'id' => '22bbd935e68e4d64a4ab829bb91b30f1',
'status' => 'optIn',