mockCustomer example

$this->route = new RegisterConfirmRoute(
            $this->customerRepository,
            $this->eventDispatcher,
            $this->validator,
            $this->salesChannelContextPersister,
            $this->salesChannelContextService
        );
    }

    public function testConfirmCustomer(): void
    {
        $customer = $this->mockCustomer();

        $this->customerRepository->expects(static::exactly(2))
            ->method('search')
            ->willReturn(
                new EntitySearchResult(
                    'customer',
                    1,
                    new CustomerCollection([$customer]),
                    null,
                    new Criteria(),
                    $this->context->getContext()
                )
static::assertIsString($response->getContent());
        static::assertEquals(
            ['isValid' => true],
            json_decode($response->getContent(), true, 512, \JSON_THROW_ON_ERROR)
        );
    }

    public function testCheckCustomerEmailValidWithConstraintException(): void
    {
        static::expectException(ConstraintViolationException::class);

        $customer = $this->mockCustomer();

        $this->createInstance(new CustomerCollection([$customer]));
        $request = new Request([]['email' => 'random@email.com']);

        $this->administrationController->checkCustomerEmailValid($request$this->context);
    }

    public function testCheckCustomerEmailValidWithBoundSalesChannelIdInvalid(): void
    {
        if (Feature::isActive('v6.6.0.0')) {
            $this->expectException(RoutingException::class);
        }
Home | Imprint | This part of the site doesn't use cookies.