NewsletterRecipientEntity example

public function testGetDecoratedShouldThrowException(): void
    {
        static::expectException(DecorationPatternException::class);
        $this->searchIndexer->getDecorated();
    }

    public function testGlobalData(): void
    {
        $context = Context::createDefaultContext();
        $repository = $this->createMock(EntityRepository::class);
        $newsletterRecipient = new NewsletterRecipientEntity();
        $newsletterRecipient->setUniqueIdentifier(Uuid::randomHex());
        $repository->method('search')->willReturn(
            new EntitySearchResult(
                'newsletter_recipient',
                1,
                new EntityCollection([$newsletterRecipient]),
                null,
                new Criteria(),
                $context
            )
        );

        
public function testSubscribeWithDOIEnabled(): void
    {
        $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()
        );

        

#[Package('buyers-experience')] class NewsletterRegisterEventTest extends TestCase
{
    public function testScalarValuesCorrectly(): void
    {
        $event = new NewsletterRegisterEvent(
            Context::createDefaultContext(),
            new NewsletterRecipientEntity(),
            'my-url',
            'my-sales-channel-id'
        );

        $storer = new ScalarValuesStorer();

        $stored = $storer->store($event[]);

        $flow = new StorableFlow('foo', Context::createDefaultContext()$stored);

        $storer->restore($flow);

        

        $storable = new StorableFlow('name', Context::createDefaultContext());

        $this->storer->restore($storable);

        static::assertEmpty($storable->data());
    }

    public function testLoadEntity(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);
        $entity = new NewsletterRecipientEntity();
        $result = $this->createMock(EntitySearchResult::class);
        $result->expects(static::once())->method('get')->willReturn($entity);

        $this->repository->expects(static::once())->method('search')->willReturn($result);
        $res = $this->storer->load(['3443', Context::createDefaultContext()]);

        static::assertEquals($res$entity);
    }

    public function testLoadNullEntity(): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.